Compare commits

...
3777 Commits
Author SHA1 Message Date
monojenkins 3a07bd426d [2018-08] [arm64] Correct exception filter stack frame size (#14769)
[2018-08] [arm64] Correct exception filter stack frame size

Fixes: https://github.com/mono/mono/issues/14170
Fixes: https://github.com/xamarin/xamarin-android/issues/3112

The `call_filter()` function generated by `mono_arch_get_call_filter()`
was overwriting a part of the previous stack frame because it was not
creating a large enough new stack frame for itself.  This had been
working by luck before the switch to building the runtime with Android
NDK r19.

I used a local build of [xamarin/xamarin-android/d16-1@87a80b][0] to
verify that this change resolved both of the issues linked above.  I
also confirmed that I was able to reintroduce the issues in my local
environment by removing the change and rebuilding.

After this change, the generated `call_filter()` function now starts by
reserving sufficient space on the stack to hold a 64-bit value at the
`ctx_offset` location.  The 64-bit `ctx` value is saved to the
`ctx_offset` location (offset 344 in the new stack frame) shortly
afterwards:

    stp	x29, x30, [sp,#-352]!
    mov	x29, sp
    str	x0, [x29,#344]

As expected, the invocation of `call_filter()` now no longer modifies
the top of the previous stack frame.

Top of the stack before `call_filter()`:

    (gdb) x/8x $sp
    0x7fcd2774a0:	0x7144d250	0x00000000	0x2724b700	0x00000000
    0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

Top of the stack after `call_filter()` (unchanged):

    (gdb) x/8x $sp
    0x7fcd2774a0:	0x7144d250	0x00000000	0x2724b700	0x00000000
    0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

<details>
<summary>Additional background information</summary>

### The original lucky, "good" behavior for [mono/mono/2018-08@725ba2a built with Android NDK r14][1]

 1. The `resume` parameter for `mono_handle_exception_internal()` is
    held in register `w23`.

 2. That register is saved into the current stack frame at offset 20 by
    a `str` instruction:

           0x00000000000bc1bc <+3012>:	str	w23, [sp,#20]

 3. `handle_exception_first_pass()` invokes `call_filter()` via a `blr`
    instruction:

        2279							filtered = call_filter (ctx, ei->data.filter);
           0x00000000000bc60c <+4116>:	add	x9, x22, x24, lsl #6
           0x00000000000bc610 <+4120>:	ldr	x8, [x8,#3120]
           0x00000000000bc614 <+4124>:	ldr	x1, [x9,#112]
           0x00000000000bc618 <+4128>:	add	x0, sp, #0x110
           0x00000000000bc61c <+4132>:	blr	x8

    Before the `blr` instruction, the top of the stack looks like this:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0x0a8b31d8	0x00000071
        0x7fcd2774b0:	0x00000000	0x00000000	0x1ef51980	0x00000071

 4. `call_filter()` runs.  This function is generated by
    `mono_arch_get_call_filter()` and starts with:

           stp	x29, x30, [sp,#-336]!
           mov	x29, sp
           str	x0, [x29,#344]

    Note in particular how the first line subtracts 336 from `sp` to
    start a new stack frame, but the third line writes to a position
    that is 344 bytes beyond that, back within the *previous* stack
    frame.

 5. After the invocations of `call_filter()` and
    `handle_exception_first_pass()`, `w23` is restored from the stack:

           0x00000000000bc820 <+4648>:	ldr	w23, [sp,#20]

    At this step, the top of the stack looks like this:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0xcd2775b0	0x0000007f
        0x7fcd2774b0:	0x00000000	0x00000000	0x1ef51980	0x00000071

    Notice how `call_filter()` has overwritten bytes 8 through 15 of the
    stack frame.  In this original lucky scenario, this does not affect
    the value restored into register `w23` because that value starts at
    byte 20.

 6. `mono_handle_exception_internal()` tests the value of `w23` to
    decide how to set the `ji` local variable:

        2574			if (resume) {
           0x00000000000bb960 <+872>:	cbz	w23, 0xbb9c4 <mono_handle_exception_internal+972>

    Since `w23` is `0`, `mono_handle_exception_internal()` correctly
    continues into the `else` branch.

### The bad behavior for [mono/mono/2018-08@725ba2a built with Android NDK r19][2] works slightly differently

 1. As before, the local `resume` parameter starts in register `w23`.
 2. This time, the register is saved into the stack frame at offset 12
    (instead of 20):

           0x00000000000bed7c <+3200>:	str	w23, [sp,#12]

 3. As before, `handle_exception_first_pass()` invokes `call_filter()`
    via a `blr` instruction.

    At this step, the top of the stack looks like this:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0x2724b700	0x00000000
        0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

 4. `call_filter()` runs as before.  And the first few instructions of
    that function are the same as before:

        stp	x29, x30, [sp,#-336]!
        mov	x29, sp
        str	x0, [x29,#344]

 5. `w23` is again restored from the stack, but this time from offset 12:

           0x00000000000bf2c0 <+4548>:	ldr	w23, [sp,#12]

    The problem is that `call_filter()` has again overwritten bytes 8
    through 15 of the stack frame:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0xcd2775b0	0x0000007f
        0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

    So after the `ldr` instruction, `w23` has an incorrect value of
    `0x7f` rather than the correct value `0`.

 6. As before, `mono_handle_exception_internal()` tests the value of `w23` to
    decide how to set the `ji` local variable:

        2574			if (resume) {
           0x00000000000be430 <+820>:	cbz	w23, 0xbe834 <mono_handle_exception_internal+1848>

    But this time because `w23` is *not* zero, execution continues
    *incorrectly* into the `if` branch rather than the `else` branch.
    The result is that `ji` is set to `0` rather than a valid
    `(MonoJitInfo *)` value.  This incorrect value for `ji` leads to a
    null pointer dereference, as seen in the bug reports.

[0]: https://github.com/xamarin/xamarin-android/tree/xamarin-android-9.3.0.22
[1]: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-freestyle/1432/Azure/
[2]: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-freestyle/1436/Azure/

</details>

Backport of #14757.

/cc @lambdageek @brendanzagaeski
2019-06-03 14:26:18 -04:00
monojenkins 223ea7ef92 Bump API snapshot submodule 2019-05-10 11:09:54 +02:00
Marek Safar 913c11def5 [Facades] Include missing enums in System.Memory 2019-05-10 11:09:54 +02:00
Thays Grazia 6843da5c57 A deadlock happens when during a process_suspend there is a pending invoke and then when it's calling the invoke there is another call to process_suspend in the same thread. 2019-05-10 10:29:55 +02:00
Ankit Jain 167f04c902 Bump msbuild to track mono-2018-08 (#14396)
* Bump msbuild to track mono-2018-08

* Update nuget version
   (Thanks for @lewing)
2019-05-08 15:04:30 -04:00
Ankit Jain 082e1a2346 Bump msbuild to track mono-2018-08 2019-04-30 18:19:54 +02:00
Alexander Köplinger 18fde9f8c2 Fix Windows MSI build
(cherry picked from commit 8aaf420efe)
2019-04-29 13:53:21 -04:00
Alexander Köplinger ea8ae3e8e0 More Windows MSI fixes
(cherry picked from commit e0326df7c6)
(cherry picked from commit 04dc2f342c)
2019-04-29 13:53:11 -04:00
Alexander Köplinger d1b7bf2c47 Fix Windows MSI build, msbuild is now in Current instead of 15.0
(cherry picked from commit 0ae04b8e80)
2019-04-29 13:52:55 -04:00
monojenkins 3cb36842fc [corlib] Disable four tests in TypeTest (#14213)
TypeTest.MakeGenericType_BadUserType
TypeTest.MakeGenericType_NestedUserDefinedType
TypeTest.MakeGenericType_UserDefinedType
TypeTest.TestMakeGenericType_UserDefinedType_DotNet20SP1

These tests pass when run with the interpreter on xamarin-macios.
They were disabled on master with https://github.com/mono/mono/commit/dc9bc9e0e6462739872117afc59e46fbc780d981
2019-04-25 11:13:51 +02:00
Zoltan Varga 6c9921e64b [jit] Avoid an assert when gsharedvt enums are boxed.
Fixes https://github.com/mono/mono/issues/13297.
2019-04-24 11:17:17 +02:00
Ankit Jain 4d857ac249 Bump msbuild to track mono-2018-08 (#14068)
To pick up update for the NuGetSdkResolver: https://github.com/mono/msbuild/pull/92
2019-04-17 00:35:05 +02:00
Ankit Jain a2d28226d4 [nuget] Bump to nuget 5.0.0 2019-04-12 08:14:22 +02:00
Ankit Jain 592c75cf1f Bump msbuild to track mono-2018-08-test (#13927)
Bump to get the msbuild 16 update
<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2019-04-12 08:09:15 +02:00
Zoltan Varga 3f5ec6d95c [jit] Make dlmalloc use mono_valloc so it picks up the MAP_JIT flag on osx.
Fixes https://github.com/mono/mono/issues/13878.
2019-04-11 18:02:31 +02:00
monojenkins bf4e8d2ae1 [debugger-agent] Ignore thread_end event if thread is detached (#13937)
The thread_stopped profiler event can be raised by the thread_info_key_dtor tls
key destructor when the thread is already doesn't have a domain set.  In that
case, don't call process_profiler_event since it cannot handle a thread with
null TLS values.

Addresses https://github.com/xamarin/xamarin-android/issues/2920
with the following stack trace

```
* thread #20, name = 'Filter', stop reason = signal SIGSEGV: invalid address (fault address: 0xbc)
  * frame #0: libmonosgen-2.0.so`mono_class_vtable_checked(domain=0x0000000000000000, klass=0x0000007200230648, error=0x00000071e92f9178) at object.c:1890
    frame #1: libmonosgen-2.0.so`get_current_thread_ptr_for_domain(domain=0x0000000000000000, thread=0x00000071ebfec508) at threads.c:595
    frame #2: libmonosgen-2.0.so`mono_thread_current at threads.c:1939
    frame #3: libmonosgen-2.0.so`process_event(event=<unavailable>, arg=<unavailable>, il_offset=<unavailable>, ctx=<unavailable>, events=<unavailable>, suspend_policy=<unavailable>) at debugger-agent.c:3715
    frame #4: libmonosgen-2.0.so`thread_end [inlined] process_profiler_event(event=EVENT_KIND_THREAD_DEATH, arg=0x00000071ebfec508) at debugger-agent.c:3875
    frame #5: libmonosgen-2.0.so`thread_end(prof=<unavailable>, tid=<unavailable>) at debugger-agent.c:3991
    frame #6: libmonosgen-2.0.so`mono_profiler_raise_thread_stopped(tid=<unavailable>) at profiler-events.h:105
    frame #7: libmonosgen-2.0.so`mono_thread_detach_internal(thread=<unavailable>) at threads.c:979
    frame #8: libmonosgen-2.0.so`thread_detach(info=0x00000071e949a000) at threads.c:3215
    frame #9: libmonosgen-2.0.so`unregister_thread(arg=<unavailable>) at mono-threads.c:544
    frame #10: libmonosgen-2.0.so`thread_info_key_dtor(arg=0x00000071e949a000) at mono-threads.c:774
    frame #11: 0x00000072899c58e8 libc.so`pthread_key_clean_all() + 124
    frame #12: 0x00000072899c5374 libc.so`pthread_exit + 76
    frame #13: 0x00000072899c5264 libc.so`__pthread_start(void*) + 44
    frame #14: 0x000000728996617c libc.so`__start_thread + 72
```
2019-04-09 10:37:47 -04:00
Alexander Köplinger ca30169e75 Bump bockbuild to get GTK fix (#13912) (#13919)
https://github.com/mono/bockbuild/pull/93
2019-04-08 15:57:49 +02:00
Alexander Köplinger 7fb1361513 [MacSDK] Bump bockbuild for fix to #13804 2019-04-08 11:52:41 +02:00
Alexander Kyte f236105056 [2018-08] [merp] Fix image size reported (#13886)
Fixes #13834

Backport of #13847.
2019-04-06 02:03:25 +02:00
Maxim Lipnin 4b020ca06d Fix transition offset logic (#13553)
I'm not sure about the correctness of this workaround but it works on macOS for the repro from https://github.com/mono/mono/issues/9664#issuecomment-472260968

Transition bounds used by time zone info represent some local date-time but actually they are of Unspecified date-time kind. 
When we try to get transition offset we compare some current date-time converted to UTC with appropriate transition bounds.
The fix is to use UTC for both current date-time and transition bounds during comparing.

Fixes https://github.com/mono/mono/issues/9664
2019-04-02 19:22:21 +02:00
Zoltan Varga e475d80db3 [llvm] Fix the computation of size of gshared instances in another place.
Fixes https://github.com/mono/mono/issues/13610.
2019-03-29 13:40:12 +01:00
Aleksey Kliger (λgeek) c87a95ea23 [llvm] Fix the computation of size of gshared instances in emit_args_to_vtype (). (#13675)
Fixes https://github.com/mono/mono/issues/13610.
2019-03-26 14:54:01 -04:00
Bernhard Urban 75282c430b [amd64] use 32bit variant of lea_membase for 32bit operations
Consider
```
 xor %r15, %r15       // %r15 = 0x0
 dec %r15d            // %r15 = 0xffff_ffff
 lea 0x1(%r15), %rdx  // %rdx = 0x1_0000_0000 but should be 0x0
```

instead `lea 0x1(%r15), %edx` should be generated.
2019-03-26 14:51:56 +01:00
Thays Grazia 5756d04e1d [debugger] Adding a comment to make it clear for the next debuggers. 2019-03-22 19:59:07 +01:00
Thays Grazia 484ce49a0b [debugger] Fixing two crashes while debugging an Android app.
-> Doing stepping into in VSM in some situation the frame saved in TLS is not synchronised with what is really been executed in the main thread. This makes the debugger-agent crashes because it tries to get variable info in some memory that is not available anymore.
	-> To fix it I forced the update of stack when CMD_THREAD_GET_FRAME_INFO is called.

-> Doing step over in Visual Studio for Windows, if you have the threads debugger window enabled, VSW calls frame_commands for each thread that is showed, and if the thread is not really_suspended it tries to get variable info from a memory that is not available anymore because the thread is not suspended yet.
	-> To fix it I don't send variable info of a frame if the thread is not really_suspended and doesn't have an async_state valid.

#Fixes 12843
2019-03-22 19:59:07 +01:00
Thomas Lehner 6a81d1dd5f [System] Fix a race condition in HttpRequestChannel.
Concurrent request completions could cause following exception:

    FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException:
        Index was out of range. Must be non-negative and less than
        the size of the collection.
        Parameter name: index
       at System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) [0x00009] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Collections.Generic.List`1[T].Remove (T item) [0x0000c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.Cleanup () [0x00011] in <28c4695205ef47378f5370502b066592>:0
       at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.set_IsCompleted (System.Boolean value) [0x00034] in <28c4695205ef47378f5370502b066592>:0
       at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.Complete (System.Exception ex) [0x0001a] in <28c4695205ef47378f5370502b066592>:0
       at System.ServiceModel.Channels.HttpRequestChannel+<>c__DisplayClass7_1.<BeginProcessRequest>b__0 (System.IAsyncResult r) [0x000bd] in <28c4695205ef47378f5370502b066592>:0

    This stack was captured after some changes in AwaitTaskContinuation.RunOrScheduleAction.
    Unfortunately the current implementation of AwaitTaskContinuation.RunOrScheduleAction re-throws the above
    exception with a wrong stack:

       at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishStageTwo () [0x000a1] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.Finish (System.Boolean bUserDelegateExecuted) [0x00003] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.TrySetException (System.Object exceptionObject) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetException (System.Exception exception) [0x00029] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Net.HttpWebRequest+<RunWithTimeoutWorker>d__241`1[T].MoveNext () [0x000e0] in <3e9b3e26c4694baab3f689687ad40612>:0
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00024] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x0004f] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x0003d] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Net.ServicePointScheduler+<WaitAsync>d__45.MoveNext () [0x000f7] in <3e9b3e26c4694baab3f689687ad40612>:0
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <4a8a0

    On an Android Xamarin installation this causes an app crash. Since no user code is active the exception cannot be caught.
2019-03-21 11:28:57 +01:00
Alexander Kyte fdb26b0a44 [merp] Fix anon allocation, use MAP_PRIVATE 2019-03-20 13:57:41 +01:00
Alexander Kyte 82547c4a12 [crash] Fallback to MAP_ANONYMOUS for allocator
This is helpful by allowing the crash reporter to work even while
unable to write to the working directory.
2019-03-19 16:34:56 +01:00
Alexander Köplinger 693806ceda Bump bockbuild for GTK fix 2019-03-19 07:58:33 +01:00
Jo Shields 9cb3348c31 Append .1 to version number 2019-03-14 16:18:00 -04:00
Jo Shields 948b450991 Include libgdiplus 5.6.1
(cherry picked from commit 5888bf9acc)
2019-03-14 16:14:40 -04:00
Alexis Christoforides 60e60904ac [MacSDK] Bump Nuget to 4.8.2 2019-03-12 22:37:15 +01:00
Alexander Köplinger 89d7665e28 [2018-08] Bump bockbuild to get GTK fix (#13329)
See https://github.com/mono/bockbuild/pull/90
2019-03-06 23:36:48 +01:00
Zoltan Varga c47ab60cc4 [llvm] Emit target layout/target triple into bitcode files. (#13327)
Fixes https://github.com/mono/mono/issues/12307 for 2018-08.
2019-03-06 13:38:02 -05:00
monojenkins 7ad1871886 [2018-08] Clean up .o files from System.Native during make dist (#13256)
* Clean up .o files from System.Native during `make dist`

Closes: https://github.com/mono/mono/issues/11501

* Delete more useless binary cruft from `make dist`
2019-03-02 03:02:37 +01:00
Alexander Köplinger 56906e2376 Bump api-snapshot submodule
Gets in the API Diff change for https://github.com/mono/mono/commit/5dd1c19b53dd43ba55b6ea649dc3809b0ae4f057
2019-03-01 21:08:40 +01:00
Alexander Köplinger 6ed7152fc8 [sdks] Use throttle() instead of lock()
The former works in freestyle builds.

(cherry picked from commit 98e0f2697d)
2019-03-01 14:49:30 +01:00
Alexander Köplinger 68aad3b0eb [ci] Use dl.internalx.com when building on private Jenkins
(cherry picked from commit 9d4aa950aa)
2019-02-26 11:21:29 +01:00
Martin Baulig 5dd1c19b53 Make System.dll internals visible to Mono.Android. 2019-02-25 14:14:46 +01:00
Alexander Köplinger 29eb176dd9 Bump bockbuild for GTK fix
See https://github.com/mono/bockbuild/pull/84
2019-02-20 17:30:36 +01:00
Maxim Lipnin 45e519e9df use for loop to access item values and avoid InvalidCastException which occurs because VirtualDirectoryMappingCollection enumerator returns key and it's not expected 2019-02-19 23:12:00 +01:00
Alexander Kyte de14ec6c78 [2018-08] Add more detailed reporting for exceptions (#13012)
* [crash] Add more detailed reporting for exceptions

This bumps the crash reporting file format to version 0.0.3.

* [crash] Fix exception stack walker to consider captured_traces

Previously we were missing these frames from the captured_traces fields
of MonoException and MonoStackTrace.
2019-02-15 11:10:55 -05:00
Alexander Köplinger b041669258 [ci] Bump bockbuild to get fontconfig download url fix 2019-02-11 16:47:52 +01:00
monojenkins d2e33f5f5c [2018-08] [interp] Add method to seq_points table after we finish registering it (#12906)
* [interp] Add method to seq_points table after we finish registering it

When adding a breakpoint (mono_de_set_breakpoint) we search in this table for seq_point information for the method. If we find the information we expect that the method is already compiled and has the metadata initialized when actually adding the breakpoint (set_bp_in_method). We were crashing if the jinfo field of the interp method was not yet initialized.

Fixes https://github.com/xamarin/xamarin-macios/issues/5381

* [interp] Move profiler callback when we are actually done

Just in case.
2019-02-11 09:09:00 -05:00
monojenkins 32f1873983 [interp] Fix ldelema (#12930)
The ldelema IL instruction provided the element class while the Address intrinsic provided the array class.

Fixes https://github.com/xamarin/xamarin-macios/issues/5363
2019-02-11 09:08:13 -05:00
Alexander Köplinger bbf2394619 [ci] Support building the OSX .pkg on private Jenkins
(cherry picked from commit 7f5125179d)
2019-02-09 20:22:09 +01:00
monojenkins 98810acba1 [runtime] Fix building older runtimes with newer system Mono (#12574)
What was happening was that this was building with a Mono.Cecil from
the build profile, but was trying to load the system Mono.Cecil.

Those versions mismatch when building 2018-08 with a nightly mono that is 5.23.0.

Rather than messing with the MONO_PATH and risking shadowing something
important there, I chose to copy the Mono.Cecil files into this
"lib/build/tmp" directory that we are using for the emitted executable.
It is loaded by the system Mono as the correct Mono.Cecil to use.

This fixes the build.
2019-02-09 00:10:34 +01:00
monojenkins d946a25079 [2018-08] [runtime] Fix mono_pe_file_map logging (#12897)
Since it's being used when the image is created, it actually doesn't need to be signal safe. This restores the previous behavior. 

Backport of #12588.
2019-02-09 00:06:01 +01:00
Ludovic Henry 4d2b7f8b01 Merge pull request #12858 from monojenkins/backport-pr-12856-to-2018-08
[2018-08] [Registry] Prevent crash due to background thread facing problems in the file system
2019-02-08 15:44:49 -05:00
monojenkins 89fe6abeef [arm64] encode offset within stack slot for r4 in gsharedvt descriptor (#12885)
Follow up fix for https://github.com/mono/mono/pull/11741

Fixes https://github.com/mono/mono/issues/12831
2019-02-08 09:30:02 -05:00
Miguel de Icaza 9d21a2bb15 [Registry] Prevent crash due to background thread facing problems in the file system 2019-02-07 16:59:52 +00:00
Marek Safar 163f45d81c [corlib] Fix GetFrames_AsyncCalls test not to block 2019-02-05 17:45:58 +01:00
Maxim Lipnin 208d5a5f1b Avoid recursive extracting redundant frames from captured traces. 2019-02-04 13:41:24 +01:00
monojenkins bcc1b83e82 Add back missing stack frames to mono MERP reports (#12741)
Changeset https://github.com/mono/mono/commit/e1461ebc855977667f71d1804fd96eed2a155aff
introduced a regression where only the topmost frame of managed crashes are reported.

This change adds back the missing stack frames.
2019-02-01 19:59:48 -05:00
Bernhard Urban 7a3ce9849f Bump corert
Commit list for mono/corert:

* mono/corert@e229c9448 [Number] make double 0.0 cmp more portable (#30)

Diff: https://github.com/mono/corert/compare/6c9c4d9cffe2031acb788718646fbc013632c9ea...e229c9448cb262ceb230dfab64a8237140c1dc2d
2019-02-01 15:07:36 +01:00
Bernhard Urban 13204572a4 [arm/ios] workaround for faulty vcmp.f64 insn
Fixes https://github.com/mono/mono/issues/11965
2019-02-01 15:07:02 +01:00
Vlad Brezae 2359cba40e [coop] Fix deadlock when unwinding
At the moment of a safepoint, the runtime can be holding the loader lock. Fixes gsharing-valuetype-layout.exe timeouts.
2019-01-29 13:06:44 -05:00
Alexander Kyte a4956c837e [2018-08] Native Crash Stability Fix Batch (#12565)
* [crash] Support extra merp params

* [runtime] Make infrastructure for merp tests

* [runtime] Fix dumping when crash happens without sigctx

* [runtime] Disable crashy (886/1000 runs) stacktrace walker

* [crash] Remove usage of allocating build/os info functions

* [crash] Remove often-crashing g_free on native crash path

* [crash] Add crash_reporter checked build

We add a checked build mode that asserts when mono mallocs inside of
the crash reporter. It makes risky allocations into assertions. It's
useful for automated testing because the double-abort often represents
itself as an indefinite hang. If it happens before the thread dumping
supervisor process is started, or after it ends, the crash reporter
hangs.

* [crash] Remove reliance on nested SIGABRT/double-fault (broken on OSX)

* [crash] Fix top-level handling of double faults/assertions

* [runtime] Make fatal unwinding errors return into handled error paths

* [crash] Change dumper logging for better info

* [runtime] Fix handling of segfault on sgen thread

Threads without domains that get segfaults will end up in
this handler. It's not safe to call this function with a NULL domain.

See crash below:

```
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x10eff40f8)
  * frame #0: 0x000000010e1510d9 mono-sgen`mono_threads_summarize_execute(ctx=0x0000000000000000, out=0x0000001000000000, hashes=0x0000100000100000, silent=4096, mem="", provided_size=2199023296512) at threads.c:6414
    frame #1: 0x000000010e152092 mono-sgen`mono_threads_summarize(ctx=0x000000010effda00, out=0x000000010effdba0, hashes=0x000000010effdb90, silent=0, signal_handler_controller=1, mem=0x0000000000000000, provided_size=0) at threads.c:6508
    frame #2: 0x000000010df7c69f mono-sgen`dump_native_stacktrace(signal="SIGSEGV", ctx=0x000000010effef48) at mini-posix.c:1026
    frame #3: 0x000000010df7c37f mono-sgen`mono_dump_native_crash_info(signal="SIGSEGV", ctx=0x000000010effef48, info=0x000000010effeee0) at mini-posix.c:1147
    frame #4: 0x000000010de720a9 mono-sgen`mono_handle_native_crash(signal="SIGSEGV", ctx=0x000000010effef48, info=0x000000010effeee0) at mini-exceptions.c:3227
    frame #5: 0x000000010dd6ac0d mono-sgen`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x000000010effeee0, context=0x000000010effef48, debug_fault_addr=0xffffffffffffffff) at mini-runtime.c:3574
    frame #6: 0x000000010dd6a8d3 mono-sgen`mono_sigsegv_signal_handler(_dummy=11, _info=0x000000010effeee0, context=0x000000010effef48) at mini-runtime.c:3612
    frame #7: 0x00007fff73dbdf5a libsystem_platform.dylib`_sigtramp + 26
    frame #8: 0x0000000110bb81c1
    frame #9: 0x000000011085ffe1
    frame #10: 0x000000010dd6d4f3 mono-sgen`mono_jit_runtime_invoke(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, exc=0x00007ffee1ea9f08, error=0x00007ffee1eaa250) at mini-runtime.c:3215
    frame #11: 0x000000010e11509d mono-sgen`do_runtime_invoke(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, exc=0x0000000000000000, error=0x00007ffee1eaa250) at object.c:2977
    frame #12: 0x000000010e10d961 mono-sgen`mono_runtime_invoke_checked(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, error=0x00007ffee1eaa250) at object.c:3145
    frame #13: 0x000000010e11aa58 mono-sgen`do_exec_main_checked(method=0x00007faae4f01fe8, args=0x000000010f0003e8, error=0x00007ffee1eaa250) at object.c:5042
    frame #14: 0x000000010e118803 mono-sgen`mono_runtime_exec_main_checked(method=0x00007faae4f01fe8, args=0x000000010f0003e8, error=0x00007ffee1eaa250) at object.c:5138
    frame #15: 0x000000010e118856 mono-sgen`mono_runtime_run_main_checked(method=0x00007faae4f01fe8, argc=2, argv=0x00007ffee1eaa760, error=0x00007ffee1eaa250) at object.c:4599
    frame #16: 0x000000010de1db2f mono-sgen`mono_jit_exec_internal(domain=0x00007faae4f00860, assembly=0x00007faae4c02ab0, argc=2, argv=0x00007ffee1eaa760) at driver.c:1298
    frame #17: 0x000000010de1d95d mono-sgen`mono_jit_exec(domain=0x00007faae4f00860, assembly=0x00007faae4c02ab0, argc=2, argv=0x00007ffee1eaa760) at driver.c:1257
    frame #18: 0x000000010de2257f mono-sgen`main_thread_handler(user_data=0x00007ffee1eaa6a0) at driver.c:1375
    frame #19: 0x000000010de20852 mono-sgen`mono_main(argc=3, argv=0x00007ffee1eaa758) at driver.c:2551
    frame #20: 0x000000010dd56d7e mono-sgen`mono_main_with_options(argc=3, argv=0x00007ffee1eaa758) at main.c:50
    frame #21: 0x000000010dd5638d mono-sgen`main(argc=3, argv=0x00007ffee1eaa758) at main.c:406
    frame #22: 0x00007fff73aaf015 libdyld.dylib`start + 1
    frame #23: 0x00007fff73aaf015 libdyld.dylib`start + 1
  thread #2, name = 'SGen worker'
    frame #0: 0x000000010e2afd77 mono-sgen`mono_get_hazardous_pointer(pp=0x0000000000000178, hp=0x000000010ef87618, hazard_index=0) at hazard-pointer.c:208
    frame #1: 0x000000010e0b28e1 mono-sgen`mono_jit_info_table_find_internal(domain=0x0000000000000000, addr=0x00007fff73bffa16, try_aot=1, allow_trampolines=1) at jit-info.c:304
    frame #2: 0x000000010dd6aa5f mono-sgen`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x000070000fb81c58, context=0x000070000fb81cc0, debug_fault_addr=0x000000010e28fb20) at mini-runtime.c:3540
    frame #3: 0x000000010dd6a8d3 mono-sgen`mono_sigsegv_signal_handler(_dummy=11, _info=0x000070000fb81c58, context=0x000070000fb81cc0) at mini-runtime.c:3612
    frame #4: 0x00007fff73dbdf5a libsystem_platform.dylib`_sigtramp + 26
    frame #5: 0x00007fff73bffa17 libsystem_kernel.dylib`__psynch_cvwait + 11
    frame #6: 0x00007fff73dc8589 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #7: 0x000000010e28d76d mono-sgen`mono_os_cond_wait(cond=0x000000010e44c9d8, mutex=0x000000010e44c998) at mono-os-mutex.h:168
    frame #8: 0x000000010e28df4f mono-sgen`get_work(worker_index=0, work_context=0x000070000fb81ee0, do_idle=0x000070000fb81ed4, job=0x000070000fb81ec8) at sgen-thread-pool.c:165
    frame #9: 0x000000010e28d2cb mono-sgen`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196
    frame #10: 0x00007fff73dc7661 libsystem_pthread.dylib`_pthread_body + 340
    frame #11: 0x00007fff73dc750d libsystem_pthread.dylib`_pthread_start + 377
    frame #12: 0x00007fff73dc6bf9 libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'Finalizer'
    frame #0: 0x00007fff73bf6246 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x000000010e1d9c0a mono-sgen`mono_os_sem_wait(sem=0x000000010e43e400, flags=MONO_SEM_FLAGS_ALERTABLE) at mono-os-semaphore.h:84
    frame #2: 0x000000010e1d832d mono-sgen`mono_coop_sem_wait(sem=0x000000010e43e400, flags=MONO_SEM_FLAGS_ALERTABLE) at mono-coop-semaphore.h:41
    frame #3: 0x000000010e1da787 mono-sgen`finalizer_thread(unused=0x0000000000000000) at gc.c:920
    frame #4: 0x000000010e152919 mono-sgen`start_wrapper_internal(start_info=0x0000000000000000, stack_ptr=0x000070000fd85000) at threads.c:1178
    frame #5: 0x000000010e1525b6 mono-sgen`start_wrapper(data=0x00007faae4f31bd0) at threads.c:1238
    frame #6: 0x00007fff73dc7661 libsystem_pthread.dylib`_pthread_body + 340
    frame #7: 0x00007fff73dc750d libsystem_pthread.dylib`_pthread_start + 377
    frame #8: 0x00007fff73dc6bf9 libsystem_pthread.dylib`thread_start + 13
  thread #4
    frame #0: 0x00007fff73c0028a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff73dc7009 libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff73dc6be9 libsystem_pthread.dylib`start_wqthread + 13
(lldb)
```

* [crash] Add signal-safe mmap/file "allocator"

* [crash] Remove use of static memory from dumper

* [runtime] Reduce print buffer size for lockless printer.

Each frame that prints ends up increased by the size of buff.
In practice, clang often fails to deduplicate some of these buffers,
leading to 30k-big stackframes.

It was noticed by a series of hard-to-diagnose segfaults on stacks that
looked otherwise fine during the crash reporting stress test.

This change fixes this, making stacks a 1/10th of the size. It doesn't
seem to break the crash reporter messages anywhere (may need to shrink
other "max name length" fields), and it's not mission-critical anywhere
else.

* [crash] Use async-safe file memory for dumper internals

* [crash] Add memory barriers around merp configuration

* [crash] Use signal-safe printers on all native crash paths

* [crash] Move gdb/lldb lookup to startup

* [runtime] Move MOSTLY_ASYNC_SAFE_FPRINTF to eglib

* [runtime] Fix all callsites of MOSTLY_ASYNC_SAFE_PRINTF

* [runtime] Fix all callsites of MOSTLY_ASYNC_SAFE_FPRINTF

* [crash] Switch to signal-safe exit function

* [crash] Make dumper enum in managed

* [runtime] Add more information to managed frame

* [crash] Make async_safe printers inlined

* [runtime] Move basic pe_file functionality into proclib

* [crash] Fix handling of thread attributes

* [crash] Place hashes into the json file for all threads

* [crash] Fix 2018-08 CI, disable test
2019-01-25 14:17:41 +01:00
Martin Baulig d4d4fb7987 [eglib]Fix memory leak in g_find_program_in_path(). #11615. 2019-01-24 20:01:44 +01:00
Martin Baulig 9939c1a656 [System]Fix race condition in SystemDependencyProvider.Initialize(). #12538. 2019-01-22 09:48:25 +01:00
Alexander Kyte b0c4390d60 [runtime] Don't probe aot cache on android 2019-01-18 08:42:13 +01:00
Kirill Osenkov 725ba2a252 Fix https://github.com/mono/mono/issues/12461.
After .NET 4.5 .NET Framework has changed the System.ComponentModel.Composition ReflectionModelServices.IsExportFactoryImportDefinition to not throw.

Updating this to match the .NET Framework behavior.
2019-01-17 16:14:09 +01:00
Marek Habersack 1dee62626d [2018-08 Android,AOT] Support dumping AOT offsets with Android NDK r17+ (#12454) (#12465)
Backport of: https://github.com/mono/mono/commit/eebe4b52857140ba9dea872c6249960273d222f2 from https://github.com/mono/mono/pull/12454

The latest Android NDK releases no longer ship with per-platform C headers.
Instead they ship with a set of unified headers and require the presence of the
`__ANDROID_API__` macro in order to select the target platform.
The AOT offset dumper doesn't support this new layout and this commit changes
that by adding support for the unified headers (without removing support for the
older NDKs) thus fixing the following error when trying to dump the offsets with
newer NDK:

    Processing triple: aarch64-v8a-linux-android
    Error parsing '[...]/mono/mono/metadata/metadata-cross-helpers.c'
    [...]/mono/mono/metadata/metadata-cross-helpers.c(5,10): fatal: 'stdio.h' file not found
    Error parsing '[...]/mono/mono/mini/mini-cross-helpers.c'
    [...]/mono/mono/mini/mini-cross-helpers.c(7,10): fatal: 'stdio.h' file not found
2019-01-17 13:32:43 +01:00
Zoltan Varga 146c8191fb [x86] Set the LLVM data layout. 2019-01-16 13:03:07 +01:00
Zoltan Varga 5d3077c7bc [arm] Set the LLVM data layout, without it, opt seems to make incorrect optimizations.
Fixes https://github.com/mono/mono/issues/12307.
2019-01-16 13:03:07 +01:00
Thays Grazia 5266e6a8f1 [2018-08][debugger][backport] Fix crash when there is a generic struct with a field that is an enumerator (#12410)
* [Debugger] Fix crash when there is a generic struct with a field that is an enumerator. (#12368)

* [Debugger]  Debugger crashes when inside a class, there is an internal struct, with a field that is an enumerator.
files.myBucket.GetEnumerator().get_Current().Key
Fixes #10735

* [Debugger] Debugger crashes when there is a generic struct with a field that is an enumerator.
Example: files.get_Current().Key
A unit test that reproduces this crash was added too.
Fixes #10735

* Removing the extra space.

* Merging changes from dtest-app.cs

* Adding extra line.
2019-01-15 18:23:01 +01:00
monojenkins 0d988bc696 Bump API snapshot submodule 2019-01-14 18:21:36 +01:00
Maxim Lipnin e6285d015b Bump corefx 2019-01-14 18:21:36 +01:00
Alexander Kyte 51c4f45402 [2018-08] [merp] Batch of fixes (#12095)
This contains the fixes and tests I'm going to call "service pack 1" for ease of grouping

#11884
#11855
#11636
#11909
#12036
2019-01-11 12:08:37 +01:00
Bernhard Urban 3bf37058fd [interp] use interp_lmf wrapper for interp2native on platforms with wonky sigcontext (#12348)
On some platforms (e.g. AppleTV) SigContext is available, but isn't as
precise as we would like to have it. For example, it doesn't save
callee-saved registers and thus aren't restored properly.

Unfortunately, this also means we can't use the fastpath for
interp2native, so we disable it on those platforms.
2019-01-11 11:40:21 +01:00
Marek Safar 25a8be9111 Bump CoreFX to bring a fix for #12093 2019-01-10 14:55:46 +01:00
Marek Habersack 29e0e642da [Android] Fix build with NDK r18 (#11016) (#12291)
Xamarin.Android is looking to switch to using the latest Android NDK, r18.
However, there are a few build issues in Mono and BTLS which need to be
addressed before that happens.

  * BTLS fails to build some ARM assembly sources with NDK r18's clang.
    https://github.com/mono/boringssl/pull/12 fixes this issue

  * BTLS uses obsolete Android cmake toolchain file.
    Add a configure option to set alternative toolchain file.

  * NDK r18 minimu supported API level is 16.
    This commit makes the API level configurable and sets the minimum platform
    to API 16

  * NDK r18 makes changes to declaration of `mmap` which break Mono build.
    Detect NDK version in `mono-compiler.h` and act accordingly (do not
    redeclare `mmap`)

  * NDK r18 doesn't have `cpp` and SDKs build assumes it's present.
    Detect whether `cpp` is present and, if not, use `compiler -E` instead.

  * NDK r18 uses unified headers exclusively and requires __ANDROID_API__ to be
    set in order to present the correct set of native APIs.
    SDKs now define the macro when the `ANDROID_NEW_NDK` Make variable is set to
    anything else than `no`.
2019-01-07 14:31:07 +01:00
Alexis Christoforides 7b44d5719e [tests] Remove an invalid assertion on System.IO.DriveInfo
All fixed drives are not guaranteed to be ready
2019-01-07 08:22:51 -05:00
Egor Bogatov 3fad9a7a1c Update DateTimeTest.cs 2019-01-07 10:19:42 +01:00
Egor Bogatov 6b6fd890ee Update mono/metadata/culture-info-tables.h 2019-01-07 10:19:42 +01:00
EgorBo 8f50f96e8f Add tests 2019-01-07 10:19:42 +01:00
EgorBo 1edf795ae0 ko-* specific AM/PM designators 2019-01-07 10:19:42 +01:00
monojenkins 9671417e21 [2018-08] [Network] Fix CVE 2018-8292 on Mac OS X. (#12153)
* [Network] Fix CVE 2018-8292 on Mac OS X.

This commit ensures that CVE 2018-8292 is fixed by not setting
auto-redirect in the first request done by CFNetwork. CFNetwork has the
same bug, but we can work around it by performing the first request,
checking the response and, if it is a rediret, follow it without the
Authorization headers.

* No need to close the obc, it can be reused.

* Small typo.

* Fix error while chaging the request :/

* Minor style changes.
2019-01-03 15:41:54 +01:00
Zoltan Varga 047d0abd5c [llvm] Add support for OP_RCNEQ.
Fixes https://github.com/mono/mono/issues/12131.
2018-12-22 11:31:39 +01:00
Cody Russell 237c5fedc7 [2018-08] [GTK] Bump bockbuild for VSTS #737323 fix to GtkNSView. (#12164)
* [GTK] Bump bockbuild for VSTS #737323 fix to GtkNSView.

This is a 2018-08 backport of #11972
2018-12-21 16:27:00 +01:00
Ankit Jain bac9fc1f88 [2018-08] Bump msbuild to track xplat-master (#12115)
Backport of #12071.
2018-12-21 15:05:23 +01:00
monojenkins 88eafb72e4 [2018-08] Bump to latest SQLite for Mac bundle (#12159)
Bump Mac bundle from SQLite 3.9.2 to 3.26.0

Backport of #12118.
2018-12-20 16:11:23 +01:00
monojenkins 3f799cc3c7 [exceptions] Verbose logging for cfa_reg assertion (#11916)
[2018-08] [exceptions] Verbose logging for cfa_reg assertion

Historically very common and hard to reproduce assertion, which, in some cases, could be fixed just from this logging. Log example :

```
Unset cfa_reg in method <0x40011220 - (null) trampoline>. Memory around ip (0x40011220):
0x40011210  41 89 07 4c 8b 3c 24 48 83 c4 08 c3 00 00 00 00  A..L.<$H........
0x40011220  48 83 c7 10 b8 00 12 01 40 ff e0 00 00 00 00 00  H.......@.......
0x40011230  00 00 00 00 e8 c7 ef fe ff 08 f8 34 e0 55 55 55  ...........4.UUU
0x40011240  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
* Assertion: should not be reached at unwind.c:664
```




Backport of #11888.

/cc @BrzVlad
2018-12-19 20:45:40 -05:00
Zoltan Varga 0d9e781cb6 [jit] Fix a buffer overflow in mini_get_gsharedvt_out_sig_wrapper_signature ().
Fixes https://github.com/mono/mono/issues/12130.
2018-12-19 21:53:18 +01:00
Maxim Lipnin 35a1ed626d Fix IndexOutOfRangeException in MethodInfo.ReturnParameter.IsDefined(type) 2018-12-19 21:47:27 +01:00
Ankit Jain 03b9354ed9 [MacSDK] Bump NuGet to 4.8.1 2018-12-19 14:02:20 +01:00
monojenkins f919fb58c4 Fix https://github.com/mono/mono/issues/11898 (#11904)
There are two identical sounding functions:

mono_string_handle_to_utf8:
  What we usually use. Sounds reasonable. Usually is reasonable.
  Allocates with malloc.

mono_string_to_utf8str_handle:
  What should be used here. Allocates with CoTaskMemAlloc.
  So it can be freed with marshal_free => CoTaskMemFree.

i.e. The allocator and the freeer need to agree.
2018-12-03 19:39:56 -05:00
monojenkins 95fbc22436 Fix race condition in XmlCharType.Instance (#11828) 2018-12-03 19:19:31 -05:00
Zoltan Varga bcda004855 [aot] Emit runtime invoke wrappers for up to 40 parameters for bitcode, newly added tests depend on it.
Fixes https://github.com/mono/mono/issues/11874.
2018-12-03 14:50:04 +01:00
monojenkins f0e466618d [crash] Add managed exception class name (#11821) 2018-11-30 13:28:10 -08:00
Egor Bogatov 23f2024af8 [2018-08] Fix Encoding serialization issue (#11807)
Manual backport of https://github.com/mono/mono/pull/11661
2018-11-28 13:21:17 +01:00
Bernhard Urban 414cafac93 [interp] Don't include internal frames in stack trace (#11793)
For handled exceptions. On unhandled exceptions we leave them for debugging purposes.

Fixes exception18.cs
2018-11-27 14:33:07 -08:00
Alexander Köplinger 68746a81f2 [ci] Disable log compression in pipeline builds for now - second attempt
(cherry picked from commit 94d4055773)
2018-11-26 22:05:59 +01:00
monojenkins 1f62222fa6 [mini] use AOT trampolines in interp mixed mode (#11781)
[2018-08] [mini] use AOT trampolines in interp mixed mode

Fixes this on mscorlib/mixed mode on Xamarin.iOS:
```
[FAIL] NonExceptional.Serialization_Deserialization : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] NonExceptional.Serialize_Deserialize_FixedDateRule : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] NonExceptional.Serialize_Deserialize_FloatingDateRule : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] SerializationTests.Serialization_Deserialization : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] TimeZoneTest.CurrentTimeZone_SerializationRoundtrip : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
```


Backport of #11767.

/cc @lewurm
2018-11-26 13:55:55 -05:00
Alexander Köplinger d0184b6970 [ci] Disable log compression in pipeline builds for now
It is incompatible with JEP-210 at the moment.

(cherry picked from commit fb4b611636)
2018-11-26 17:49:44 +01:00
Aleksey Kliger a4c0912ecf [loader] ignore 'internalcall' impl attribute on 'abstract' methods
Otherwise we emit a noisy warning when doing a lookup of the method.

Fixes https://github.com/mono/mono/issues/11479
2018-11-26 10:38:22 -05:00
Zoltan Varga 7b9d9b3f1b [arm64] Fix passing r4/r8 arguments on the stack in the gsharedvt trampoline.
Fixes https://github.com/mono/mono/issues/11613.
2018-11-20 12:00:04 +01:00
Alexander Köplinger e3a4484af7 [2018-08] Add .NET 4.7.2 reference assemblies (#11733)
Backport of https://github.com/mono/mono/pull/11391 to 2018-08
2018-11-19 16:58:34 +01:00
monojenkins 99b6da7944 [interp] attempt to intrinsify again after a method is resolved regarding generics (#11717)
[2018-08] [interp] attempt to intrinsify again after a method is resolved regarding generics

discovered when running https://github.com/Clancey/gMusic



Backport of #11712.

/cc @luhenry @lewurm
2018-11-16 14:05:43 -05:00
monojenkins 2f57669e30 [2018-08] [aot] image is usable without debug flag when interpreter is used (#11709)
Backport of #11705.
2018-11-16 12:10:05 +01:00
monojenkins 0206338c1e [2018-08] [crash] Remove duplicated il_offset (#11702)
This code is duplicated completely from the code directly above it (github doesn't show in this diff)

Backport of #11700.
2018-11-15 23:23:30 +01:00
monojenkins b20dad6656 [runtime] Fix the size calculation in mono_debug_add_method (). (#11687)
Backport of #11672.
2018-11-15 16:11:52 +01:00
Bernhard Urban 0f81533ae3 [arm64] Pass small stack args correctly on linux. Fixes pinvoke.exe with llvm+full aot. (#11682)
Backport of #10674. LLVM is already properly bumped on this branch.
2018-11-15 16:09:09 +01:00
monojenkins 81f3c4763e [2018-08] Fix starting process with empty environment incorrectly inherits all variables (#11645)
This pull request fixes starting a process with an empty environment variable collection in `ProcessStartInfo`. As per the issue it fixes a regression that it used to work but currently an empty environment variable collection works like it was never touched.

I also made a minor fix to remove the `StringBuilder` because a simple `string.Concat` does the job without the `StringBuilder` allocation and overhead.

I've included unit tests. Please let me know if you'd like any changes.

Fixes #8766

Backport of #11630.
2018-11-15 16:05:33 +01:00
Alexander Köplinger 6a9ee132c1 [ci] Clean acceptance-tests/external before build
Otherwise it might have left-over files from previous builds since it
uses our custom submodule system which isn't catched by Jenkins cleaning.

(cherry picked from commit 49a5af74f7)
(cherry picked from commit b429e290e8)
2018-11-15 16:03:56 +01:00
monojenkins b8ebc791fc [ios] cosmetic fix for WatchOS Makefile (#11668)
It's not really used, and the directory `[...]/SDKs/WatchOS.sdk` always
exists.
2018-11-14 16:42:06 -05:00
Bernhard Urban 32d4b6f22a [llvm] bump for armhf callingconv fix (#11609)
Commit list for mono/llvm:

* mono/llvm@c97510286a [mono] respect hardfloat/softloat setting in ARM ABI (#16)
@ mono/llvm@8415fd85ce Fix the mono calling convention on arm64+linux.
@ mono/llvm@117a508c0c Merge pull request #15 from mono/android-eh
@ mono/llvm@7dd82303e5 Emit .fnstart/.fnend directives on arm ELF platforms in the mono EH writer since the ARM backends depends on ARMException doing it, and ARMException is not ran when --disable-gnu-eh-frame is given.

Diff: https://github.com/mono/llvm/compare/81376d161cb6c2230834b2dc096ccbdae8d93020...c97510286a58f9aaa116fcfdb8b693d5f61910d2


Backport of https://github.com/mono/mono/pull/11607
2018-11-08 13:38:01 -05:00
monojenkins 925e0c0d0c [ios] remove DISABLE_POLICY_EVIDENCE (#11581)
[2018-08] [ios] remove DISABLE_POLICY_EVIDENCE

Originally it was introduced with db3591b
It seems like only the icall definitions were disabled for device
runtimes (which aren't shipped there anyway), however the icalls
themselves are _included_ in the device runtime. Not sure what the
rationale was behind this. Since the original change is very old, I
think it just happened to be like that today.  When running with the
interpreter we need the definitions at runtime too (via the optional
icall table that is linked in, so no additional cost for the fullAOT
runtime due to this change).

Backport of https://github.com/mono/mono/pull/11565

/cc @lewurm
2018-11-06 19:55:30 -05:00
Alex Earl 65cd16c227 Bump roslyn-binaries submodule to pull in System.Xml.dll file name fix in vbc.rsp (#11573)
(cherry picked from commit 5d5d8fc7ea)
2018-11-06 21:42:36 +01:00
Alexander Köplinger b5891e25ac [ci] Fix Windows .msi build
(cherry picked from commit c8d59d1d1d)
2018-11-06 10:41:13 +01:00
monojenkins d4d1d1ec24 [bcl] avoid false pinning in GCTest (#11536)
[2018-08] [bcl] avoid false pinning in GCTest

Backport of #11521.

/cc @luhenry @lewurm

Description:
needed for mscorlibtests on Xamarin.iOS with interpreter
2018-11-05 21:45:33 -05:00
monojenkins 3837f0c276 [interp] accept typed-by-ref as return type from a JIT call (#11533) 2018-11-05 21:01:12 -05:00
monojenkins 2e5c0d8f1e [interp] transform delegate invoke in method body too (#11551) 2018-11-05 20:58:29 -05:00
Alexander Köplinger 60c21beaeb [ci] Switch to new syntax of Azure Storage plugin
(cherry picked from commit de2cb5fdde)
2018-11-05 18:20:31 +01:00
Martin Baulig 3c2b25ce23 [System]lock protect SystemCertificateProvider.EnsureInitialized(). 2018-11-01 23:05:27 +01:00
Bernhard Urban 5fedefe43e [tests] reduce recursion depth
so it doesn't trigger a stack overflow on Xamarin.iOS with interpreter on a debug build (`CFLAGS=-O0`).
2018-10-31 11:56:58 +01:00
Alexander Kyte 53a21a0e84 [crash] Fix async setting for crash reporter
We were previously only setting it from the icall. The icall was
therefore fine, while invocations associated with actual dumps
caused crashes like this:

```

thread #10, name = 'Thread Pool Worker'
    frame #0: 0x00007fff978dac22 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x00007fff979c5dfa libsystem_pthread.dylib`_pthread_mutex_lock_wait + 100
    frame #2: 0x00007fff979c3519 libsystem_pthread.dylib`_pthread_mutex_lock_slow + 285
    frame #3: 0x0000000108e0d4a9 mono`mono_loader_lock + 73
    frame #4: 0x0000000108dc9106 mono`mono_class_create_from_typedef + 182
    frame #5: 0x0000000108dc1f2c mono`mono_class_get_checked + 92
    frame #6: 0x0000000108e21da2 mono`mono_metadata_parse_type_internal + 1378
    frame #7: 0x0000000108e25e11 mono`mono_metadata_parse_mh_full + 1233
    frame #8: 0x0000000108ca4f79 mono`mono_debug_add_aot_method + 121
    frame #9: 0x0000000108cc6b1e mono`decode_exception_debug_info + 5918
    frame #10: 0x0000000108cc5047 mono`mono_aot_find_jit_info + 1367
    frame #11: 0x0000000108e082cc mono`mono_jit_info_table_find_internal + 204
    frame #12: 0x0000000108cdb035 mono`mini_jit_info_table_find_ext + 69
    frame #13: 0x0000000108cdad5c mono`mono_find_jit_info_ext + 124
    frame #14: 0x0000000108cdc3a5 mono`unwinder_unwind_frame + 229
    frame #15: 0x0000000108cdbade mono`mono_walk_stack_full + 798
    frame #16: 0x0000000108cda1a4 mono`mono_summarize_managed_stack + 100
    frame #17: 0x0000000108e6dc03 mono`mono_threads_summarize_execute + 1347
    frame #18: 0x0000000108e6df88 mono`mono_threads_summarize + 360

```
2018-10-31 08:30:16 +01:00
monojenkins 04bdf8852b [2018-08] [crash] Fix merp invocation (#11468)
Backport of #11435.

/cc @alexanderkyte 

Description:
The change which made the handler return (rather than crashing the
runtime) did not consider this control flow path that causes the sigterm
signal handler to trigger the merp dumper if we return.

We now always return.

This was previously so that a random sigterm could be used to trigger a
dump. This isn't really used, and won't work right now anyways
(we don't register it until right before we dump). My fix is to remove
it, and to make the signal handler only work as part of the dumper
machinery.

@monojenkins skip
2018-10-30 22:53:24 +01:00
monojenkins 8df60a29bf [delegates] do not use CEE_CALLVIRT for non-virtual methods (#11451)
[2018-08] [delegates] do not use CEE_CALLVIRT for non-virtual methods

Backport of #11433.

/cc @lewurm 

Description:
2018-10-30 12:45:19 -04:00
monojenkins d90fbe3a0a [llvm] Fix passing vtypes received by value as arguments, they need to be copied. Fixes https://github.com/mono/mono/issues/11378. (#11429) 2018-10-30 11:13:29 -04:00
Aleksey Kliger ea740d2bc8 Disable hybrid suspend default for 2018-08
Earlier in the 2018-08 branch, Mono on desktop Linux, OSX and Windows would
default to hybrid suspend.  Turn that off for now (revert to preemptive suspend
by default).

Continue hybrid suspend work on 2018-10 and master.
2018-10-30 10:09:47 +01:00
monojenkins 0522076f0b [interp] throw overflow exception when {float,double}.NaN is converted to an int type (#11411)
A comparison with NaN is always `false`.
2018-10-28 18:05:05 -04:00
monojenkins 6034c589df [interp] enable more BCL tests (#11399)
[2018-08] [interp] enable more BCL tests

Backport of #11381.

/cc @lewurm 

Description:
probably won't pass on all configurations, I wanna find out on which.
2018-10-26 17:55:10 -04:00
Marek Habersack aebff6ce01 [SDKS, LLVM] Disable detection and use of libxml2 (#11340)
Mono doesn't use libxml2 and neither do the LLVM bits used by Mono when building
the AOT cross-compilers. Presence of `-lxml2` on the command line breaks 32-bit
builds on 64-bit Linux hosts:

    libtool: link: cc -shared  -fPIC -DPIC  -Wl,--whole-archive ./.libs/libmini.a ./.libs/libmono-ee-interp.a ./.libs/libmono-dbg.a ../../mono/metadata/.libs/libmonoruntimesgen.a ../../mono/sgen/.libs/libmonosgen.a ../../mono/utils/.libs/libmonoutils.a ../../mono/eglib/.libs/libeglib.a -Wl,--no-whole-archive  -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -L$HOME/xamarin-android/external/mono/sdks/out/llvm-llvm32/lib -lz -ltinfo -lxml2 -lstdc++ -lm -lrt -ldl -lpthread  -O0 -ggdb3 -m32 -g -mno-tls-direct-seg-refs -Wl,-export-dynamic   -Wl,-soname -Wl,libmonosgen-2.0.so.1 -o .libs/libmonosgen-2.0.so.1.0.0
    mv -f .deps/libmini_la-aot-runtime-wasm.Tpo .deps/libmini_la-aot-runtime-wasm.Plo
    /usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libxml2.so when searching for -lxml2
    /usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libxml2.a when searching for -lxml2
    /usr/bin/ld: cannot find -lxml2
    collect2: error: ld returned 1 exit status
    make[7]: *** [Makefile:1495: libmonosgen-2.0.la] Error 1

Installation of `libxml2-dev` (on Ubuntu/Debian + friends) for the x86
architecture (or x86_64 architecture on 32-bit host) would be possible but then
it would break the 64-bit build because the 64-bit version of the library would
be absent. It would be a problem if Mono+LLVM actually used xml2, but since it
doesn't we can just disable the feature completely.

(cherry picked from commit 0d68ffd1ce)
2018-10-26 00:00:12 +02:00
Bernhard Urban 818a27a386 [2018-08] [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode (#11363)
[2018-08] [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode

Backport of https://github.com/mono/mono/pull/11321
2018-10-25 16:35:25 -04:00
Marek Safar b5e8de9182 [2018-08][corlib] Adds back accidentaly removed legacy COM API to Binder (#11368)
* [corlib] Adds back accidentaly removed legacy COM API to Binder

* Bump API snapshot submodule

* [csproj] Update project files
2018-10-25 15:03:49 +02:00
monojenkins 205b8129d5 [tests] lower recursion depth of PerformNoPinAction (#11323)
[2018-08] [tests] lower recursion depth of PerformNoPinAction

Backport of #11065.

/cc @lewurm 

Description:
so it doesn't overflow the stack when running on macOS with `clang -O0`.
2018-10-24 05:55:33 -04:00
Jay Krell c2c764dfc6 [2018-08] Replace mono_object_get_class with mono_object_class to avoid gc transitions. (#11338)
Replacement for #11104.
Backport of #11077.
2018-10-24 03:56:57 -04:00
Aleksey Kliger (λgeek) b778499454 [wasm] Add missing include (#11337)
Fixup for
https://github.com/mono/mono/commit/5756ba4b46f43d4f1c61c0d7dbbcf27a271f24ab
2018-10-24 02:11:20 -04:00
Marek Safar b7ad1c6923 Bump corefx 2018-10-23 20:34:45 +02:00
Aleksey Kliger (λgeek) 7a7768ff51 [marshal] Fixup missed mono_class_is_assignable_from (#11313)
Backport PR https://github.com/mono/mono/pull/11106 missed a call
2018-10-22 23:44:31 +02:00
Jay Krell fb7328e644 mono_class_is_assignable_from to mono_class_is_assignable_from_internal to skip GC mode machinery FIXME mono_class_is_assignable_from_checked 2018-10-22 18:29:03 +02:00
Jay Krell d88635a373 mono_class_enum_basetype to mono_class_enum_basetype_internal to skip GC mode machinery. 2018-10-22 18:28:07 +02:00
Aleksey Kliger (λgeek) 465b71e99d [runtime] Don't init classes in ves_icall_RuntimeTypeHandle_is_subclass_of
We must not get a TLE if referenced types are in an assembly that can't be
loaded.

Backported fix of https://github.com/mono/mono/issues/11123
2018-10-22 18:25:32 +02:00
Aleksey Kliger (λgeek) 5756ba4b46 [2018-08][marshal] Emit GC Safe transitions around foreign internal calls. (#11180)
* [threads] Make mono_add_internal_call external only

The runtime should use mono_add_internal_call_internal or
mono_add_internal_call_with_flags.

The thread suspend mechanism needs to know if an icall is added via the legacy
mono_add_internal_call API (which is not coop-aware, and so the registered
icalls must run in GC Safe mode), or if it is added by the runtime or by a
cooperative client (currently either the profiler or the System.Native PAL)
which knows to add GC transitions and safepoints and not to block indefinitely.

* [marshal] Factor out GCSafeTransitionBuilder

Make a local builder for creating the GC Safe transition calls for a method wraper.

* [sgen] Add coop GC transitions in mono_gc_toggleref_add

Also mark it external only. It's not used inside the runtime.

* [marshal] Emit GC Safe transitions around foreign icalls.

A foreign icall is added using mono_add_internal_call and that is not coop GC
aware.  (The runtime uses mono_add_internal_call_with_flags or
mono_add_internal_call_internal)

Under hybrid suspend, foreign icalls will run in GC Safe mode and transition to
GC Unsafe only when the call back into the runtime or invoke managed code.

Fixes https://github.com/mono/mono/issues/11138

* [runtime] Add new API call mono_dangerous_add_raw_internal_call

Under hybrid suspend, this adds an icall that is assumed to run in GC Unsafe
mode.  As such it has additional requirements for correct operation: it must
not run loops without periodically polling the runtime, and it must not perform
blocking operations such as blocking I/O or taking locks without manually
switching to GC Safe mode.
2018-10-22 18:17:50 +02:00
monojenkins d7dcd456b3 [interp] use unsigned conversion for nuint (#11284)
[2018-08] [interp] use unsigned conversion for nuint

Backport of #11259.

/cc @lewurm 

Description:
Fixes `MutableDataTest.Constructor` on Xamarin.iOS with interpreter.

monotouch tests are looking good now with interp-only:
<img width="906" alt="screenshot 2018-10-19 at 11 22 07" src="https://user-images.githubusercontent.com/75403/47209686-3d7b2780-d391-11e8-887f-9e1f39de2026.png">
😬
2018-10-21 08:25:34 -04:00
monojenkins 145155d8cf [aot] Reenable recursion checking when initing shared got entries (#11296)
[2018-08] [aot] Reenable recursion checking when initing shared got entries

Backport of #11258.

/cc @BrzVlad 

Description:
Broken in https://github.com/mono/mono/pull/11190
<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-10-20 20:35:28 -04:00
Marek Safar 423928c21d Bump mcs boostrap version 2018-10-20 09:25:17 +01:00
monojenkins b83fc43c32 [2018-08] [arm64] Remove the limitation on the number of nullable arguments for dyncalls. (#11241)
* [arm64] Remove the limitation on the number of nullable arguments for dyncalls.

Fixes https://github.com/xamarin/xamarin-macios/issues/4984.

* [amd64] Remove the limitation on the number of nullable arguments for dyncalls.

* [jit] Add tests for dyncalls with lots of nullable arguments.

* fix merge conflict
2018-10-19 23:49:49 +02:00
Ludovic Henry 9bc88897b7 [corlib] Make sure necessary resources are alongside the test assembly (#11270) 2018-10-19 15:38:58 -04:00
monojenkins 74788c7505 [2018-08] [llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm. (#11264)
* [llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm.

* [llvm] Fix a crash when trying to pass a vtype of size 0 on arm64. Fixes generic-constrained.2.exe.
2018-10-19 18:25:18 +02:00
Alexander Köplinger a4b6322c4f [2018-08] Bump corefx 2018-10-19 18:21:52 +02:00
monojenkins 934cf3c65a [WinForms] Propagate the flags from DrawTextInternal to MeasureTextInternal (#11261)
Flags to DrawText never reached MeasureText therefore strings with '&' were measured incorrect when drawn with flag TextFormatFlags.NoPrefix.
Fixes #6352
2018-10-19 18:08:51 +02:00
Ludovic Henry bc9d709e70 [sdks] Package what's missing for XA (#11256)
They require the additional files:
 - mono/eglib/eglib-config.h: that's to build `libmonodroid`
 - mcs/build/Consts.cs: that's to build `Mono.Posix` and `Mono.Data.Sqlite`
2018-10-19 06:57:56 -04:00
monojenkins 31a6b877f6 [pipeline] Ensure only 1 build per-product is executed per-node (#11249) 2018-10-18 22:09:45 +02:00
Vlad Brezae 4b343e98f3 [interp] Implement interpreter entry trampolines on amd64 (#10978) (#11164)
* [interp] Avoid unnecessary allocations when pinvoke void functions

* [amd64] Refactor interp pinvoke context computation

* [amd64] Interp trampoline for interpreter entry

* [aot] Don't include interp_in_wrapper when we use entry trampoline

These wrappers take a lot of space in the image.
2018-10-18 15:55:01 -04:00
monojenkins 2bc1ed09a3 [aot] Ensure shared got entries are initialized before loading methods (#11226)
Executing aot code that uses them would crash. Fixes random csc crashes.
2018-10-18 15:48:32 -04:00
Alexander Kyte 010e741bac [2018-08] Crash Reporter V2 (#11161)
* [runtime] Add icall to format crashes to disk in uniform way

* [crash] More gentle error handling around stack walking

* [crash] Make self-summarizier not need managed thread state

* [crash] Remove reliance on sgen/gchandles

* [crash] Refactor dumper mechanism

* [crash] Make threads not die during thread dump

* [crash] Add support for registering/dumping native libraries

* [crash] Add silent option to dumper

* [crash] Print error when unable to dump thread

* [crash] Add icalls to directly trigger telemetry-style walks

* [crash] Increase maximum frame depth

* [crash] Add managed method names when privacy disabled

* [crash] Add tests for concurrent dumping

* [crash] Add support for concurrent global dump requests

* [crash] Switch from CAS+Sleep to semaphore for dumper

Locks and GC-Safe regions are both unsafe in a signal handler
context. CAS primitives and the sleep syscall was used before.
Semaphores appear to be safe, enabling the following cleanup.

* [runtime] Make find_method use stack memory for dumper-facing entry point

* [crash] Enable install_state_summarizer on all platforms

* [crash] Dump managed stacks from controlling thread

* [crash] Don't use allocating method name formatter

* [crash] Copy safer strings with crash privacy disabled

* [crash] Fix string races with DumpTotal icall

* [crash] Fix space in crash file name

* [crash] Fix lifetime and size checks on mono-state memory

* [crash] Fix icall declarations for new style

* [runtime] Make sequence point lookup lockless

* [crash] Fix managed exception dumper icall format

* [crash] Print half-completed dump when space runs out

* [crash] Bump static memory for crash string to 500k

Note:
- This memory isn't accessed until we're crashing
- On any modern machine, unused static memory is lazily allocated. When
we access it, the fault will trigger the MMU to map memory for us.
- This is guaranteed to be reentrant and safe. mmap (the alternative) is
surely fairly stable on many systems, but this is not guaranteed. The
documentation pages for mmap specifically claim it as not safe in these async
contexts.

* [crash] Make whitelist lookup lockless

* [crash] Split unmanaged ptrs into method ip + offset
2018-10-18 20:23:40 +02:00
Alexis Christoforides ec1a736266 [corlib] Ensure that Console Streams are thread-safe
The Console class wraps the standard system stream reader/writers on construction so as to expose them as thread-safe. However, the Set-Out/In/Err methods in referencesource do not do the same when they replace default targets.

CoreFX code does: https://github.com/mono/corefx/blob/1748f6492e8b96842f76e1a9e7b5d7e8ccfca480/src/System.Console/src/System/Console.cs\#L412-L444

Possible fix for https://github.com/mono/mono/issues/11146
2018-10-18 10:58:03 -04:00
EgorBo a9b1acbee1 bump corefx 2018-10-18 10:53:26 -04:00
EgorBo 81326b8896 [2018-08] bump mono 2018-10-18 10:53:26 -04:00
Alexander Köplinger 04bde6eb75 [ci] Move OSX .pkg build to a separate bot pool
Allows us to better utilize the bockbuild cache.

(cherry picked from commit 229a4673d4)
2018-10-18 16:43:17 +02:00
monojenkins 2653d3eeda [pkg] Add preinstall which removes existing Mono of the same version (#11208)
Fixes https://github.com/mono/mono/issues/11202
2018-10-17 22:38:24 +02:00
Martin Baulig 47e556d4cf [2018-08][System]: Reenable native Apple Certificate support on WatchOS. (#11173) (#11199)
* [System]: Reenable native Apple Certificate support on WatchOS. (#11173)

During the code refactoring this summer, support for native apple certificates
has been dropped on watchOS.

* add `apple-certificates.sources` and move all certificate-related code from
  `appletls.sources`.

* move non-network related code from `MacProxy` into a new `AppleTypes`.

* add the `MONO_FEATURE_APPLE_X509` magic to `System/Makefile` where it was missing from.

(cherry picked from commit b61a3ffb02)

* [csproj] Update project files
2018-10-17 21:07:12 +02:00
Ludovic Henry 9f72a46b41 [sdks] Fix Archive Jenkins job (#11217) 2018-10-17 14:42:42 -04:00
Ludovic Henry 2712292c56 [sdks] Add Groovy script to build the SDKs archives for the products (#11192) 2018-10-16 12:25:51 -04:00
Ludovic Henry 839f49d3b2 [sdks] futimens and futimes symbols are missing on anything earlier than 10.13 (#11176)
This breaks when LLVM is built on 10.13+ and the runtimes are built on 10.12.
2018-10-16 08:14:41 -04:00
Ludovic Henry 657f915eb6 [2018-08] [sdks] Create archive targets for pre-building on CI (#10932)
* [sdks] Remove redundant --enable-cxx

* [sdks] Shorten `-m32`/`-m64` parameters detection for runtimes

* [sdks] Build BCL profiles without configure flags

* [sdks] Add BclTemplate to build BCL profiles

This is to avoid building all the profiles in a single `sdks/out/bcl` directory which will be shared between android, ios and wasm.

* [sdks] Add download/pack capabilities for LLVM

* [sdks] Create archive targets for pre-building on CI

* [sdks] Use archive-{android,ios,wasm} on CI

* [sdks] Run archive-llvm-llvm{,win}{32,64} on CI

* [sdks] Ensure LLVM is cloned before trying to download

* [sdks] Simplify call to BclTemplate

* [mcs] Make directory dependency as order-only

We would otherwise always rebuild the target since the directory is updated whenever something is added to the directory. This is a common Makefile technique.

* [sdks] Build tests for BCL targets
2018-10-12 16:13:26 -04:00
Ludovic Henry bd1f64acc3 [sdks] Add cmake toolchain file for LLVM MXE builds (#11055)
We couldn't compile llvmwin{32,64} on Linux because we would try to use {i686,x86_64}-w64-mingw-cmake but it wouldn't exist.
2018-10-12 10:55:12 -04:00
Ludovic Henry 7805ccc43d [sdks] Fix llvm-llvm32 build (#11117) 2018-10-12 10:10:33 -04:00
Alexander Köplinger 04a6e8294e [2018-08] Bump xunit (#11085) 2018-10-11 11:09:31 -04:00
Alexander Köplinger f001e691ca [2018-08] Bump msbuild (#11087) 2018-10-11 09:39:58 -04:00
Aleksey Kliger 7001d39bb2 Always use InvariantCulture calendars in X509Certificate on Mobile
Allow the linker to remove UmAlQuraCalendar and HijriCalendar on mobile devices

Match the CoreFX X509Certificate changes: https://github.com/mono/corefx/commit/4eb1fc2abd2ffa70e402d22415d0209b21725a10

Fixes https://github.com/mono/mono/issues/10448
2018-10-09 15:46:15 -07:00
Zoltan Varga e257971d3c [llvm] Remove an incorrect assert. 2018-10-08 14:20:23 -04:00
monojenkins 4d41b0560f [2018-08] [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes. (#10955)
* [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes.

* [llvm] Fix the special casing of OP_LCOMPARE_IMM, its not needed.

* Use TARGET_SIZEOF_VOID_P.
2018-10-08 10:12:53 +02:00
Martin Baulig 8ecede131d Use 'OnlyFaulted' only. 2018-10-08 10:12:16 +02:00
Martin Baulig 577ac4fd91 Add TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.OnlyOnCanceled as suggested by Marek. 2018-10-08 10:12:16 +02:00
Martin Baulig dfd13979ad [System]Make sure HttpWebRequest observes exceptions on timeout. #10488.
`HttpWebRequest.RunWithTimeoutWorker()` needs to observe the worker task's exception
on timeout to prevent it from being thrown via the `TaskScheduler.UnobservedTaskException`
event.  Fixes #10488.
2018-10-08 10:12:16 +02:00
Marek Safar cae86185c2 Bump corefx 2018-10-07 14:00:04 +02:00
Bernhard Urban 05c480e635 [2018-08] [interp] fixes for native type (#10998)
* [interp] fix op_implicit/op_explicit conversions for native types

Conversion operators have been mostly broken in the interpreter, for
example conversion from nint to float didn't work. While some
conversions are easy to intrinsify (like nint -> I8), there are harder
cases like nint -> decimal. The JIT actually falls back to the managed
implementation, so let's do this in the interpreter as well.

However the managed implementation expects a pointer to the value type,
i.e. the container type System.nfloat instead of float/double primitives.
In such cases the value is going to be stored in a local and then the
address of its storage is pushed on the stack before invoking the
managed implementation of the conversion.

Added test cases for scenarios observed in Xamarin.iOS.

* [interp] support ntype.CompareTo ()

* [interp] support ntype.Equals ()

* [interp] support nfloat.*Infinity

* [interp] support ntype.ToString ()

* [interp] introduce float R4 stack type
2018-10-05 11:27:42 -04:00
Egor Bogatov 5c70d5b946 [2018-08] Bump corefx (#10979)
* bump corefx

* bump corefx
2018-10-05 15:44:25 +02:00
Alexander Köplinger 2b620cc54b [ci] Always pass sha1 from Mac to Windows packaging build
Before we only did this for PR builds but it turns out it's needed for
normal master/branch builds too.

In situations where there are two Mac builds at roughly the same time
the downstream Windows builds would otherwise both refer to the same/latest
commit since they just checkout the latest ref on the branch.

Now we reset the Windows build to the sha1 which is passed to it.

(cherry picked from commit b13145bb12)
2018-10-05 00:28:25 +02:00
Alexander Köplinger 8d220f3913 [corlib] Simplify confusing "SSPI" error message and align with corefx (#10976)
Right now if anything goes wrong in the security stack you get a message like this:

```
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
```

This is confusing since SSPI is a Windows-only thing and is not used on Mono.
We inherited this error message string from referencesource.

Change the string to something more generic which also aligns us with CoreFX:
https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Net.Security/src/Resources/Strings.resx#L210-L212

(cherry picked from commit 42e347ee47)
2018-10-05 00:22:37 +02:00
Rolf Bjarne Kvinge 54700cf89f [sdks/ios] Build libMonoPosixHelper for device architectures, so that zlib-helper.o is created. (#10921) (#10971)
xamarin-macios currently builds zlib-helper.o using mono's source code.

It would be preferrable to use a version built by mono, and since
zlib-helper.o is a byproduct of building libMonoPosixHelper, we need to build
libMonoPosixHelper (we already build it for simulator architectures), even
though we don't need/use libMonoPosixHelper itself.
2018-10-04 11:23:47 -04:00
monojenkins d7ff201b56 Put xunit tests in mcs/class/lib/PROFILE/tests too (#10966)
So they are next to their NUnit counterparts.

Move xunit remote executor app to tests dir too and compile it when
compiling the test assembly instead of doing it before running the test.

We need to use an absolute path for the xunit remote executor and it
needs to be in Windows format on Windows since we pass it as an env var
to the xunit tests.
2018-10-04 11:06:09 -04:00
monojenkins 0a27b0f72d [2018-08] Use Mono.Android as a reference for netstandard facade (#10973)
Backport of #10849.

/cc @marek-safar @EgorBo

Description:
see https://github.com/mono/mono/pull/10835
2018-10-04 13:07:49 +02:00
Marek Safar 1644a1a01d Bump linker 2018-10-03 18:07:21 +02:00
monojenkins 3e89a56e50 Merge pull request #10906 from monojenkins/backport-pr-10899-to-2018-08
[2018-08] [runtime] Disable stack guard for main thread on osx

Backport of #10899.

/cc @luhenry @BrzVlad

Description of #10899:
On macOS Mojave, it seems that changing the mapping of stack pages for main thread can lead to corruption bugs.

https://github.com/mono/mono/issues/10802



<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-10-03 18:05:34 +02:00
Vlad Brezae 9f01ca1a9f [runtime] Fix undefined pthread_main_np (#10930)
It is exported only when _DARWIN_C_SOURCE is defined.
2018-10-03 10:37:45 +03:00
Maxim Lipnin 8b099949ad [Reflection] Fix issue with finding types in module using an asterisk as filter criteria 2018-10-03 08:45:15 +02:00
Aleksey Kliger f21a48dad5 [w32handle] Add coop state transitions in mono_w32handle_lock_handles
If another thread locked at least one of the other handles, and there is a
cooperative GC STW happening, this function will loop forever.

Add GC Safe transitions around the call to sleep to give this thread a chance
to suspend.

Fixes https://github.com/mono/mono/issues/10863
2018-10-02 17:17:07 -04:00
Martin Baulig 2cc940be99 Use passwordless import in the X509Certificate(byte[]) constructor.
The `X509Certificate(byte[])` constructor should call `CertificateProvider.Import(byte[])`
to use the native apple implementation if possible.

(cherry picked from commit 8b3ca0dbbe0af1436d33d74bb2ca00b3cbfc28b8)
2018-10-02 17:21:18 +02:00
Alexander Köplinger 25cfd22997 [packaging] Remove installation of openssl via brew on macOS (#10874)
We're now using an msbuild version which uses .NET Core 2.x which no longer needs openssl.

(cherry picked from commit 634e726bdf)
2018-10-02 13:13:52 +02:00
Vlad Brezae 03a769f787 [runtime] Disable stack guard for main thread on osx
On macOS Mojave, it seems that changing the mapping of stack pages for main thread can lead to corruption bugs.

https://github.com/mono/mono/issues/10802
2018-10-01 20:30:02 +00:00
Ankit Jain ced11fba7b Bump msbuild to track xplat-master (#10668)
* Bump msbuild to track xplat-master

* Print mono version, to debug CI failures
2018-09-28 11:56:19 +02:00
monojenkins aed3298ae2 [sdks] One more update to get XA PR builds working on Linux (#10856)
It turns out some Debian versions identify themselves as `Debian GNU/Linux`, add
this string to the list of distributions which have mingw. This *should* fix the
PR builds (fingers crossed)
2018-09-27 21:31:45 -04:00
monojenkins 425b46eca7 [csproj] Update project files 2018-09-27 19:21:14 -04:00
Marek Safar d507bd8929 [System.Core] Removes no longer needed reference 2018-09-27 19:21:14 -04:00
monojenkins bc97d1e742 [merp] Fix return value handling of posix_spawn (#10843) 2018-09-27 10:32:35 -04:00
monojenkins d2ae599e2c [sdks] Debian Linux doesn't need to build MXE (#10820)
Debian and its derivatives include full mingw chain (both 64 and 32-bit) and so
they don't need to build the toolchain at all. However, the current detection of
Linux flavor takes into account only Ubuntu and all other distros are configured
to *require* MXE but they do *not* build them.

This commit fixes detection of distros which provide the mingw toolchain in a
way that makes it easy to extend the set of compatible distributions as needed.
In order to mark a distribution as one with MinGW one has to add the `:Distro:`
string to the `LINUX_WITH_MINGW` make variable in `mxe.mk`. The `Distro` string
is whatever the `determine-linux-flavor.sh` script returns.
2018-09-27 10:30:12 -04:00
monojenkins 005c804cb2 [SDKS] Build host runtime with correct bitness (#10741)
When building 32-bit binaries on a 64-bit system and vice versa, it is necessary
to pass the `-m32` or `-m64` compiler flags, respectively. Failure to do so will
result not only in linking problems (different binary architecture) but also in
problems when using some system headers which are sensitive to the architecture.
For instance, `ucontext.h` contains register set definitions for different
architectures and building Mono runtime with a 64-bit compiler targetting 32-bit
architecture results in this error:

   .../mono/mono/utils/mono-sigcontext.h:173:74: error: ‘REG_EIP’ undeclared (first use in this function); did you mean ‘REG_RIP’?
      #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EIP])

The issue here is that the compiler defines the `__x86_64__` macro which causes
`ucontext.h` to choose declarations for amd64 (which does not use `REG_EIP` but
has `REG_RIP` instead) while Mono runtime assumes its building for a 32-bit host
and uses 32-bit register names. Passing `-m32` to the compiler will fix the
issue as now the compiler will define the `__i386__` macro and all parties will
agree where they are and what they want.

This commit uses a rather baroque statement when constructing compiler flags to
build the Mono runtime to check whether the host triple targets 32 or 64-bit
host and adds the appropriate flag.
2018-09-25 12:49:30 -04:00
Marek Safar 96d8a05b06 [System.Net.Http] Allow empty value in ProductHeaderValue
Fixes #10227
2018-09-24 14:31:04 +02:00
monojenkins 5df25e7d88 [crash] Fix summarize_frame assertion (#10728) 2018-09-21 10:33:34 -04:00
Marek Safar 65c1b941f9 [corlib] Makes remoting test more robust (and disable it on mobile) 2018-09-20 19:54:10 +02:00
EgorBo e6be71c516 bump corefx 2018-09-20 15:42:26 +02:00
monojenkins a65b4f5548 [mono-api-html] Render something for fields with marshalling info. (#10699)
Fixes this warning when comparing Xamarin.iOS.dll:

    Comparison resulting in no changes (src: Public, HasFieldMarshal dst: Public) :
    <field name="EdgeTessellationFactor" attrib="4102" fieldtype="System.UInt16[]" />
    <field name="EdgeTessellationFactor" attrib="6" fieldtype="System.UInt16[]" />
2018-09-19 17:16:35 -04:00
monojenkins 0a85488fde [offset-tool] Error out when parsing fails. (#10695) 2018-09-19 17:15:45 -04:00
monojenkins b4b0d0fa35 [System]Fix WebResponseStream.ReadAllAsyncInner() return value. (#10587)
We need to call `ToArray()` instead of `GetBuffer()` to truncate the buffer
to the amount of bytes that we actually read.
2018-09-19 17:15:30 -04:00
monojenkins 2a9ad9b4d4 [mono-api-html] Fix rendering of nuint. (#10665) 2018-09-19 12:17:41 -04:00
monojenkins 1a309a7b45 Implement IEnumerable for ConditionalWeakTable (#10656) 2018-09-19 12:16:41 -04:00
monojenkins 49b5001dfd [2018-08] [interp] add safepoints and enable hybrid suspend as default (#10685)
* [interp] add safepoints and enable hybrid suspend as default

* [interp] consolidate checkpoint and safepoint into one opcode
2018-09-19 12:14:29 -04:00
Zoltan Varga 2bceefe4e6 [sdb] Avoid calling into the debuggee from VirtualMachine.GetObject () while holding the objects_lock. 2018-09-19 10:01:47 +02:00
monojenkins 56bed71f11 Merge pull request #10621 from lewurm/2018-08-interp-remove-coop-attach-insn
[2018-08] [interp] move thread attach to interpreter entry

Backport of https://github.com/mono/mono/pull/10579
2018-09-18 05:45:11 -04:00
Bernhard Urban 62412a804c [ci] disable System.Core-xunit for interp, does not work on this branch yet 2018-09-17 20:12:29 +02:00
Vlad Brezae ef105562be [interp] Fix missing InvalidProgramException (#10095)
* [interp] Throw proper exception instead of warning

Fix code causing wrong stack state.

* [interp] Compile method for errors when needed

Delegate creation doesn't require compiling the method.

* [interp] Enable System.Core xunit tests
2018-09-17 14:44:46 +02:00
monojenkins 2510fd9253 [2018-08] Fix MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy (Linux/amd64/FullAOT/LLVM). (#10633)
mono_aot_get_unbox_trampoline: amd64 hardcode unbox trampoline size to 5 at compile-time.
This fixes: MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy frequently crashing on FullAOT/LLVM/Linux/amd64 CI.

https://github.com/mono/mono/issues/10441
https://github.com/mono/mono/issues/9554
https://github.com/mono/mono/issues/9046

The actual size varies between 6 and 9 but we can just pretend the last instruction has size 1 (it is 2 or 5; calling it 5 can be fatal, calling it 2 is no better than 1).

Otherwise, a trampoline can overlap the next function, jit info lookup of the next function can fail, then gsharedvt wrapper omited, and crash.

The afflicted function in this case was
System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT.

You can see it with debugprint: https://github.com/mono/mono/pull/10582.

There are many other possible fixes.
Such as runtime disassembly, hardcode in runtime instead of compiler, produce static trampinfo, omit trampinfo entirely, compute minimum size.

See https://github.com/mono/mono/commit/d589f3b64fca77c5c8bb5a8582eea5c0670312d7.
2018-09-16 13:10:49 -07:00
Marek Safar b76a034c12 [2018-06][Facades] Removes duplicate entry 2018-09-14 16:48:29 +02:00
Bernhard Urban d4f52d1116 [interp/jit] fix memory leak in pinvoke wrapper allocation 2018-09-14 15:32:26 +02:00
Bernhard Urban c3f4e28057 [interp] fix memory corruption around pinvoke wrapper allocation 2018-09-14 15:32:20 +02:00
Bernhard Urban b402c5bcf3 [interp] do not propagate uninitialized ThreadContext to JIT TLS 2018-09-14 15:31:28 +02:00
Bernhard Urban 4504185ee9 [interp] move thread attach to interpreter entry
We want to attach a thread before any TLS operation is done by the
interpreter. In the JIT this happens inside the native-to-managed
wrapper via `mono_threads_attach_coop ()`. Unfortunately, this is too
late for the interpreter as it already requires a working TLS before
even calling into the wrapper.

Also, fixup naming of locals in the native-to-managed wrapper.
2018-09-14 15:31:25 +02:00
monojenkins 63de341bb8 [arm64] Fix the alignment of valuetypes passed after small primitive types on IOS. (#10590)
Fixes https://github.com/xamarin/xamarin-macios/issues/4347.
2018-09-14 08:23:31 -04:00
monojenkins 9946fef5a3 [runtime] Fix Marshal.SizeOf (typeof (void)). (#10600)
Fixes https://github.com/mono/mono/issues/10303.
2018-09-14 08:21:34 -04:00
monojenkins 2e3c7693c9 [2018-08] Drop JIT attach: use coop attach in mini, aot and interp (#10551)
* [metadata] Hack - get mono_use_interpreter from metadata

Don't use this, it's a mistake.  The granularity is all wrong, for one: in the
future the interpreter may not be an all-or-nothing deal.

* [marshal] Don't emit CEE_MONO_JIT_ATTACH except for interpreter

Always use the mono_threads_coop_attach/mono_threads_coop_detach pair.

* [aot] Drop MONO_PATCH_INFO_JIT_THREAD_ATTACH

We always emit the mono_threads_attach_coop icalls now.

Bump MONO_AOT_FILE_VERSION

* [mini] mark mono_jit_thread_attach external only

It's used by Xamarin.Mac and possibly other embedders.

Interpreter still used mono_jit_thread_attach_interp until it's fixed to work
with coop.

There shouldn't be any other callers.

* [interp] Add a thread attach EE callback

Use it to set the interpreter thread context on the JIT tls value

* [marshal] Always emit mono_threads_attach_coop instead of CEE_MONO_JIT_ATTACH

Use the coop icall for the interpreter, too.

* [interp] Drop MINT_MONO_JIT_ATTACH and detach opcodes

* [metadata] Drop CEE_MONO_JIT_ATTACH and detach opcodes

* Revert "[metadata] Hack - get mono_use_interpreter from metadata"

This reverts commit c3d2f488b824dcdfa261f8292013c805740f353f.

* [mini] Drop unused mini_jit_thread_attach_interp

It was a temporary workaround for the interpreter; no longer needed.

* [coop] Switch to GC Safe in mono_jit_thread_attach.

It's an external-only function that's not called by the runtime on any
threads.  So the only calls are explicit uses by Mono API clients.  Leave the
thread in GC Safe mode and leave it to the n2m invoke wrappers or MONO_API
entry points to switch to GC Unsafe.

* [interp] Add MINT_MONO_THREADS_ATTACH_COOP opcode

Because this icall can be called from detached threads, don't go through
do_icall () which needs initialized tls keys

* fixup for c++ build

* fixup indentation and comments

* fixup C++ a bit more

* [mini] Bump MONO_EE_API_VERSION

* Revert "[interp] Add a thread attach EE callback"

This reverts commit 8a343d6ce15f0475a62936f28264f638ebf0344f.

* [interp] sync jittls context before entering EH machinery

* [interp] get context refactor (#10561)

* [interp] Add declaration for set_context (#10575)
2018-09-13 10:00:35 +02:00
monojenkins 228cab7601 [csproj] Update project files 2018-09-13 09:37:40 +02:00
monojenkins c12aa07fd7 Bump API snapshot submodule 2018-09-13 09:37:40 +02:00
Marek Safar ee57ffc058 [Facades] Adds System.Buffers mobile facade
and sets up facades without corresponding nuget _._ for conflict
resolution done by msbuild
2018-09-13 09:37:40 +02:00
monojenkins 7298849995 Treat EXDEV from clonefile the same way as ENOTSUP. (#10529)
Backport of #10528.

/cc @akoeplinger
2018-09-12 13:56:39 -04:00
Zoltan Varga eac547723c [arm64] Add dyncall support for ArgVtypeByRefOnStack arguments.
Fixes https://github.com/mono/mono/issues/10483.
2018-09-11 08:56:42 +02:00
Johan Lorensson 947193b9e2 Fix Mono Windows cross compiler using mono LLVM release_60 branch. (#10413) (#10503)
* Fix Mono Windows cross compiler using mono LLVM release_60 branch.

For scenario where llvm-config.exe can't be run (none WSL/CygWin build target)
Build will fallback to hard coded libraries not working with mono LLVM release_60
branch.

Added an exact mirror of what llvm-config.exe is returning for different components
on mono LLVM master and mono LLVM release_60 branch.

The selected codegen libraries (passed in as extra_libs) was not handled in any cases
so added them into the build script as well.

* Split parameter between lvm codegen libs and llvm extra libs.

Need to explicit pass -lz in case where configure have detected zlib availability
and llvm-config.exe can't be executed. In cases where zlib is not available, default
in mingw installs, this check make sure link step won't fail due to missing library.

* Fix inversion of aarch64codegen libs.

* Enable package-android-cross-{arm,arm64,x86,x86_64}-win builds on CI.
2018-09-07 16:38:40 -04:00
monojenkins 522cd7ce2a [corlib] Don't decrement ConditionalWeakTable::size on remove. (#10494)
We can't decrement the size on removal as we use tombstones.
When using tombstones, the invariant to keep is on the number of null entries as those
are used as search stop-marks.

Without this change, it's possible that a long series of add/remove operations could leave the array with no null entries,
just tombstones and filled entries. In that case, search would degenerate into a linear search that would look into all array elements.

This change fixes worst-case perf of not-found searches to be bound to the load factor.

Additionally, clear the array to null entries, otherwise we fall into the above trap even more easily.
2018-09-07 16:37:38 -04:00
Alexander Köplinger 1bdb478a71 [ci] Fix run-test-mac-sdk.sh build
0dbcdd5 added CFLAGS etc in front of the command but that's not something the TESTCMD can execute.
We shouldn't pass CFLAGS etc at all for this since that is handled by bockbuild.
2018-09-07 17:22:58 +02:00
monojenkins 1518670974 Fix DeflateStream handling of zero-length reads from underlying stream. (#10493) 2018-09-07 12:08:16 +02:00
monojenkins b5f8508f6f [llvmonly] Fix a regression caused by 55950a0608. (#9976) 2018-09-06 18:56:27 -04:00
monojenkins ea17477aac [2018-08] Ensure the finalization in DeflateStream is performed in the correct order. (#10492)
* Ensure the finalization of SafeHandle and GCHandle in DeflateStreamNative is performed in the correct order.

* Do not access BaseStream from finalizer.
2018-09-06 18:54:18 -04:00
monojenkins ed5b463839 [interp] white list nfloat::IsNaN () (#10385) 2018-09-06 18:49:18 -04:00
monojenkins 60f295e675 [2018-08] [exceptions] ftnptr_eh_callback test that stresses n2m transitions (#10387)
* [exceptions] ftnptr_eh_callback test that stresses n2m transitions

on Xamarin.iOS it happens that the ftnptr_eh_callback calls into managed
code, that is yet another native-to-managed transition.

* [coop] Use unbalanced transition to GC Unsafe in mono_raise_exception

Since `mono_raise_exception_deprecated` never returns, the transition won't be
balanced.  This fixes a cookie-counting problem (assert on mono shutdown) in
coop and hybrid checked builds using the new test case:

    MONO_THREADS_SUSPEND=coop MONO_CHECK_MODE=thread,gc mono mono/tests/install_eh_callback.exe
2018-09-06 18:48:58 -04:00
monojenkins 0ab763464d [2018-08] Truncate MachineName (and UserDomainName) at first period (#10418)
Backport of #9843.

* Truncate MachineName (and UserDomainName) at first period

Unix machines often put their FQDN as the host name, and domain
name is used for things such as yp. As such, truncate the FQDN to
just the hostname, as other Unix utilities seem to do.

Matches the .NET Core and .NET Framework behaviour, and MS seems to
require this for a future project. Fixes #9839.

* Add a unit test for bug

* Formatting tweaks
2018-09-04 13:20:20 +02:00
monojenkins 2ef3349e76 Update framework assemblies list in assembly.c (#10233)
Backport of #10214.
Fixes https://github.com/mono/mono/issues/9973
2018-09-04 13:16:39 +02:00
monojenkins bf580871f2 [2018-08] [corlib] Bring back String.Concat with __arglist (#10459)
Backport of #10452.
Fixes #9996
Tested repro project from the link on a local PostgresSQL server and EntityFramework packages.

See https://github.com/aspnet/EntityFramework6/blob/master/src/EntityFramework/Core/Objects/ELinq/MethodCallTranslator.cs#L1482-L1497
2018-09-04 13:14:38 +02:00
Ludovic Henry c19ca0ded5 [2018-08] [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA + Unify provisioning of LLVM for both Android and iOS. (#10427)
* [sdks] Add CrossRuntimeTemplate

* [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA

* [sdks] Factor various variables for RuntimeTemplate

* [sdks] Use CrossRuntimeTemplate for iOS

* [sdks] Unify provisioning of LLVM for both Android and iOS.

A global CFLAGS would be set in `run-jenkins.sh`, and that would screw up with LLVM. The global CFLAGS makes sense as long as we are only building Mono, but that's not the case with LLVM anymore.

* [sdks] Use MonoRuntime template for desktop-x86_64

* [sdks] Remove android-armeabi, it's been removed from XA already and the target has been deprecated in the NDK
2018-09-02 07:05:51 -04:00
monojenkins 51ea240a35 [sdb] Disable an assert to avoid breaking debugging. (#9983)
Fixes https://github.com/mono/mono/issues/8848.
Fixes https://github.com/mono/mono/issues/9262.
Fixes https://github.com/mono/mono/issues/8627.
2018-09-01 09:54:27 -04:00
monojenkins 3e238c836c [2018-08] Use clonefile instead of copyfile on macOS. (#10119)
* Use clonefile instead of copyfile on macOS.

* Address PR review comments.

* Address PR review comments (if -> assert).

* RTLD_DEFAULT - > libc_handle
2018-09-01 09:54:07 -04:00
monojenkins 802091af08 [coop] Fixup dump_threads () legend to match thread state enum values (#10386) 2018-09-01 09:52:41 -04:00
monojenkins 4dbe2ced4e [sgen] Fix string size inconsistency between alloc/scan (#10408)
This could lead to crashes when having strings with size at the LOS boundary.

https://github.com/mono/mono/issues/10309
2018-09-01 09:52:21 -04:00
monojenkins 2d50ef119b [MacSDK] Go back to incluging opt/llc after change in LLVM install process (#10433)
Fixes https://github.com/mono/mono/issues/10243
2018-09-01 10:27:23 +03:00
monojenkins eae59de800 [System]Fix MonoBtlsProvider.CheckValidationResult () logic. (#10397)
Backport of #10396.
2018-08-31 17:12:29 +02:00
monojenkins ad0854917e [System]Make `MobileAuthenticatedStream's read buffer large enough to hold a full TLS record. (#10394) 2018-08-31 16:56:50 +02:00
monojenkins 0e91bc8dd9 Merge pull request #10346 from monojenkins/backport-pr-10224-to-2018-08
[2018-08] [interp] fix ftnptr_eh_callback

Backport of #10224.

/cc @lewurm
2018-08-30 20:05:03 -04:00
monojenkins 6d2a0eb4aa [2018-08] [mini] fix memory dumping on devices (#10349)
[2018-08] [mini] fix memory dumping on devices

Backport of #10316.

/cc @lewurm
2018-08-30 09:40:23 -04:00
Johan Lorensson 80ade74200 Merge pull request #10358 from monojenkins/backport-pr-10321-to-2018-08
[2018-08] Fix Windows LLVM mono cross compiler build.
2018-08-30 13:36:53 +02:00
Alexander Köplinger 9d6252eb65 Follow up to bump target requirement to OSX 10.9 Mavericks
After another grep with different search terms I found a few more matches.
2018-08-30 12:44:44 +03:00
Alexander Köplinger b5f8d09d91 Bump target requirement to OSX 10.9 Mavericks
Fixes #9581
2018-08-30 12:44:44 +03:00
Ludovic Henry a2649d5d40 [sdks] Allow for overwriting llvm-{llvm32,llvm64} CC, CXX, CFLAGS and CXXFLAGS (#10362) 2018-08-29 22:12:39 -04:00
lateralusX 44a01472b1 Fix Windows LLVM mono cross compiler build.
This commit re-enables Windows LLVM mono cross compiler build + adjust to
new changes done in mono LLVM build system.
2018-08-29 13:28:07 +00:00
monojenkins 75f66645c4 [2018-08] [System]: MonoTlsStream is now IDisposable and cleans up on error. (#10335)
Backport of #10254.

/cc @marek-safar
2018-08-29 14:01:25 +02:00
monojenkins 756f617d2b [2018-08] Disable tailcall of gsharedvt. (#10324)
Backport of #10323.

/cc @marek-safar
2018-08-29 13:06:02 +02:00
Bernhard Urban 9256a02e8d [interp] turn off optimizations for callers of INTERP_PUSH_LMF_WITH_CTX 2018-08-29 09:03:28 +00:00
Bernhard Urban 207b7b6525 [interp] attach LMF with MonoContext in interp2native transition
this is needed so that EH can resume into the interpreter when the
exception was raised via mono_raise_exception from native code.
2018-08-29 09:03:28 +00:00
Bernhard Urban 10b2571905 [exceptions] pop lmf stack before executing ftnptr_eh_callback 2018-08-29 09:03:28 +00:00
Filip Navara e8415ffe23 Reintroduce fix for TextBoxTest.Bug82749. We need to save the user requested control bounds outside of ExplicitBounds since ExplicitBounds are used by table layout engine. 2018-08-27 21:32:04 +02:00
Filip Navara 805dfec75d Add test case. 2018-08-27 21:32:04 +02:00
Filip Navara b7635aed96 Fix changing TextBox font before the Control handle has been created. 2018-08-27 21:32:04 +02:00
Filip Navara f99f8aeacd Fix TextBox height fixup to work properly inside TableLayout. 2018-08-27 21:32:04 +02:00
Filip Navara 2a71a71c7b Fix layout of scrollbars in combobox. 2018-08-27 21:32:04 +02:00
Zoltan Varga eedc49b402 [llvm] Emit volatile loads in emit_volatile_load (), otherwise llvm might optimize the loads away.
Fixes https://github.com/mono/mono/issues/10035.
2018-08-27 14:20:18 +02:00
monojenkins 4151ad78f1 [llvm] Use curl as fallback for wget (#10265) 2018-08-24 11:38:23 +03:00
Marek Habersack 056528177e [eglib] Fix URI to file name conversion
Hexadecimal ASCII to decimal integer conversion must be 10-based.
2018-08-24 09:22:12 +02:00
Alexander Kyte c1910c80f4 Merge pull request #10241 from alexanderkyte/2018-08-merp
[2018-08] Add pipeline to convert managed exception into telemetry format
2018-08-23 23:26:10 -04:00
Aleksey Kliger 1054aba62a [mini] Don't regen Makefile.am if llvm/llvm_config.mk changes
The llvm/llvm_config.mk makefile fragment just includes make (not automake)
variable definitions.  So there is no need to regenerate the mini/Makefile.am
file if the fragment updates - the include will pick it up.
2018-08-23 17:47:03 +02:00
monojenkins d0fed2af14 [sdks] Use separate temporary dirs for llvm36/llvm. (#9975) 2018-08-23 15:59:05 +03:00
Alexander Kyte 85a7f7aca1 [runtime] Add interpreter support for walking Exception stacks 2018-08-22 15:05:00 -04:00
Alexander Kyte 6a783bb78c [runtime] Stub out exception summarizer when crash reporting is disabled 2018-08-22 15:04:31 -04:00
Alexander Kyte dd97b32959 [runtime] Consistently zero summarizer state memory 2018-08-22 15:04:22 -04:00
Alexander Kyte 67ed6f3152 [runtime] Create more ergonomic API for Exc to Telemetry 2018-08-22 15:04:11 -04:00
Alexander Kyte 22738e7d30 [runtime] Add test for managed telemetry reporting
To test the proprietary bits, you must first have a copy of MERP
installed somewhere.

Then run the following test:

using System;
using System.Reflection;

public class MinimalTelemetry {

	static MinimalTelemetry ()
	{
		var merp_path = "/xxx/xxx/xxx/Microsoft Error Reporting.app";
		var monoType = Type.GetType ("Mono.Runtime", false);
		var m = monoType.GetMethod("EnableMicrosoftTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
		var m_params = new object[] {"com.xamarin.MinimalTelemetry", "Test.Xam.MinimalTelemetry", "1337001", merp_path, "AppleAppCrash", "/Library/Frameworks/Mono.framework/Versions/Current/bin/mono"};
		m.Invoke(null, m_params);

		AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleException);
	}

	public static void HandleException (object sender, UnhandledExceptionEventArgs e)
	{
		var exc = e.ExceptionObject as Exception;

		var monoType = Type.GetType ("Mono.Runtime", false);
		var send = monoType.GetMethod("SendExceptionToTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
		var send_params = new object[] {exc};
		send.Invoke(null, send_params);

		// Now the MERP GUI should pop up
		// Click "More Information"
		// You should see something like this:
		// {
		//  "payload" : {
		//  "protocol_version" : "0.0.1",
		//  "configuration" : {
		//    "version" : "5.19.0 (managed_telemetry_pipeline/d342c73e320 Wed Aug 15 14:40:40 EDT 2018)",
		//    "tlc" : "normal",
		//    "sigsgev" : "altstack",
		//    "notifications" : "kqueue",
		//    "architecture" : "amd64",
		//    "disabled_features" : "none",
		//    "smallconfig" : "disabled",
		//    "bigarrays" : "disabled",
		//    "softdebug" : "enabled",
		//    "interpreter" : "enabled",
		//    "llvm_support" : "disabled",
		//    "suspend" : "hybrid"
		//  },
		//  "memory" : {
		//    "Resident Size" : "16306176",
		//    "Virtual Size" : "4491988992",
		//    "minor_gc_time" : "0",
		//    "major_gc_time" : "0",
		//    "minor_gc_count" : "0",
		//    "major_gc_count" : "0",
		//    "major_gc_time_concurrent" : "0"
		//  },
		//  "threads" : [
		//    {
		//      "is_managed" : false,
		//      "managed_thread_ptr" : "0x0",
		//      "thread_info_addr" : "0x0",
		//      "native_thread_id" : "0x0",
		//      "managed_frames" : [
		//        {
		//          "is_managed" : "true",
		//          "guid" : "4F72FB1B-1E99-47BA-91CE-9515783DC174",
		//          "token" : "0x6000004",
		//          "native_offset" : "0x6a",
		//          "il_offset" : "0x00000"
		//        }
		//      ]
		//    }
		//  ]},
		//  "parameters" : {
		//    "ApplicationBundleId:" : "Test.Xam.MinimalTelemetry",
		//    "ApplicationVersion:" : "1337001",
		//    "ApplicationBitness:" : "x64",
		//    "ApplicationName:" : "com.xamarin.MinimalTelemetry",
		//    "BlameModuleName:" : "Mono Exception",
		//    "BlameModuleVersion:" : "5.19.0 (managed_telemetry_pipeline/d342c73e320 Wed Aug 15 14:40:40 EDT 2018)",
		//    "BlameModuleOffset:" : "0x0",
		//    "ExceptionType:" : "0x02000000",
		//    "StackChecksum:" : "0x60114aa",
		//    "StackHash:" : "0x6011514",
		//    "OSVersion:" : "17.4.0",
		//    "LanguageID:" : "0x7f",
		//    "SystemManufacturer:" : "apple",
		//    "SystemModel:" : "MacBookPro14,3",
		//    "EventType:" : "AppleAppCrash"
		//    }
		//  }

	}

	public static void Main (string[] args)
	{
		//AppDomain.CurrentDomain.LoadFrom ("something that's not a valid path")
		throw new Exception ("MinimalTelemetrybar MinimalTelemetrybar");
	}
}
2018-08-22 15:04:00 -04:00
Alexander Kyte ffae0deeba [runtime] Zero out stack memory for mono-state dumper 2018-08-22 15:03:45 -04:00
Alexander Kyte b072bc6749 [runtime] Add initial support for Exc -> Telemetry
In order to allow managed crash reporting using the existing telemetry
format, I have added initial support for converting a MonoException into
a json blob for telemetry.
2018-08-22 15:03:28 -04:00
Alexander Kyte 82ac95b94e [runtime] Expose merp sender to icall 2018-08-22 14:25:53 -04:00
monojenkins faac90015c An implementation of the ChainStatus property for Btls. (#10215)
When we execute the certificate verification callback we just don't test for success and set status11. Now we get the error (if any) and map the error code to those defined by ChainStatusFlags and add it to a list of X509ChainStatus objects for that chain. Now when get_ChainStatus is called we convert that list to an array of X509ChainStatus and return it.
2018-08-22 11:45:37 +02:00
monojenkins 4368bb5d0a [2018-08] [hybrid-suspend] Two phase STW (#10221)
* [threads] Add enums for suspend phases and for begin-suspend results

* [coop] Two phase suspend

If we're using hybrid suspend, initially request suspension for threads, but
don't preemptively suspend blocking threads.  In the mop-up phase, peek at the
state and if they are still blocking_suspend_requested, preemptively suspend
them.

In full coop and in full preemptive, just use a single phase.

This should fix hybrid suspension deadlocks due to preemptively-suspending
threads taking locks that prevent cooperatively-suspending threads from
reaching a safepoint by leaving all threads running until all
cooperatively-suspending threads come to a safepoint. At that point we can
preemptively suspend the remaining threads.

Fixes https://github.com/mono/mono/issues/9921

* [tests] renable flaky hybrid suspend tests on PRs

* [coop] Thread state machine helper peek_blocking_suspend_requested
2018-08-22 11:13:20 +02:00
monojenkins 101736c438 [2018-08] [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case (#10162)
* [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case

So the issue is that calling begin_suspend_for_blocking_thread under hybrid
suspend will perform a preemptive suspension of the victim thread.

The preemptive suspend doesn't always succeed.
In particular, thread_state_init_from_sigctx or thread_state_init_from_handle
could return FALSE and into->suspend_can_continue will be set to FALSE.
When the thread_state_init_* functions return FALSE, they also set the
MonoThreadUnwindState:valid to FALSE.

So it is important to check the value of MonoThreadInfo:suspend_can_continue
before proceeding with a suspension.

As a result in suspend_sync in the ReqSuspendInitSuspendRunning case we call
check_async_suspend which checks (for preemptively suspended threads) whethere
suspend_can_continue is true.  If it isn't, we resume the victim thread and
loop once more in suspend_sync_nolock and try again.

We didn't have a check_async_suspend call in the ReqSuspendInitSuspendBlocking
case, so a thread could be considered suspended even if we couldn't capture a
valid MonoThreadUnwindState for it.

That breaks the assertion the call to mono_thread_info_get_last_managed in
async_suspend_critical which needs a valid MonoThreadUnwindState.

Fixes https://github.com/mono/mono/issues/10031

* fixup - remove coop assertion in check_async_suspend

result for coop could be iether BeginSuspendOkCooperative or
BeginSuspendOkNoWait depending on whether the thread was running (Ok) or
blocking (OkNoWait)

* [coop] suspend_can_continue if async raced with self-suspend (osx + win32)

Companion to 006d6ce097 from earlier this year
which applied this fix for POSIX signal based suspend.  This is the
corresponding OSX and Win32 fix.

In hybrid suspend, in the case where a suspend initiator needs to preemptively
suspend a thread, but the thread self-suspended while after the suspend
initiator put it into the blocking_suspend_requested state, we want to allow
the suspend to continue.  We do have to call the syscall to undo the native
async suspend, but after that, we can leave the victim to continue waiting for
a resume.

This should not have any effect on full cooperative or full preemptive suspend
- in the full coop case we never call async suspend, in the full preemptive
case the thread never self-suspends in blocking.
2018-08-21 14:14:41 -04:00
monojenkins bd20434769 Properly inflate pointer types in inflate_generic_type. Generic pointer types are encountered with 'unmanaged' constraint. (#10195)
Backport of #10145.
2018-08-21 00:57:56 +02:00
monojenkins 84a848a68f [2018-08] Enable mono-state-based telemetry for crashing on CI (#9963)
[2018-08] Enable mono-state-based telemetry for crashing on CI

Backport of #8654.

/cc @marek-safar
2018-08-20 18:55:52 +02:00
Alexander Köplinger 91eaa0832c Bump nunitlite to get NUnit2 xml output fix and failure on file not found fix (#10188)
See mono/NUnitLite#11 and mono/NUnitLite#12

(cherry picked from commit 8f67fb9fb1)
2018-08-20 16:56:49 +02:00
monojenkins 94bb56808f Fix process leak in process enumeration. Dispose rejected ones. (#10186)
This https://github.com/mono/mono/issues/10143 and fix is from there.

I considered nulling the array elements as I go, and then the tail,
to help the GC, but does it help actually? I suspect not.
2018-08-20 14:39:04 +02:00
monojenkins f236586422 [System.Xml.Linq] Fix namespace conflict with new Xamarin.Mac namespace in test code. (#10182)
macOS 10.14 introduces a Network framework, which means Xamarin.Mac now has a Network namespace.

This conflicts with 'using Network = System.Net':

> mono/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs(97,27): error CS0576: Namespace '<global namespace>' contains a definition conflicting with alias 'Network'

so just remove the using and use the full 'System.Net' namespace instead.
2018-08-20 12:08:54 +02:00
monojenkins 2a490e383b [sdks] Fix local testing for Android (#10176) 2018-08-19 12:11:19 -04:00
monojenkins 59277c72b7 [2018-08] [reflection] Assembly.LoadFile should throw ArgumentException for relative paths (#10082)
* [reflection] Assembly.LoadFile should throw ArgumentException for relative paths

Fixes https://github.com/mono/mono/issues/9943

* [mcs/tests] Use full path in the compiler-tester

Otherwise the call to LoadFile will fail

* [mono/tests] Use full path in LoadFile in test-multi-netmodule-4-exe

* [mono/tests] Use the test runner for a couple of tests

* [fullaot] Disable test-multi-netmodule-4-exe and custom-attr-errors.exe

* [tests] Use Path.GetFullPath and Path.Combine in AssemblyTest

Fix windows test failures
2018-08-17 09:27:05 -04:00
monojenkins d0e57fbac4 [sdks] Fix typo in ios template (#10131)
[2018-08] [sdks] Fix typo in ios template

Backport of #10130.

/cc @lambdageek
2018-08-16 14:10:17 +02:00
monojenkins 226c6a8b54 [cxx] One more MONO_API ahead of MONO_RT_EXTERNAL_ONLY. (#9965) 2018-08-15 10:39:52 -07:00
monojenkins b11c4232fd [2018-08] [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192. (#9966)
* [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192.

* [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192.
2018-08-15 09:37:50 -07:00
monojenkins 29d91bd6cf [2018-08] [reflection] Implement RuntimeType.IsSubclassOf in native (#10073)
* [reflection] Implement RuntimeType.IsSubclassOf in native

Fixes a performance regression https://github.com/mono/mono/issues/10000

* fixup - byref and reflexive IsSubclassOf
2018-08-15 18:36:37 +02:00
monojenkins 3e8a282bc3 [bcl] Disable a test which fails with linking. (#10107)
Fixes https://github.com/xamarin/xamarin-macios/issues/4617.
2018-08-15 01:08:55 +02:00
Alexander Köplinger ba38f97879 Add .gitignore for mono/tests/assembly-load-reference 2018-08-14 13:51:28 +02:00
monojenkins 64e9b1a983 [mini] Don't assert on MONO_PATCH_INFO_GC_SAFE_POINT_FLAG if coop is disabled (#9979)
If an AOT library is loaded that was compiled with safepoints, but currently
we're running with preemptive suspend (e.g. MONO_THREADS_SUSPEND=preemptive is
set), don't assert.  `mono_polling_required` will always be false, so the
safepoint will be ignored.

Fixes https://github.com/mono/mono/issues/9947
2018-08-13 16:23:55 +02:00
monojenkins 2e16537134 [ci] Disable sgen-new-threads-collect.exe until #9959 is addressed (#10029)
The test times out due to an issue in hyrbid suspend.  Turn off the test
temporarily while we work on a solution.

https://github.com/mono/mono/issues/9959
https://github.com/mono/mono/issues/9921
2018-08-10 22:35:12 +02:00
monojenkins 6a844e7677 [w32file] Fix typo (#10003) 2018-08-09 18:01:20 -04:00
monojenkins cc3d5f0374 [coop] Thread.JoinInternal should not call mono_error_set_pending_exception (#9971)
[2018-08] [coop] Thread.JoinInternal should not call mono_error_set_pending_exception

Backport of #9948.

/cc @lambdageek
2018-08-09 19:25:19 +02:00
monojenkins 2245249f6d [2018-08] [Facades] Adds System.Threading.Tasks.Extensions for mobile profiles (#9978)
* [Facades] Adds System.Threading.Tasks.Extensions for mobile profile

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-09 00:20:09 +02:00
Alexander Köplinger f123d67e04 Merge pull request #9923 from monojenkins/backport-pr-9858-to-2018-08
[2018-08] [loader] Determine assembly load context from path
2018-08-08 11:45:30 +02:00
monojenkins d551bcc1f2 Remove extern "C" from MONO_LLVM_INTERNAL. Consider also putting it at start of prototype instead of end, like MONO_API. (#9957) 2018-08-08 11:40:44 +02:00
monojenkins b606864198 [2018-08] [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority (#9917)
* [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority

   Observed pthread_getschedparam taking a lock on OSX

* [win32] Capture GetLastError before MONO_EXIT_GC_SAFE
2018-08-07 21:46:02 -04:00
monojenkins 0242e31892 Add missing return from the function. (#9932)
Was accidentally removed in 3780114620.
2018-08-07 12:54:05 +02:00
monojenkins 5de08e1822 [sdks] Rename LLVM_VERSION make var to LLVM_RELEASE, LLVM_VERSION is already used by versions.mk. (#9933) 2018-08-07 12:53:47 +02:00
Aleksey Kliger 55ff5b426f [tests] AOT assembly-load-reference tests 2018-08-06 23:03:42 +00:00
Aleksey Kliger 9c01d63b45 [tests] Test loading references from LoadFrom and LoadFile contexts
The LoadFrom assembly loading context and the individual assembly loading
context (aka LoadFile aka "no context") behave differently when requesting a
referenced assembly - for LoadFile we expect the runtime to probe the appdomain
base, the GAC + MONO_PATH but not the basedir of the requesting assembly.  For
LoadFrom the basedir of the requesting assembly _is_ included.  So the tests
here try all the possible variations.
2018-08-06 23:03:42 +00:00
Aleksey Kliger 031968ad2e [loader] Use appdomain base dir and loadfrom asmctx hooks
1. If an assembly filename is in the GAC, always open the assembly in default
context.
2. If an assembly filename is in the appdomain search path (base directory or
private bin path) always open the assembly in default context.
3. If an assembly filename is in the base dir of the requesting assembly and
the requesting assembly was in LoadFrom context, always open the assembly in
LoadFrom context.

Fixes https://github.com/mono/mono/issues/9753
and Fixes https://github.com/mono/mono/issues/9542
2018-08-06 23:03:42 +00:00
Aleksey Kliger 079aff5529 [loader] Add mono_install_asmctx_from_path_hook
Add a hook that can be used to check whether a given path belongs to some
assembly load context.

For example if a given path is in the application base of the current
appdomain, an appdomain hook would set out_asmctx to MONO_ASMCTX_DEFAULT and
return TRUE.
2018-08-06 23:03:42 +00:00
Aleksey Kliger 721092cc06 [utils] Add mono_path_filename_in_basedir 2018-08-06 23:03:42 +00:00
Aleksey Kliger 9f65ed3311 [loader] Pass requesting assembly to mono_assembly_open_predicate
In LoadFrom and LoadFile icalls, pass the currently executing assembly as the
requesting assembly.
2018-08-06 23:03:42 +00:00
Aleksey Kliger cf4eb293da [loader] Assemblies in individual asmctx can reference assemblies in application base
If an assembly was loaded with LoadFile, it can reference assemblies from the
application base, the GAC or MONO_PATH.

Fixes https://github.com/mono/mono/issues/8575
2018-08-06 23:03:42 +00:00
Aleksey Kliger 1f44a5e5a0 [loader] Consult asmctx of executing assembly for Assembly.Load
if an assembly in LoadFrom context calls Assembly.Load, the given assembly name
should be tried in the basedir of the executing assembly, and the resulting
loaded assembly should be in LoadFrom context.
2018-08-06 23:03:42 +00:00
Aleksey Kliger 6f31677959 [runtime] Add mono_runtime_get_caller_no_system_or_reflection
Exposes an already existing stackwalk that we use to find out who called a
corlib API.
2018-08-06 23:03:42 +00:00
Jo Shields 42e523a21e Merge pull request #9905 from directhex/2018-08
Bump version to 5.18.0
2018-08-06 14:36:24 -04:00
Jo Shields 1c5f8bc400 Bump version to 5.18.0 2018-08-06 11:07:36 -04:00
Rodrigo Kumpera d4c5708379 Merge pull request #9789 from nsivov/master
[mini] Increase inline cost linearly to number of calls.
2018-08-06 08:51:46 -04:00
Marek Safar c7e9b58154 [build] Updated script after xunit runner utility rename 2018-08-06 14:26:26 +02:00
Zoltan Varga 119cd74023 [llvm] Fix OP_ABSF. (#9878)
Fixes https://github.com/mono/mono/issues/9869.




<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-08-06 12:52:05 +02:00
Calvin e48732f960 System.IO.DriveInfo for AIX (#9777) 2018-08-06 11:25:06 +02:00
Zoltan Varga a62bb95b27 [sdks] Switch the 32 bit cross compilers back to the old llvm 3.6, the new version has too many problems. (#9889)
* [sdks] Switch the 32 bit cross compilers back to the old llvm 3.6, the new version has too many problems.

* [sdks] Fix building llvm36.
2018-08-06 10:21:33 +02:00
Jay Krell 7beff1090c Remove unused amd64 field ss_trigger_page_var. (#9887) 2018-08-05 11:02:27 -07:00
Aleksey Kliger (λgeek) a7c699ab00 [coop] Turn hybrid suspend on by default on desktop platforms (#9811)
* [coop] Turn hybrid suspend on by default on desktop platforms

   Use hybrid suspend by default on x86 and amd64 OSX, Windows and Linux

   Pass `--disable-hybrid-suspend` to configure to disable at build time, or set the environment variable `MONO_THREADS_SUSPEND=preemptive` when running Mono to use preemptive suspend (the previous default).

   Pass `--disable-hybrid-suspend --enable-cooperative-suspend` to configure cooperative suspend at build time.

* [sdks] Disable coop and hybrid suspend for iOS and Android

   Only the devices and simulator builds, not the host ones.

* [coop] Add mono_threads_suspend_override_policy ()

   Do not use it.  It provides a last resort method to ignore configure and environment settings and use a hardcoded threads suspend policy.

* [interp] Override suspend policy - warn and use preemptive

   Until the interpreter supports safepoints and performs threads suspend states switches in its trampolines, always use preemptive suspend if the interpreter is used.

* [coop] Enter GC Safe around mono_threads_join_lock ()

   Like other uses of mono_threads_join_lock, enter GC Safe before trying to take the lock.

* [interp] Use preemptive suspend with --full-aot-interp

   Move safepoint suspend check to mono_runtime_set_execution_mode

* [test] fullaotmixed - force preemptive suspend[test] fullaotmixed - force preemptive suspend

   Force preemptive suspend in fullaotmixedcheck. We must compile the AOT images without safepoints.
2018-08-04 22:03:17 -04:00
Zoltan Varga 6b26820f28 [runtime] Cross32 changes. (#9866)
* [sdks] Run the offset-tool in 64 bit mode.

* [sgen] SgenDescriptor should use the target wordsize.

* [sdks] Fix 'Run the offset-tool in 64 bit mode.'
2018-08-04 14:54:59 -04:00
monojenkins b86bc9beea [bcl] Update BCL Linked Size 2018-08-04 08:21:42 +02:00
Marek Safar 14edd581fd [build] Switch to netstandard based xunit 2018-08-04 08:15:28 +02:00
Katelyn Gadd 7639f98983 Ensure cil-stringreplacer is built and used to post-process mscorlib when building using msbuild (#9859)
* Manually add a csproj file for cil-stringreplacer
Adjust trace level for genproj

* Manually add cil-stringreplacer to bcl.sln and set it as a dependency of corlib

* Fix typo

* Add post-build event to corlib that runs cil-stringreplacer on it in mscorlib mode

* [csproj] Update project files
2018-08-03 13:58:44 -07:00
Matthew Leibowitz c32af8905b [mono-api-tools] Make the tools work as libraries (#9793)
Right now, the set of mono-api-tools only works as console apps. This PR will make them work as normal dlls so they can be consumed by other apps and libraries. They will still work as .exes, so nothing visibly changes for existing users.

The motivation for this is for some build process or third party tool to take an assembly and generate an .xml doc from it. Since the writer is in-memory, the tool can then parse the .xml and do whatever it needs to. The same goes for the diff tools - if the diff happens in-memory, then the tool can process it without having to save and then load from the file system.

## Libraries
 - [x] mono-api-info -> `Mono.ApiTools.ApiInfo`
 - [x] mono-api-diff -> `Mono.ApiTools.ApiDiff`
 - [x] mono-api-html -> `Mono.ApiTools.ApiDiffFormatted`

## Major changes
 - the existing `Driver` classes are now just thin wrappers to parse the args and pass it on to the generators
 - the "options" are now abstracted into config classes to avoid methods with numerous parameters
 - the APIs have new support for reading assembly and info `Stream`s instead of just file paths
 - added compiler flags to control the namespace and type visibility to make the library APIs nicer
 - added compiler flag to remove the `Driver` class and `Mono.Options` dependencies
 - the mono-api-info tool has some more options to allow it to run on libraries, and ignore dependencies that it cannot find - this makes it easier to use so that the entire dependency chain does not have to be loaded just to output the current assembly API

## Compiler defines
 - `EXCLUDE_DRIVER` will remove the console entry point and remove the dependency of Mono.Options
 - `USE_MONO_API_TOOLS_NAMESPACE` will switch the namespace to `Mono.ApiTools` so that libraries can have a nice API
 - `USE_INTERNAL_VISIBILITY` will make any non-essential, `public` APIs turn `internal`

## Review points
 - are there any variables/fields that are still static?
 - are there any exposed types/members that need to be hidden?
 - are the new names for the APIs and config classes OK?
 - are my whitespaces according to the guidelines?
 - did I go horribly wrong?
2018-08-03 22:20:34 +02:00
Jay Krell 58efe94192 [cxx] Add extern "C" to MONO_API. And ICALL_EXPORT. Add missing ICALL_EXPORT. (#9814)
- Public headers should be wrapped in it (all but one are).
 - MONO_API should include it.

But it is not needed "everywhere".

Placement of "extern" therefore tweaked.
  - Remove from functions where it is meaningless and gets in the way.
  - Mark data with MONO_API_DATA instead of MONO_API.

[not yet]Sprinkle in a few G_BEGIN_DECLS for monodis and where THREAD_INFO_TYPE makes prototypes incorrect.

include/add prototypes for all icalls. [undone per PR, possibly a misunderstanding]

A problem would be, if embedders manage to use functions that are neither MONO_API nor
in public headers.

Some parts of the larger solution are omited here in the hopes of finding better options.
In particular, compiling all of monodis as C++ so we don't need some extern "C" for it,
and THREAD_INFO_TYPE at least incoming being gpointer so declaration and definition match.

This is based on https://github.com/mono/mono/pull/9812/commits/40315ee475bdf89c40189707a8cca86b3f6d91c8 and is an alternative to https://github.com/mono/mono/pull/9782.

We also can/should prune the preexisting G_BEGIN_DECLS / G_END_DECLS uses.
2018-08-03 12:35:25 -07:00
Vlad Brezae 5672eba582 [interp] Run tests for entire bcl (#9648) 2018-08-03 16:14:58 +03:00
Marek Safar 686addfef6 [corlib] Improve linker crypto dependencies tracking 2018-08-03 14:37:08 +02:00
Marek Safar f8bd4c9980 [linker] Extract suitable mobile tests to valid linker tests 2018-08-03 14:37:08 +02:00
Maxim Lipnin 19cce4a0be [System.Reflection] CoreFX import for ExceptionHandlingClauseOptions (#9856)
* [System.Reflection] CoreFX import for ExceptionHandlingClauseOptions

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-03 13:26:52 +02:00
Marek Safar 469d219f5b Add back 2.4 xunit accidentally reverted https://github.com/mono/mono/pull/9749/files (#9853) 2018-08-03 11:27:16 +02:00
Bernhard Urban 0f5b279163 [interp] distinguish MINT_CALLI_NAT_FAST from MINT_CALLI_NAT in debug output (#9864) 2018-08-03 12:07:35 +03:00
Zoltan Varga 6ef1b33bb4 [runtime] Cross32 changes. (#9848)
* [runtime] Add a MONO_ABI_SIZEOF(MonoObject) define, use it instead of sizeof(MonoObject). Add a few helper functions to avoid sizeof(MonoObject) in many places.

* [aot] Add a 'deterministic' testing argument to have the compiler produce deterministic output by turning off the generation of the AOT id.

* [jit] Use target sizes in many places.

* [runtime] Avoid corlib checks in cross compile mode, its not possible to read the field value from corlib.

* [runtime] Fix the arm build.
2018-08-03 04:53:43 -04:00
Zoltan Varga 4224af359c [runtime] Add a drive type entry for the Paragon NTFS drive on macos. (#9677) 2018-08-02 21:24:13 -04:00
Michael DeRoy 84df14cff4 Fix issue where get offset could return 0 when the type is uninited 2018-08-02 15:09:41 +02:00
Maxim Lipnin 6734b30f3b [System.Reflection] CoreFX import for several simple types. (#9844)
Part of #9660.

The imported CoreFX types:
- AssemblyNameProxy;
- Binder;
- Missing.
2018-08-02 12:20:05 +02:00
Katelyn Gadd 3328833e97 Fix race condition where parallel builds will continue before we are actually done installing monolite (#9826)
Right now we have a race condition where parallel make on CI will barge ahead and start building things before monolite+basic-profile-check have completed, which results in some weird behavior - gensources silently fails to run, etc. Testing some possible fixes for this.
2018-08-02 11:39:47 +02:00
Zoltan Varga 8dd7af7d7e [runtime] Cross32 changes. (#9840)
* [offsets-tool] Add i386-apple-darwin11.2.0 as an abi target, used only for development.

* [offset-tool] Emit sizes for structures.

* [runtime] Cleanup the cross targets in configure.ac and add more target defines.

Redefine SIZEOF_REGISTER to refer to the target size.
Add TARGET_SIZEOF_VOID_P define and target_mgreg_t type.

* [runtime] Add missing object offsets for x86.

* [runtime] Avoid trying to execute assembly load hooks in aot mode.

* [runtime] Fix the windows build.

* [offset-tool] Fix indentation.

* [runtime] Add a mono_gc_get_target_card_table () function which is the same as mono_gc_get_card_table () but returns information for the target. Use it in the JIT and in places where we generate IL code.

* [aot] Save the card table parameters in the AOT image and check them at load time.

* Fix llvm support.
2018-08-02 05:22:04 -04:00
Nikolay Sivov 8a7fc9df59 [mini] Limit maximum per-call inline cost. 2018-08-02 08:32:56 +03:00
Katelyn Gadd feaf8ee391 Use msbuild project reference to establish dependency on genconsts instead of solution dependencies (#9670)
Using solution dependencies in ```bcl.sln``` seems flaky and seems like it might not establish the full ordering we need to ensure that ```Consts.cs``` exists before we build things that require it. Let's try using project references (where ```corlib.dll``` 'depends' on ```genconsts.exe```) instead. This should also insert the dependency for any project that includes Consts.cs instead of just corlib.

This PR also makes update-solution-files actually fail if ```genconsts.exe``` fails to build because it was driving me mad.

Part of #6886
2018-08-02 00:30:54 +02:00
Brian Raderman 09c0cc5fca Remove assert when retrieving value of string with invalid chars
This assert was causing Unity to crash when trying to view a local
string variable in the debugger with invalid characters.
2018-08-02 00:07:49 +02:00
brianradunity cd17c58117 Add check for a generic method when invoking in debugger (#9806)
* Add check for a generic method when invoking in debugger

VSTU will try to invoke a generic (uninflated) method in certain
situations, which was causing the Mono debugger to assert and crash
Unity. Added a check for this situation before the invoke so the
debugger can return an error to the client. Previously, this case
wasn't caught until the method was in JIT compilation, which will
assert when this situation is detected.

* Fixing typo
2018-08-01 23:41:11 +02:00
Vlad Brezae 78eb8324b2 [interp] Fix span exception throwing 2018-08-01 22:23:38 +02:00
Jay Krell a89a004da9 [cxx] g_get_assertion_message returns const; do not write over it (#9818)
We could alternatively return non-const, but the overwrite seems gratuitious, assuming the length fits in 31 bits.
2018-08-01 12:26:43 -07:00
Bernhard Urban 89a0fea799 [LinkerDescriptor] remove remoting feature from MonoMethodMessage
Fixes those failures on Xamarin.iOS:
> 2018-07-30 21:16:19.931 monotouchtest[49618:80799179] error: * Assertion at /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/external/mono/mono/metadata/object.c:7896, condition `init_message_method != NULL' not met
> 2018-07-30 21:16:19.931 monotouchtest[49618:80799179] critical: Stacktrace:
>
> 2018-07-30 21:16:19.932 monotouchtest[49618:80799179] critical:   at <unknown> <0xffffffff>
> 2018-07-30 21:16:19.932 monotouchtest[49618:80799179] critical:   at (wrapper managed-to-native) object.__icall_wrapper_mono_delegate_begin_invoke (object,intptr) <0x00012>
> 2018-07-30 21:16:19.932 monotouchtest[49618:80799179] critical:   at (wrapper delegate-begin-invoke) <Module>.begin_invoke_IAsyncResult__this___AsyncCallback_object (System.AsyncCallback,object) [0x00015] in <643e5a0761d140d1977f1bbd2bd72153>:0
> 2018-07-30 21:16:19.932 monotouchtest[49618:80799179] critical:   at MonoTouchFixtures.AVFoundation.AVAssetImageGeneratorTest.GenerateCGImagesAsynchronously () [0x00021] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/monotouch-test/AVFoundation/AVAssetImageGeneratorTest.cs:126
> 2018-07-30 21:16:19.933 monotouchtest[49618:80799179] critical:   at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x0004f] in <643e5a0761d140d1977f1bbd2bd72153>:0
> 2018-07-30 21:16:19.933 monotouchtest[49618:80799179] critical:   at <unknown> <0xffffffff>
> 2018-07-30 21:16:19.934 monotouchtest[49618:80799179] critical:   at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0x00012>
> 2018-07-30 21:16:19.934 monotouchtest[49618:80799179] critical:   at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.15.0.36/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
> 2018-07-30 21:16:19.934 monotouchtest[49618:80799179] critical:   at System.Reflection.MethodBase.Invoke (object,object[]) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.15.0.36/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229
> 2018-07-30 21:16:19.934 monotouchtest[49618:80799179] critical:   at NUnit.Framework.Internal.Reflect.InvokeMethod (System.Reflection.MethodInfo,object,object[]) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/external/mono/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Reflect.cs:215
> 2018-07-30 21:16:19.935 monotouchtest[49618:80799179] critical:   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunNonAsyncTestMethod (NUnit.Framework.Internal.TestExecutionContext) [0x00000] in /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/external/mono/external/nunit-lite/NUnitLite-1.0.0/src/framework/Internal/Commands/TestMethodCommand.cs:114

Also see
https://github.com/xamarin/xamarin-macios/blob/10d98e67d88231fd41218a93b92d42914550ee10/tools/mtouch/Tuning.cs#L137

@akoeplinger mentions further:
> we even have custom code to preserve MonoMethodMessage in the XI linker:
> https://github.com/xamarin/xamarin-macios/blob/a563a66c342d2e982a9648fbfd5ce9c361bea07e/tools/linker/MonoTouch.Tuner/RemoveCode.cs#L178-L180

Fixes regression introduced by https://github.com/mono/mono/pull/8055
2018-08-01 16:34:00 +02:00
Vlad Brezae 0bec0381b5 [utils] Sane assert instead of crash on allocation failure 2018-08-01 16:21:42 +02:00
Calvin b49c584b97 Really fix CoreR[FT] version of System.Decimal for big endian (#9828)
The version imported and attempted to patch didn't work fully. This
preserves the .NET representation while converting if directives to
runtime checks, which CoreCLR inlines.

Testing was done poking some values in the REPL and running some
test suites (System.Json, System.Decimal) that broke as a result.
mcs should also properly handle constants; again, the "bits" inside
are consistent with amd64, and just converted as needed.

Unless I fucked up, should fix #9772.
2018-08-01 16:20:03 +02:00
Filip Navara 60b95ba08d Fix System.Drawing on 64-bit macOS. (#9824)
Carbon implementation now throws exception instead of crashing in the mismatched p/invoke calls.
Cocoa implementation now support 64-bit mode and uses the handle of `NSView` that is passed in instead of relying on `NSGraphicsContext.CurrentContext`. It also fixes handling of flipped views.

Requires up to date libgdiplus.
2018-08-01 12:47:47 +02:00
Jay Krell 92d567c89b [Coop] Convert ves_icall_MonoField_GetFieldOffset. (#9742) 2018-08-01 06:03:45 -04:00
Jay Krell f3723239fb w32file-unix.c fix warnings about unused locals (#9823)
w32file-unix.c:2361:7: warning: unused variable 'ret_utime' [-Wunused-variable]
        gint ret_utime;
             ^
w32file-unix.c:2358:15: warning: unused variable 'dest_fd' [-Wunused-variable]
        gint src_fd, dest_fd;
                     ^
w32file-unix.c:2358:7: warning: unused variable 'src_fd' [-Wunused-variable]
        gint src_fd, dest_fd;
             ^
w32file-unix.c:2362:7: warning: unused variable 'syscall_res' [-Wunused-variable]
        gint syscall_res;
             ^
4 warnings generated.
2018-07-31 16:26:03 -07:00
Alexander Kyte b26d092ccc Merge pull request #9809 from alexanderkyte/collect_threads_safer
[runtime] Make collect_threads helper pin MonoInternalThread objects
2018-07-31 16:44:49 -04:00
Aleksey Kliger (λgeek) 3780114620 Add GC Unsafe thread state transitions to MONO_API functions - Fourth Edition (#9630)
* [appdomain] MONO_API mono_domain_set needs GC Unsafe

* [runtime] MONO_API mono_domain_set_config needs GC Unsafe

* [runtime] MONO_API mono_dllmap_insert sometimes needs GC Unsafe

   When adding a global mapping, don't do the state transition because the thread may not be attached yet.   When adding a per-image mapping, do the transition.

* [runtime] MONO_API mono_g_hash_table_insert needs GC Unsafe

* [runtime] MONO_API mono_g_hash_table_new_type needs GC Unsafe

* [runtime] MONO_API mono_gc_reference_queue_new needs GC Unsafe

* [runtime] mono_thread_detach_if_exiting thread state change

   1. Mark it external only, it's unused in the runtime.
   2. If detaching, switch to GC Unsafe before detaching

* [metadata] Make mono_class_get_fields external only

   - Runtime should use mono_class_get_fields_internal
   - MONO_API mono_class_get_fields needs GC Unsafe

* [runtime] MONO_API mono_gc_reference_queue_add needs GC Unsafe

* [metadata] Make mono_class_get_name and namespace external only

   - Runtime should use m_class_get_name and m_class_get_name_space
   - MONO_API mono_class_get_name and mono_class_get_namespace need GC Unsafe

* [metadata] MONO_API mono_class_get_parent needs GC Unsafe

   - mark it external only; runtime should use m_class_get_parent

* [metadata] Make mono_class_is_delegate external only

   - runtime should use m_class_is_delegate
   - MONO_API mono_class_is_delegate needs GC Unsafe

* [metadata] Make mono_class_is_valuetype external only

   - runtime should use m_class_is_valuetype
   - MONO_API mono_class_is_valuetype needs GC Unsafe

* [metadata] Make mono_class_is_enum external only

   - runtime should use m_class_is_enum_type
   - MONO_API mono_class_is_enum needs GC Unsafe

* [metadata] Mark mono_class_get_element_class external only

   - runtime should use m_class_get_element_class
   - MONO_API mono_class_get_element_class needs GC Unsafe
2018-07-31 16:30:42 -04:00
Jo Shields acca4a965f Fix tarballs again (#9810) 2018-07-31 18:36:22 +02:00
Kenneth Pouncey fa726d3ac7 Add support for Blazor custom interop support. (#9713)
* Add support for Blazor custom interop support.

This adds additional ability to perform unmarshalled calls for advanced but high-performance shared-memory interop.
* Note: * This is only safe in Blazor's case because of its exact usage patterns.

* Add dotnet_support.js backing file.
2018-07-31 02:37:11 -04:00
Zoltan Varga e34bddee3a [jit] Clean up the handling of the lower/higher parts of long values on 32 bit platforms. (#9807)
Instead of accessing them using the inst_ls_word/inst_ms_word macros which use the union in MonoInst.data, access them normally using
MonoInst.Data.i8const.
2018-07-30 16:26:39 -04:00
Alexander Kyte e7da3d58ad [runtime] Make collect_threads helper pin MonoInternalThread objects 2018-07-30 13:16:46 -04:00
Jay Krell 801e3f360f [cxx] Keywords: new => new_, typename => type_nam, namespace => name_space, (#9737)
[cxx] Keywords: new => new_, typename => type_name, namespace => name_…

…space, conditionally class => super_class.
2018-07-30 08:40:14 -04:00
Zoltan Varga c28849f256 [jit] Avoid checking ins->inst_left in MONO_IS_COND_BRANCH_NOFP (), its not initialized by MONO_INST_NEW (). (#9790)
[jit] Avoid checking ins->inst_left in MONO_IS_COND_BRANCH_NOFP (), its not initialized by MONO_INST_NEW ().
2018-07-30 08:10:17 -04:00
Zoltan Varga 5c0a26a0a7 [llvm] Bump llvm to release_60/fc854b8ec5873d294b80afa3e6cf6a88c5c48886. (#9786)
[llvm] Bump llvm to release_60/fc854b8ec5873d294b80afa3e6cf6a88c5c48886.

Fixes https://github.com/mono/mono/issues/9750.
2018-07-30 07:40:11 -04:00
Calvin 3fad184014 Bump submodule for #9684 and mono/corefx#108 (#9773) 2018-07-30 13:24:15 +02:00
Jason Imison e14a636865 Apply F# portable pdb debug fix for pinvokes & bump (#9792)
It wasn't possible to debug any F# app that contained PInvokes.
The F# compiler omitted MethodDebuginformation for PInvokes which in
turn caused Mono to fail on an assertion.

```
* Assertion at metadata.c:1117, condition `idx < t->rows' not met
```
2018-07-30 12:42:40 +02:00
Egor Bogatov 6fb14f641b Fix comparison of IntPtr with null (#9800)
See dotnet/corefx#31457
2018-07-30 11:42:52 +02:00
Alexander Köplinger 124febb1c1 [bcl] Include all .sources files in the tarball (#9803)
https://github.com/mono/mono/commit/0f0e31842f1f394c4e95d3726c20af547e706278 added a new pipes_pns.sources file
but we forgot to add it to EXTRA_DISTFILES so it gets included in the tarball.

Given that this happens almost all the time when we add a new .sources file
we should just always include all *.sources
2018-07-30 11:14:00 +02:00
Jay Krell c6b8cecb9d Change corlib version to a string, so that you can use uuidgen (or a git hash or github PR). (#9787) 2018-07-30 01:25:35 -07:00
monojenkins a30df89f73 [bcl] Update BCL Linked Size (#9791) 2018-07-30 10:21:58 +02:00
Jay Krell 5c144761f4 [cxx] Build/CI support for C++. (#9731)
* [cxx] Build/CI support for C++.
configure -enable-cplusplus and CI_TAGS=cplusplus
https://jenkins.mono-project.com//job/test-mono-mainline-linux-cplusplus/

* [cxx] Rename CPLUSPLUS/cplusplus to CXX/cxx.

* [cxx] Add C++ build support to mini.

* [cxx] Jenkins/CI support for cxx not just cplusplus.
2018-07-28 19:37:19 -07:00
Vlad Brezae 59ffd2a154 [interp] Overflow fixes (#9688)
* [interp] Fix some conv ovf opcodes

* [interp] Correctly hande a few conv ovf cases

For conversion from unsigned value to i1 and i2.

* [interp] Fix multiplication overflow case

* [interp] Remove some constants from code
2018-07-28 23:15:38 +03:00
Jay Krell 884318b119 Use correct domain (so far no difference), thanks @alexischr. (#9784) 2018-07-27 19:22:18 -04:00
Alexis Christoforides a1a862c6b8 Fix typo 2018-07-27 19:01:19 -04:00
Alexander Köplinger 3bc7b23991 Update csproj 2018-07-28 00:00:48 +02:00
Martin Baulig 8599ba81b4 Use System.Security.Policy.Publisher from corefx (they essentially stubbed it out). (#9749)
* Use System.Security.Policy.Publisher from corefx (they essentially stubbed it out).

Fixes the XUnit 2.4 problem.

* Use `PublisherMembershipCondition` from CoreFX as well (stubbed out in there) and remove the tests.

* Bump API snapshot submodule
2018-07-27 17:43:53 -04:00
Jay Krell 159ae220cb [Coop] Convert ves_icall_System_Reflection_Module_ResolveStringToken. (#9743)
* [Coop] Convert ves_icall_System_Reflection_Module_ResolveStringToken.
2018-07-27 17:02:22 -04:00
Jay Krell f52f29e414 [cxx] Convert interpreter. 2018-07-27 17:00:39 -04:00
Jay Krell f8d2ba16cb [cxx] Convert debugger-agent.c. 2018-07-27 16:59:44 -04:00
Jay Krell 4e65282549 [cxx] Make debugger-engine.c valid C++. 2018-07-27 16:58:38 -04:00
Jay Krell 7d7df57359 [cxx] C++ deprecates the "register" keyword. 2018-07-27 16:58:14 -04:00
Jay Krell 5157357118 [cxx] C++ does not have designated initializers.
Current clang supports them, current g++ has partial support, Centos6 g++ 4.4 has no support.
2018-07-27 16:58:14 -04:00
Jay Krell 9bafdc2f70 [cxx] C++11 needs spaces around string pieces to disambiguate from user defined literals.
Or at least on one side but we do both for clarity.
e.g. #define PRIdMAX "lld" (inttypes.h)
123"PRIdMAX"345" should be instead "123" PRIdMAX "345"
2018-07-27 16:58:14 -04:00
Jay Krell 5dfba39bfb Revert "[System.Native] Build a reduced library on Android and iOS"
This reverts commit 1e9be63015.

It doesn't appear to been run through CI and does appear to be breaking things.
https://github.com/mono/mono/issues/9776
2018-07-27 16:39:10 -04:00
Jonathan Chambers daabbbdd8b Fix copy/paste error. Use size parameter for non-moving GC allocation. Remove return statements from void function to silence warnings. 2018-07-27 04:04:04 -04:00
Alexis Christoforides 1e9be63015 [System.Native] Build a reduced library on Android and iOS 2018-07-27 03:38:43 -04:00
Jay Krell 889132b92c [Coop] A bunch of nohandles(). (#9738)
* [Coop] System.IO mark all remaining NOHANDLES().

* Functions take no parameters, not any parameters -- () vs. (void).

* [Coop] Mark System.Threading.Interlocked as mostly NOHANDLES().

* [Coop] ves_icall_System_Threading_Thread_MemoryBarrier is NOHANDLES().

* [Coop] System.Threading volatile reads/writes are NOHANDLES().

* Make YieldInternal NOHANDLES and remove two potential layers.

* [Coop] Make ves_icall_System_Threading_Thread_current_lcid NOHANDLES().

* [Coop] mono_100ns_ticks nohandles.

* [Coop] More nohandles volatile reads/writes.

* [Coop] NOHANDLES() System.Security.SecurityManager.
2018-07-26 21:39:07 -07:00
Katelyn Gadd 0477219f83 Revert "Try moving gensources vars to rules.make"
This reverts commit 496f82e5dc55404b99c02d868ed2fb38ad96cf06.
2018-07-26 18:56:27 -07:00
Katelyn Gadd 2db6edfc3f Try moving gensources vars to rules.make 2018-07-26 18:56:27 -07:00
Katelyn Gadd 98a988d236 Checkpoint: Move vars to rules.make 2018-07-26 18:56:27 -07:00
Katelyn Gadd ba80716fea Remove debugging messages 2018-07-26 18:56:27 -07:00
Katelyn Gadd 39e4af0890 Fix mode damage 2018-07-26 18:56:27 -07:00
Katelyn Gadd b2b533726f Fix xtest gensources invocation 2018-07-26 18:56:27 -07:00
Katelyn Gadd 1d93f01279 Fix wrong logic for finding the right profiles/platforms folders 2018-07-26 18:56:27 -07:00
Katelyn Gadd 51b74cdf1c Fix build failure if gensources destination path doesn't exist yet by moving it to build. 2018-07-26 18:56:27 -07:00
Katelyn Gadd 919cf73b2e Checkpoint 2018-07-26 18:56:27 -07:00
Katelyn Gadd dddc0103df Checkpoint: Move gensources build to basic.make after profile check and invoke that version directly when we need gensources. 2018-07-26 18:56:27 -07:00
Katelyn Gadd 3895accf69 Handle extra whitespace in include directives 2018-07-26 18:56:27 -07:00
Katelyn Gadd be932c7f0c Get rid of duplicate definition warnings for the gensources rule 2018-07-26 18:56:27 -07:00
Katelyn Gadd 1de8387549 Ignore missing files/directories in exclusions lists since they are harmless errors 2018-07-26 18:56:27 -07:00
Katelyn Gadd 41767308c3 Remove invalid paths from exclusions files 2018-07-26 18:56:27 -07:00
Katelyn Gadd eeb704f5b6 Fix included sources files not inheriting overridden path directory 2018-07-26 18:56:27 -07:00
Katelyn Gadd 63addc8032 Handle invalid include paths. Resolve include paths relative to the .sources file even if source file names are relative to another folder. 2018-07-26 18:56:27 -07:00
Katelyn Gadd 6b1d35db42 Fix parse errors in GetRelativePath and add to the ErrorCount when one occurs so the build will fail 2018-07-26 18:56:27 -07:00
Katelyn Gadd 0e4f70a20d Workaround for gensources treating 0 result files as an error when we didn't load any non-empty sources files 2018-07-26 18:56:27 -07:00
Katelyn Gadd beb6154ef6 Remove missing directory from microsoft.csharp.dll.sources 2018-07-26 18:56:27 -07:00
Katelyn Gadd e26aebe038 Okay, xtests sources files ARE relative to their location 2018-07-26 18:56:27 -07:00
Katelyn Gadd 61ca83a82d Fix typo 2018-07-26 18:56:27 -07:00
Katelyn Gadd 82b2fc1f81 Bug fixes to gensources and the way tests.make invokes it. Compensate for the gross behavior where tests sources files are not relative to their location. 2018-07-26 18:56:27 -07:00
Katelyn Gadd 96e3d32fcf Checkpoint 2018-07-26 18:56:27 -07:00
Katelyn Gadd dbb41fb289 Checkpoint 2018-07-26 18:56:27 -07:00
Katelyn Gadd efc1615365 Checkpoint 2018-07-26 18:56:27 -07:00
Katelyn Gadd ca3f2cdaaf Manually specify the search directory for libraries when compiling gensources because it can't find it for some reason 2018-07-26 18:56:27 -07:00
Katelyn Gadd 8d5efd6f26 Checkpoint tests.make update to use gensources.exe 2018-07-26 18:56:27 -07:00
Jay Krell 2f7c939c08 [Coop] nohandles() System.Math and System.MathF. (#9741) 2018-07-26 17:55:27 -07:00
Zoltan Varga a5de555ef0 [runtime] Refactor cattr decoding. (#9724)
Return objects from load_cattr_value () using an additional out parameter. Add a variant of
mono_reflection_create_custom_attr_data_args () which can only decode a subset of cattr types, but
it doesn't allocate any objects. Use this in marshal.c/marshal-ilgen.c to avoid allocating objects
while decoding FixedBufferAttribute and UnmanagedFunctionPointerAttribute.
2018-07-26 20:47:19 -04:00
Vlad Brezae 573bf712c2 [interp] Improve icall perf (#9645)
* [interp] Refactor MINT_ICALL opcodes

Remove integer versions, since they add unnecessary complexity, and with some signatures we were already implicitly casting int to gpointer.

* [interp] Use fast versions for icalls

* [interp] Include more fast pinvoke/icall signatures

These cover almost all icalls

* [interp] Fix fast icall return value

The returned value needs to be converted to the stackval representation
2018-07-27 00:24:17 +03:00
monojenkins 329a8378fa [bcl] Update BCL Linked Size (#9747)
Size Diff: https://jenkins.mono-project.com/job/test-mono-mainline-bclsize/18/BCL_20Size_20Diff/

Commits since last update:

.NET 4.x: 8b25769...770ad9e
MonoTouch: 8b25769...770ad9e
MonoDroid: 8b25769...770ad9e
2018-07-26 16:53:44 +02:00
Alexander Köplinger bb4934b4dc [corlib] Bring back serialization ctors/methods for X509Certificate (#9745)
They were replaced with PNSE in https://github.com/mono/mono/pull/9650
but that broke xUnit 2.4.0.
2018-07-26 14:36:09 +02:00
Alexander Köplinger 9741a27caa [tests] Disable verbose.exe test on Windows
See https://github.com/mono/mono/issues/9739
2018-07-26 09:50:21 +02:00
Martin Baulig f97e990290 [corlib]: Cleanup X509Certificate implementation and sync it with CoreFx. (#9650)
* [corlib]: Cleanup `X509Certificate` implementation and sync it with CoreFX.

Completely refactored the `X509Certificate` implementation to make it based very closely on CoreFX.

We cannot fully switch to their implementation yet because we are missing things and they also have
a few issues in their implementation.  However, this will make it a lot easier to do this at a later time.

The internal `X509CertificateImpl` has been cleaned up as well, using properties instead of methods in
most places and the `ToString()` implementation is now shared between all platforms.

* `X509Certificate.CreateFromSignedFile()`: in CoreFX, this is the same as `CreateFromCertFile()`.
  Our old implementation was incomplete and did not verify the signature - we even had a test where
  loading a certificate with an invalid signature was supposed to work; this test has been disabled
  because we're now throwing an exception.

* `X509CertificateImpl.KeyAlgorithmParameters`: this is supposed to throw `CryptographicException`
  on error, see `Certificate13` in `X509CertificateTest.cs`.

* We now match CoreFX's behavior regarding serialization - while the `X509Certificate` type is still
  marked as `[Serializable]`, we now throw `PlatformNotSupportedException` when attempting to serialize
  or deserialize it.

* Bump API snapshot submodule

* [csproj] Update project files
2018-07-26 09:22:36 +02:00
Marek Safar 4160564aa5 [build] Update xunit to 2.4 version
This exposed few issue in CoreFX tests
2018-07-25 21:34:13 +02:00
Martin Baulig 0a5e437519 Move generated resource files from System and System.Security into corlib. (#9665)
* Make `corlib` internals visible to `System.Security` on all profiles, not just monotouch watch.
  
* Moves all generated `SR` files and their generation logic from `System` and `System.Security` into `corlib`.  Since `corlib` internals are visible to these assemblies, we don't need to duplicate the resource strings.

* Cleanup the `RESX_RESOURCE_STRING` is `corlib` and sort them alphabetically.

* Add the internal `Internal.Cryptography.Helpers` helper class from CoreFX to `corlib` (currently unused, but "Blue" will need it).
2018-07-25 12:06:24 +02:00
Marius Ungureanu 6b2eafc39d Fix up behaviour of verbose method with arguments (#9087)
* Fix up behaviour of verbose method with arguments

Given a method spec which looks like:
`MainClass:Do(int,int,int)`

Via f024e820a025aacc1cf80eb82a8aee4552c3ac11 the code would match 3 methods:
`MainClass:Do(int`, `int`, `int)`, crashing the runtime.

Accept the multiple method matches via `;`, rather than `,`.

Now, the behaviour is changed so:
`MainClass:Do(int,int,int);MainClass:Do(int,int)`

Get parsed as:
`MainClass:Do(int,int,int)`
`MainClass:Do(int,int)`

* Add tests

* add test file and make tests actually output something

* Smarter unit test around disassembling methods

* Try single quoting environment variable value

* Try using non-throwing setter
2018-07-25 11:16:17 +02:00
Egor Bogatov d065dc9292 Revert CharUnicodeInfo to reference-sources (Big Endian issue) (#9711)
Temporarily switch back to ref-source impl for `CharUnicodeInfo` which contains a few special BE patches while I am trying to upstream them.

Fixes #9684
2018-07-25 11:05:33 +02:00
Martin Baulig 422b283d7f [System]: Remove two X509Certificate2Test tests.
Both `Certificate_11_Properties` and `Certificate_14_Properties` use an invalid
certificate that violates X.690 11.8.2 (UTCTime under a DER encoding).

This will no longer be supported once we switch to CoreFX's PAL code.

See also https://github.com/dotnet/corefx/pull/31293.
2018-07-25 10:53:38 +02:00
Jay Krell 242d6f0e92 [Coop] Convert CreateProcess and ShellExecute. (#9699) 2018-07-25 00:07:28 -07:00
Jay Krell a49fd77be0 [Coop] NOHANDLES(ReleaseMutex_internal), remove some error_init, (#9704)
and clear last error in Win32 path like on Unix.
2018-07-25 00:06:21 -07:00
Jay Krell 07ab78056c NOHANDLES(ves_icall_Interop_Sys_DoubleToString) (#9702) 2018-07-24 22:07:47 +02:00
Jay Krell 49af3b8e92 Be sure always assign out parameter. (#9701) 2018-07-24 08:32:08 -07:00
Marek Safar 7a5bd99228 [runtime] Removes unused icalls 2018-07-24 17:24:51 +02:00
Aleksey Kliger 4c0d4e090d [coop] Define mono_threads_is_blocking_transition_enabled in terms of suspend policy
Instead of digging around in the environment for the coop and hybrid suspend
settings, define in terms of mono_threads_suspend_policy (or the
MONO_ENABLE_BLOCKING_TRANSITION env var as before).
2018-07-24 10:14:05 -04:00
Aleksey Kliger dd6a74f576 New MONO_THREADS_SUSPEND env var to select suspend policy
Set to one of "preemptive", "coop" or "hybrid".

Unlike the old MONO_ENABLE_COOP, MONO_ENABLE_COOP_SUSPEND,
MONO_ENABLE_HYBRID_SUSPEND, the value of MONO_THREADS_SUSPEND will take
priority over the configure flags default.

For compatability the old environment variables will be respected if neither
MONO_THREADS_SUSPEND nor a configure flag was set.  A warning will be emitted
if MONO_THREADS_SUSPEND isn't set.  (Rationale: maybe the environment set both
because they're not sure which version of Mono they will be running - so don't
nag them).
2018-07-24 10:14:05 -04:00
Aleksey Kliger 013ed6ebae [coop] Refactor suspend policy selection code
Untangle the configure-time and runtime suspend policy defaults.
2018-07-24 10:14:05 -04:00
monojenkins 8b25769304 [bcl] Update BCL Linked Size 2018-07-24 15:20:47 +02:00
Maxim Lipnin 6b73c01ab6 [System.Reflection] CoreFX import for set of simple types. (#9693)
Part of #9660.

The imported CoreFX types:
- AmbiguousMatchException
- AssemblyAlgorithmIdAttribute
- AssemblyCompanyAttribute
- AssemblyConfigurationAttribute
- AssemblyConfigurationAttribute
- AssemblyContentType
- AssemblyCopyrightAttribute
- AssemblyCultureAttribute
- AssemblyDefaultAliasAttribute
- AssemblyDelaySignAttribute
- AssemblyDescriptionAttribute
- AssemblyFileVersionAttribute
- AssemblyFlagsAttribute
- AssemblyInformationalVersionAttribute
- AssemblyKeyFileAttribute
- AssemblyKeyNameAttribute
- AssemblyMetadataAttribute
- AssemblyNameFlags
- AssemblyProductAttribute
- AssemblySignatureKeyAttribute
- AssemblyTitleAttribute
- AssemblyTrademarkAttribute
- AssemblyTrademarkAttribute
- AssemblyVersionAttribute
- BindingFlags
- CallingConventions
- CustomAttributeFormatException
- DefaultMemberAttribute
- EventAttributes
- FieldAttributes
- GenericParameterAttributes
- ICustomAttributeProvider
- ImageFileMachine
- InterfaceMapping
- IntrospectionExtensions
- InvalidFilterCriteriaException
- IReflect
- IReflectableType
- MemberFilter
- MemberTypes
- MethodAttributes
- MethodImplAttributes
- ObfuscateAssemblyAttribute
- ObfuscationAttribute
- ParameterAttributes
- ParameterModifier
- PortableExecutableKinds
- ProcessorArchitecture
- PropertyAttributes
- ReflectionContext
- ReflectionTypeLoadException
- ResourceAttributes
- TargetException
- TargetInvocationException
- TargetParameterCountException
- TypeAttributes
- TypeFilter
2018-07-24 14:33:59 +02:00
Filip Navara 0f0e31842f System.IO.Pipes from CoreFX (#9573)
Rework of #5448, contributes to #7143.

The anonymous pipes were tested on macOS, build was tested only on few configurations (hoping to solve some issue through Jenkins builds). Named pipe tests get stuck on macOS, but it may be unrelated Xunit issue and needs some proper debugging.

@Therzok, do you know of anything else that is missing for parallel MSBuild? Do you have some test environment for it by chance?
2018-07-24 10:19:18 +02:00
Jay Krell c8fb34d82a Remove excess code -- strings are already nul terminated. (#9697) 2018-07-23 19:01:38 -07:00
Jay Krell 045d5cbbfc Remove ves_icall_System_AppDomain_GetIDFromDomain. (#9674) 2018-07-23 13:29:34 -07:00
Marek Safar f07691d512 [mcs] Don't wrap exception expression in contextual return. Fixes #9505 2018-07-23 21:39:07 +02:00
Filip Navara abc66ce0e9 [MacOS] On Mac, use the copyfile API to copy files (#9642)
[MacOS] On Mac, use the copyfile API to copy files

Rebase of #9038 with added fix for the failing unit tests. Note that there's a race condition in the check between `source file == destination file` and the `copyfile` call, but a similar race condition already exists there in the current code except the outcome is different.
2018-07-23 11:55:05 -04:00
Martin Baulig eeb2802076 Use SafePasswordHandle in the internal certificate APIs. (#9651)
* `X509Helper`, `X509CertificateImpl`, `X509Certificate2Impl` and `ISystemCertificateProvider` now use `SafePasswordHandle` instead of strings.

* `X509Certificate`: actually implement `SecurePassword` based APIs using `SafePasswordHandle`.

* `mono_btls_pkcs12_import()`: when passed an empty password, try both the empty string and null.
2018-07-23 15:12:09 +02:00
Zoltan Varga f093a01b27 [runtime] Return the result properly from mono_exception_walk_trace (). (#9675)
[runtime] Return the result properly from mono_exception_walk_trace ().
2018-07-23 07:40:06 -04:00
monojenkins 495d581ff9 [bcl] Update BCL Linked Size (#9682) 2018-07-22 19:15:59 +02:00
Vlad Brezae e09d6902fa [interp] Don't throw exception on -1 division 2018-07-21 22:25:07 -04:00
Bernhard Urban 57a98c60dd address review feedback 2018-07-21 19:25:30 -04:00
Bernhard Urban e2ab85d9f1 [interp] add Span<T> intrinsics for get_Item and get_Length
similar to https://github.com/mono/mono/pull/9086/files#diff-89fe30e1e87c5db21be052ddb0c8e28dR183
2018-07-21 19:25:30 -04:00
Bernhard Urban 67f06053fc [mini] return gracefully from compile_special if a method can not be compiled
the caller will check `error` anyway. It allows the machinery to try the
interpreter instead.
2018-07-21 17:40:12 -04:00
Alexander Köplinger ea39bf883a [linker] Move BCL size diff to nightly job
It was too annoying on every PR
2018-07-21 03:01:15 +02:00
Egor Bogatov 2a4af93109 [corlib] CoreFX sources for System namespace (#8626)
Brings CoreFX and CoreRT sources for primitive types inside corlib (and other types under System namespace)

Part of #7737
2018-07-20 21:33:05 +02:00
Jay Krell 3780ac694d Update Windows requirement from Vista (6.0) to 7 (6.1). (#9568) 2018-07-20 21:15:32 +02:00
Martin Baulig 2123fa5872 [CI] Add corlib-btls step to run the X509Certificate tests in corlib with BTLS as well. (#9652)
After the dependency injector changes, the `X509Certificate` code in corlib now uses the implementation from `System.dll`, including the platform-specific switch via `MONO_TLS_PROVIDER` / `MonoTlsProviderFactory`.

This adds a new `X509Certificates2` category to the corlib tests and runs them with `MONO_TLS_PROVIDER=btls` on OS X (where the default is applets).
2018-07-20 20:29:45 +02:00
Maxim Lipnin 9139cf5359 Pkcs9SigningTime: normalize exceptions on windows file time < 1601 (#9628) 2018-07-20 20:13:42 +02:00
Jay Krell d5c7891dcc Add more build outputs to .gitignore. (#9655) 2018-07-20 19:50:56 +02:00
Jo Shields a778d216fa Merge pull request #9659 from directhex/fixdist
[System.XML] Include common.sources in the tarball
2018-07-20 11:43:58 -04:00
Jo Shields 64f58747c1 [System.XML] Include common.sources in the tarball 2018-07-20 10:30:23 -04:00
Bernhard Urban e359121b82 [interp] fix stack mismatch warning around ldlen and a C compiler warning (#9643)
* [interp] fix stack type warning around ldlen instruction

removes this warning in e.g. mcs-tests:

> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1
> Object.CallSite.Target: Store local stack type mismatch 0 1

* [interp] fix compiler warning around MINT_INTRINS_BYREFERENCE_CTOR

fixes those warnings:

> interp/interp.c:3924:13: warning: unused variable 'valuetype_this' [-Wunused-variable]
>                         stackval valuetype_this;
>                                  ^
> interp/interp.c:3926:13: warning: unused variable 'retval' [-Wunused-variable]
>                         stackval retval;
>                                  ^
> 2 warnings generated.
2018-07-20 15:39:59 +02:00
Zoltan Varga 61fe5ac0f7 [runtime] Run update_submodules.sh earlier.
Fixes https://github.com/mono/mono/issues/9421.
2018-07-20 08:00:26 +02:00
Martin Baulig 2b85b98e59 [sdks]: Call MonoTlsProviderFactory.Initialize() on test startup. (#9629)
Fixes #9623.
2018-07-20 02:53:46 +02:00
Egor Bogatov 95ea74ebdb [System.XML] xunit tests and trivial types from CoreFX (#9351)
Adds 1192 xunit tests for System.XML from CoreFX
Also, moves common lines from `mobile_System.Xml.sources` and `System.Xml.sources` to `common.sources`

Part of #8132
2018-07-20 02:10:02 +02:00
Jay Krell 57be17b069 Use __declspec(thread) with Visual C++, and __thread with Win32/gcc, (#9594)
* Use __declspec(thread) with Visual C++, and __thread with Win32/gcc,
instead of much slower TlsGetValue / TlsSetValue

* Avoid affecting Boehm.

* Replace HAVE_KW_THREAD and USE_KW_THREAD with MONO_KEYWORD_THREAD.
2018-07-19 09:09:11 -07:00
Martin Baulig f9040e5fb3 Refactor the AppleTls Certificate code into a PAL-based approach. (#9524)
* Refactor the AppleTls Certificate code into a PAL-based approach.

* Added the internal `SafeHandle` based classes from CoreFX's PAL:
  `SafeSecCertificateHandle`, `SafeSecIdentityHandle`, `SafeKeychainItemHandle`
  and `SafeSecKeyRefHandle`.

* Added a new static internal class `MonoCertificatePal`:

  - `Mono.AppleTls/MonoCertificatePal.cs` is shared between OS X and Mobile.
  - `Mono.AppleTls/MonoCertificatePal.OSX.cs` contains the OS X specific parts.
  - `Mono.AppleTls/MonoCertificatePal.Mobile.cs` contains the Mobile specific parts.

  This split allows us to avoid all the `MONOTOUCH` conditionals in the code.

* In the `Mono.AppleTls` directory, all code from `Certificate.cs`, `Items.cs` and
  `ImportExport.cs` have all been merged into the new `MonoCertificatePal` class.

* The entire AppleTls code is now using these safe handles instead of the old
  Mono-specific types.  This allows us to swap out the implementation of the certificate
  code with CoreFX's PAL code.

* Cleaned up and removed some ancient dead code.

* `build/profiles/build.make`: Don't set `MONO_FEATURE_APPLETLS` here.

* Add `appletls.sources` and cleanup `MONO_FEATURE_APPLETLS` conditionals.

* [csproj] Update project files
2018-07-19 11:51:01 -04:00
Marek Safar 8e2b79bfa8 Bump bockbuild (#9632) 2018-07-19 16:23:17 +02:00
Jay Krell aa48c759a9 Workaround broken AIX automake/autoconf/libtool/libstdc++. (#9571)
These programs work if you just compile them with g++ and most of the automake/autoconf/libtool
flags, but not if you use all of them. Something to do with search paths perhaps.
2018-07-19 13:51:56 +02:00
Bernhard Urban 083dd95a03 [TermInfo] fix reading integer value for new file format (#9520)
16bit vs. 32bit only applies for offsets, not for actual entries in the
file format.

Fixes https://github.com/mono/mono/issues/8340
2018-07-19 13:12:54 +02:00
Alexander Köplinger 885a7aaf4e [linker] Add BCL size regression testing (#9618)
* [linker] Add BCL size regression testing

We're now tracking the size of the BCL after it was processed by the linker
across various profiles we care about (currently net_4_x, monotouch and monodroid).

The way it works is that we keep a file with size measurements in the repo
and during CI we run the linker against the current state and compare.

Right now we're simply running the linker tests as they are a good approximation
of various usages (this PR additionally adds more comprehensive linker tests we had in XI).

If changes are found there's a report to check where the increase/decrease came from.
The changes can be applied via `@monojenkins commit sizediff` similar to
existing csproj and apidiff usages.

Fixes https://github.com/mono/mono/issues/6992

* Don't run new linker tests yet, just use for size checking
2018-07-19 12:15:17 +02:00
Marek Safar 9d4cdef669 [corlib] Moves private Debug class in mscorlib to System.Diagnostics namespace (#9572) 2018-07-19 10:15:26 +02:00
Marek Safar e410a74674 [System] Update mobile tests to reflect missing DesignerAttribute
Fixes #8407
2018-07-19 09:30:51 +02:00
Vlad Brezae d67d51a148 [interp] Remove unused code added recently 2018-07-18 21:10:08 -04:00
Vlad Brezae bfc30ff3cc [interp] Simplify call
Needed also for exception checking, which is done in the wrapper, instead of pinvoke interp code.
2018-07-18 21:10:08 -04:00
Vlad Brezae 73e2618480 [interp] Remove exception checking from pinvoke code
Exception checking is done by the m2n wrapper
2018-07-18 21:10:08 -04:00
Vlad Brezae 032402fe57 [interp] Fix stackframe iteration
Interp to managed are not real frames
2018-07-18 21:10:08 -04:00
Vlad Brezae 9708684081 [interp] Transform more calls in interp_transform_calls
This also includes m2n wrappers for icalls, which were missing and are needed (ex. for handle stack clearing)
2018-07-18 21:10:08 -04:00
Vlad Brezae cf40735ea2 [interp] Move MINT_CALLRUN emitting inside transform
Also optimize MINT_CALLRUN a bit
2018-07-18 21:10:08 -04:00
Vlad Brezae 92509c9a09 [interp] Extract some code from big function 2018-07-18 21:10:08 -04:00
Rodrigo Kumpera c40af43873 [wasm] Remove dead code and add fetch callback to mono_load_runtime_and_bcl. (#9402)
The mono_load_runtime_and_bcl allows upstream to remap requests and report download progress.

This cb semantics might change in the future when we implement more agressive loading.
2018-07-18 23:29:34 +02:00
Alexander Köplinger 2f5bfcd48c [genconsts] Fix PostBuildEvent
The Microsoft.CSharp.targets import needs to come before the PostBuildEvent,
otherwise TargetPath won't be set.
2018-07-18 21:58:44 +02:00
Aleksey Kliger (λgeek) 777b956a35 Add GC Unsafe thread state transitions to MONO_API functions - third batch (#9447)
* [runtime] MONO_API mono_thread_is_foreign needs GC Unsafe

* [runtime] MONO_API mono_signature_get_params_internal needs GC Unsafe

* [runtime] MONO_API mono_domain_foreach needs GC Unsafe

* [runtime] MONO_API mono_class_is_subclass_of needs GC Unsafe

* [runtime] MONO_API mono_domain_create_appdomain needs GC Unsafe

* [runtime] MONO_API mono_signature_get_return_type needs GC Unsafe

* [mini] MONO_API mono_jit_exec needs GC Unsafe

* [mini] MONO_API mono_jit_cleanup needs GC Unsafe

* [runtime] MONO_API mono_class_get_type needs GC Unsafe

  Switch runtime to call m_class_get_byval_arg almost everywhere.

  The one holdout is MONO_CLASS_IS_INTERFACE which is difficult to fix up since
  it's in a public header

* [runtime] MONO_API mono_domain_from_appdomain needs GC Unsafe

* [runtime] MONO_API mono_domain_get_by_id needs GC Unsafe

* [runtime] MONO_API mono_domain_unload needs GC Unsafe

* [runtime] MONO_API mono_exception_from_name_msg needs GC Unsafe

  Since it takes a callback, switch to GC Safe when calling the callback.

  In the callback that's used in the runtime, switch back to GC Unsafe.

* [runtime] MONO_API mono_debug_open_image_from_memory needs GC Unsafe

* [runtime] MONO_API mono_dl_fallback_register needs GC Unsafe
2018-07-18 14:12:55 -04:00
Alexander Kyte 1eccdb6b07 [runtime] Make sigterm dumper send file to merp (#9607) 2018-07-18 11:44:12 -04:00
mathieubourgeois d307070057 Fix LogcatTextWriter_Log interpreting messages it logs, potentially writing random garbage and/or crashing (#9606)
(introduced by https://github.com/mono/mono/commit/984f6484666c2ee6fefec949c81fdff1189c9488)
(Fixes https://github.com/xamarin/xamarin-android/issues/1951)
2018-07-18 11:40:52 -04:00
Aleksey Kliger (λgeek) b26b70d7f5 [checked,coop] Use unbalanced thread state transitions in mono_threads_attach_coop (#9502)
The `mono_threads_attach_coop` / `mono_threads_detach_coop` icalls are called
from the wrapper around managed methods that will be called from native code
`emit_managed_wrapper_ilgen`.

If the managed method throws an exception, the mono_threads_detach_coop will
not be called, and the checked build
`mono_threads_enter_gc_unsafe_region_internal`/`mono_threads_exit_gc_unsafe_region_internal`
accounting will be mis-matched which will break later checked mode checks.

(The unbalanced thread state transition is not a problem - the next outermost
exit_gc_unsafe will operate just fine - it's just the checked mode check that's
wrong)

Once we lost the try/finally in b20d5ce1e5 these
should have become unbalanced.
2018-07-18 11:31:21 -04:00
Jay Krell ffe4e3f787 [Coop] Convert 3 more functions and strengthen some types to be not just gpointer. (#9595)
* [Coop] Convert 3 more functions and strengthen some types to be not just gpointer.
i.e. to see in debugger and for static type checking

* ves_* probably shall not call ves_*.
non-ves_* (mono_*) really shall not call ves_*.
Only C#/icall-def.h shall call ves_*, and only ves_*.

Where there is a contradiction, rename ves_* to mono_*,
have ves_* and mono_* call mono_*, and possibly cleanup.
For example, removing MonoError* parameter, and moving asserts
around to preserve or improve semantics.

* Remove incorrect comment.
2018-07-17 23:29:14 -07:00
Maxim Lipnin 93f257f914 ProtectedData: enable CoreFX xunit tests (#9605)
* ProtectedData: enable CoreFX xunit tests

* Update CoreFX submodule
2018-07-18 05:12:46 +02:00
Jay Krell dd64aad839 Fix infinite loops introduced in 18b6846a3a. (#9583)
* Fix infinite loop introduced in 18b6846a3a.

* Fix another infinite loop.
2018-07-18 02:05:27 +02:00
Katelyn Gadd 5ff02dd3bf Auto-generate Consts.cs on Windows when building from Visual Studio (#9598)
This adds a simple script for generating Consts.cs that can run on Windows, and makes it a dependency of corlib.csproj in the BCL solution file. From my initial testing this will autogenerate Consts.cs if it's missing and then corlib will successfully build.
This (mostly?) addresses issue https://github.com/mono/mono/issues/6886.

This currently has an awkward dependency on ```winsetup.bat``` and I modified it slightly to make it clearer whether the batch file succeeded.
2018-07-18 02:04:42 +02:00
Matthew Leibowitz c7ceb8f1e1 Add support for an output path in mono-api-diff (#9556)
Rather than always writing to the std out, provide an option to write to a file. This makes things easier for tooling by not requiring `RedirectStandardOutput = true`
2018-07-17 22:30:40 +02:00
Jay Krell d7a879e3e5 [Coop] Mostly convert System.GC and System.Runtime.InteropServices.GC.Handle. (#9552) 2018-07-17 13:07:04 -07:00
Jay Krell 8a04767577 Remove unsafe accidentally added in 18b6846a3a. (#9597) 2018-07-17 15:28:27 -04:00
Jay Krell fa8df62051 [Coop] Remove unused mono_object_to_string_checked. (#9596) 2018-07-17 15:27:44 -04:00
Alexis Christoforides 4c8d3505ed Merge pull request #9472 from baulig/work-dependency-injector
Introducing a general-purpose dependency injector to use `System` code from within `corlib`.
2018-07-17 14:51:17 -04:00
Michael DeRoy 597838a061 fix issue where unspecified address family has no addresses 2018-07-17 19:13:58 +02:00
Marek Safar d0fa02e1c0 [mcs] Add parsing for readonly argument modifier 2018-07-17 10:45:36 +02:00
Jay Krell d928987453 Put back loop from before 18b6846a3a, (#9564)
eliminating the coop handle creation it was avoiding.
2018-07-16 23:26:50 -07:00
Martin Baulig 55e456e35c Put back obsolete X509Helper2 code that is still in use by the legacy implementation. 2018-07-16 17:39:38 -04:00
Alexis Christoforides 0d54afd932 Merge pull request #9585 from directhex/makedist
Ensure tailcall tests are in `make dist` tarballs
2018-07-16 17:06:53 -04:00
monojenkins 8874f5ae19 [csproj] Update project files 2018-07-16 20:42:40 +00:00
Vlad Brezae cf0895fbb9 [interp] Delegate fixes (#9409)
* [interp] Check delegates for null this

* [interp] Resolve target method for delegates created with abstract methods

* [interp] Fix delegate invocation

Previously, when first calling the Invoke method on a delegate we would silently transform the delegate invoke wrapper of the delegate on which Invoke is called, after which all calls would go through this method. This is problematic because the same Invoke method can be called on a different delegate afterwards (the delegate_invoke wrapper needs to be tied to the delegate and it's not global for all invokes of same type),

We solve this by storing the invoke method in the delegate, similarly to the JIT.

* [interp] Remove unused argument
2018-07-16 22:33:22 +03:00
Jo Shields 42b626ee55 Ensure tailcall tests are in make dist tarballs
Fixes https://jenkins.mono-project.com/view/Releases/job/ng-release-generate-rpm-packages/661/console
2018-07-16 15:26:37 -04:00
Jo Shields 6e3a53afb9 Ensure tailcall tests are in make dist tarballs
Fixes https://jenkins.mono-project.com/view/Releases/job/ng-release-generate-rpm-packages/661/console
2018-07-16 14:12:03 -04:00
Martin Baulig 86e8ebb9fe Merge branch 'master' into work-dependency-injector 2018-07-16 13:05:14 -04:00
Alexis Christoforides ad58922de0 Bump corlib counter for https://github.com/mono/mono/pull/7255 2018-07-16 11:06:06 -04:00
Alexis Christoforides 5dd5a698ab [System.IO][runtime] Import INotify CoreFX FileSystemWatcher
Android continues to use the old FSW until https://github.com/mono/mono/pull/9575 lands
2018-07-16 09:36:21 -04:00
Zoltan Varga 7275ffc4d4 [llvm] Avoid using the preserveall calling convention in another place on watchos. (#9518)
[llvm] Avoid using the preserveall calling convention in another plac…

…e on watchos.

Fixes https://github.com/mono/mono/issues/9318.



<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-07-16 08:10:28 -04:00
Marek Safar 1d5a85215f [build] Bump mcs bootstrap version 2018-07-16 13:19:00 +02:00
monojenkins 68f1ab32ce [csproj] Update project files 2018-07-16 07:13:38 -04:00
Alexis Christoforides f857b886cd [marshal] Adjust check for GC Safe mode for mono_marshal_set_last_error()
The requirement applies only to the Windows version of the function which has an API call.
2018-07-16 07:13:38 -04:00
Alexis Christoforides 686e423320 [System.IO][runtime] Import INotify CoreFX FileSystemWatcher
System.Native icalls now live in metadata/pal-icalls.c|h
2018-07-16 07:13:38 -04:00
Maxim Lipnin b5071e868d CoreFX import for Pkcs9SigningTime type (#9236)
as part of #7589
2018-07-16 10:44:30 +02:00
Marek Safar e8539d62c1 [corlib] Use String from CoreCLR (#9134)
* [corlib] Use String from CoreCLR

* Bump API snapshot submodule

* [csproj] Update project files
2018-07-15 23:26:52 +02:00
Matthew Leibowitz 5f11f0dc64 [mono-api-diff] Moved mono-api-diff into its own tools directory (#9563)
* [mono-api-diff] Moved mono-api-diff into its own tools directory

* [mono-api-diff] Making the requested changes
2018-07-15 22:33:51 +02:00
Marek Safar f1b677f85b [System.Data] Add missing API in PNS version of SqlConnection 2018-07-15 22:24:00 +02:00
monojenkins 4660b820c2 [csproj] Update project files 2018-07-15 10:45:41 +02:00
Filip Navara 789e82149d Use SignedXml directly from CoreFX repository. 2018-07-15 10:45:41 +02:00
Jay Krell 16cfbbf70f [Coop] Partially convert System.Array. (#9430)
Generate similar array-coop*.cs files from pieces.
System.Array icall logging/testing tweaks.
Add const, but only in comment.
[Coop] Convert ves_icall_System_Array_CreateInstanceImpl.
PR feedback: Don't have icall call icall, refactor into common helper instead.
Add more disabled printing.

test_get_generic_value fails even CI JIT due to AOT runtime,
but does work with full JIT configuration.

Generic ref/out parameters are not supported by HANDLES(), so
	NOHANDLES(SetGenericValueImpl)
	NOHANDLES(GetGenericValueImpl)
	Also add MONO_REQ_GC_UNSAFE_MODE because of unsafe gpointer value (which reinforces NOHANDLES?)

Remove extra evaluation of arg.
2018-07-14 18:17:07 -07:00
Jay Krell 4effed5643 [tailcall] Split up large tests for fine grained enable/disable, instead of large scale disable (F# and interface). (#9316)
Enable 3 more tailcall tests on x86.

Enable more tailcall AOT tests.

Program to split fsharp-deeptail.il into separate tests.

Split up F# test into individual tests.

Simplify test IL and make it stack overflow upon failure.

Cleanup test code before splitting.

Program to split tailcall-interface-conservestack into separate tests.

Enable split up versions of tailcall-interface-conservestack  and F#.

There is a problem in that we use gsharedvt unexpectedly, and gsharedvt
has almost-fundament contradiction with tailcall.
Need to figure out why it used, if that is correct.

Disable some FullAOT tests that are broken by gsharedvt.

Lower apparent memory use.

Move tests into directories and reset disabled lists.

Centralize tailcall debug helpers.

Add comments why test_virt.exe fails on 32bit x86.

Remove tail. prefixes that are besides the point, and add noise to the logging.

Print more in failure.

Better align the stack for x86, so tests pass.
There were already tailcalling and conserving stack, but still using a little stack.
Real world code will use zero or a little. The test self-check is very strict
and wants zero, and prints how much.

Rename duplicate tests, and sort them.
Otherwise we were missing split tests.

Add 96 ARM failures and 30 FullAOT failures, mostly all understood.
ARM cannot pass extra parameter in a tailcall (except bitcode that we do not fix).
FullAOT uses gsharedvt a lot even for statically discovered types created, due to
interface and virtual.

Convert to C++98 and fix warnings about /* in //

Split the tests up in the build instead of ad hoc by developer.

Disable tests on wasm and win32 (and cross) due to build problem.
2018-07-14 14:35:03 -07:00
Zoltan Varga fcb0ebe1d1 [sdb] Add back the mono_debugger_agent_parse_options () API function which was mistakenly removed by #7673. 2018-07-14 20:35:16 +02:00
Jay Krell 18b6846a3a [Coop] Cominterop and marshal conversion. (#9503)
* [Coop] Convert ves_icall_System_Runtime_InteropServices_Marshal_IsComObject.

* [Coop] cominterop and marshalling partial conversion and cleanup.

* Some refinement/correction/commenting to mono_string_to_utf8str_handle.

* Fix index out of bounds.

* Fix error handling.

* Remove some mono_error_set_pending_exception.

* Fix icall interface -- string vs. ptr/len.

* tweaks

* Restore the corlib interface, and maybe address the apidiff gate.

* cleanup

* Fix PtrToStructure GC assertion failure tests/marshal2 interpreter.

* Fix merge.

* Revert "Restore the corlib interface, and maybe address the apidiff gate."

This reverts commit ca8456a05f75f0fc05f6559e2f075e18a455a362.

* Try harder to support fixed in array copying.

* Allow for overlap.

* Put mono_ in front of type and fix Windows.

* Fix small problems on Windows build.

* Fix Windows and support larger data.

* [arm64] Make OP_CHECK_THIS read only a byte, to prevent unaligned access errors.

* Bump corlib higher.

* Merge with https://github.com/mono/mono/pull/9430/files.

* Bump API snapshot submodule
2018-07-14 20:04:59 +02:00
Michael DeRoy 70f8348cb7 Fix DriveInfo.IsReady always returning true (#9521)
* Fix monoTODO where driveinfo.IsReady is unimplemented

* Bump API snapshot submodule
2018-07-14 13:36:55 +02:00
Jb Evain 0f87948a68 [mcs] Constrain expression bodied accessors to C# 7 (#9547)
* [mcs] Expression body for accessors are a C# 7 feature

* [mcs] Add tests for constraining expression accessors to C# 7
2018-07-14 13:32:26 +02:00
Marek Safar ff26178dd6 [corlib] Include all span helpers optimizations (#9548)
* [corlib] Include all span helpers optimizations

* [csproj] Update project files
2018-07-14 13:29:53 +02:00
Filip Navara 94dc6098e3 System.Core: Use ECCurve & friends from CoreFX. (#9536)
* Use ECCurve & friends from CoreFX.

* [csproj] Update project files

* Bump API snapshot submodule
2018-07-14 10:41:55 +02:00
Zoltan Varga 9739a5d92e [arm64] Make OP_CHECK_THIS read only a byte, to prevent unaligned access errors. (#9543) 2018-07-14 02:08:03 +02:00
Maxim Lipnin 7c3304b529 CoreFX import for AlgorithmIdentifier type (#9500)
* bump CoreFX

* CoreFX import for AlgorithmIdentifier type

* Update CoreFX submodule

* [csproj] Update project files
2018-07-13 22:46:50 +02:00
Martin Baulig 954d69cac3 Fix lock. 2018-07-13 16:23:48 -04:00
Alexander Kyte 00740735f5 [runtime] Disable debugger state machine temporarily, takes lock (#9538)
See https://github.com/mono/mono/issues/9531
2018-07-13 22:04:50 +02:00
Alexander Kyte b42ff128c4 Merge pull request #8548 from alexanderkyte/pmip_line_number
[runtime] Add file and line number to mono_pmip
2018-07-13 14:59:08 -04:00
Jay Krell 6d797f1d7b Remove Vista support now that Unity has. (#9506) 2018-07-13 11:17:20 -07:00
Martin Baulig 5954fd904a Disable the (broken) X509CertificateTest.Certificate7 and add slightly modified version of it.
See the comment in the source code for details.
2018-07-12 20:00:50 -04:00
Martin Baulig 2a36275383 Bump corlib version. 2018-07-12 14:02:47 -04:00
Jay Krell 0d191ef1ab Cominterop cleanup ahead of coop conversion. (#9487)
* cominterop_get_interface(gboolean throw_exception) throw_exception is always true.

* Remove unused cominterop_get_hresult_for_exception.

* Guids are constant.

* Replace g_assert (mono_error_ok (error)) with mono_error_assert_ok (error).

* Move function name to start of line for grep ^foo.

* PR feedback: g_assert(ex)

* Cleanup cominterop_get_interface -- single point of exit, more canonical non-coop form,
assert error indicator equivalence.

* Cleanup cominterop_get_interface_checked: early return and assert equivalent error indicators.

* Combine two versions of mono_cominterop_init.

* g_new0 instead of g_new+memset

* Remove obviously redundantly error_init.

* Inline cominterop_get_idispatch_for_object into its only caller ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal,
and make it a more coop-friendly.

* add const

* Combine forks of some functions and ifdef out more on Win32.

* Initialize with declaration.

* Use integers for sizes, not pointers.

* More asserts though redundant.

* Combine two forks of mono_marshal_safearray_set_value.
2018-07-12 10:43:53 -07:00
Martin Baulig e54c03a5ec Make X509Certificate(IntPtr) throw PlatformNotSupportedException on all platforms. 2018-07-12 13:28:40 -04:00
Martin Baulig 7ba77b1d9f Make it work with FullAOT. 2018-07-12 13:28:40 -04:00
Martin Baulig 23a209198b Introducing a general-purpose dependency injector to use System code from within corlib.
Dependency Injector
===================

* `corlib/Mono/DependencyInjector.cs`: this is corlib's entry point.

* `corlib/Mono/ISystemDependencyProvider.cs`: this interface is implemented in `System.dll`.

* `System/Mono/SystemDependencyProvider.cs`: the `System.dll` side of it.

To use this, we need to call `SystemDependencyProvider.Initialize()` during system startup on Mobile
(this is already done for Android, but still needs to be done for XI/XM).

For Desktop, this will be triggered by a few `System.dll` based APIs such as for instance `SslStream`
or `X509Certificate2` - and the corlib side can use reflection if needed.

The corlib side should use `DependencyInjector.GetSystemDependency()`.

X509Certificate - corlib side
=============================

We previously had a mechanic called `INativeCertificateHelper` (which unfortunately was not really
working as intended) to use the BTLS code (which lives in System) in corlib.  This has now been
replaced to use the new dependency injector.

The actual implementation as well as all the platform conditionals have now been moved into `System.dll`
where they can take advantage of existing PAL code.

This also removes all `Mono.Security.X509` usage from the `System.Security.Cryptography.X509Certificates`
namespace (it is still used by some of the other crypto classes, so we can't remove it yet).

* `Mono/ISystemCertificateProvider.cs`: this interface is now hooked up via the new
  dependency injector and replaces `INativeCertificateHelper`.

* `System.Security.Cryptography.X509Certificates/X509Helper.cs`: this file has been completely
  reworked and is now just a tiny stub around `ISystemCertificateProvider` and will eventually go
  away completely.  The entire implementation has been moved into `System.dll`.

* `System.Security.Cryptography.X509Certificates/X509CertificateImplMono.cs`: removed, we now use
  `X509Certificate2ImplMono` from System via `ISystemCertificateProvider`.

* `System.Security.Cryptography.X509Certificates/X509CertificateImplApple.cs`: moved into `System.dll`
  and slightly reworked there.

* `System.Security.Cryptography.X509Certificates/X509Helper.Apple.cs`: removed, we do not have any
  platform-specific code here anymore; the new `ISystemCertificateProvider` provides this for us.

X509Certificate - System side
=============================

The actual implementation as well as all the platform-specific code now lives in `System.dll`.

* `Mono/SystemCertificateProvider.cs`: the `System.dll` implementation of `ISystemCertificateProvider`.
  We do the platform / TLS Provider checks in here, then construct a custom PAL class.

* `Mono/X509Pal.cs`: New internal static class.

* `Mono/X509PalImpl.cs`: New abstract internal class.  It contains some common code, including the
  fallback implementation.

* `Mono/X509PalImpl.Mono.cs`: Fallback PAL, used by platforms without SslStream / MonoTlsProvider.

* `Mono.Btls/X509PalImpl.Btls.cs`: BTLS implementation.

* `Mono.AppleTls/X509PalImpl.Apple.cs`: We are using the `MONO_FEATURE_APPLE_X509` conditional in
  here, so it can be used without the actual Apple TLS code.

* `Mono.AppleTls/X509CertificateImplApple.cs`: moved here from corlib.

* `Mono.AppleTls/*.cs`: Use the `X509CertificateImplApple(IntPtr)` constructor everywhere instead of
  `X509Certificate(IntPtr)` to make sure we are using the "correct" PAL.
2018-07-12 13:28:40 -04:00
Martin Baulig 7394cfaa25 Throw CryptographicException instead of MonoBtlsException. (#9504) 2018-07-12 19:17:51 +02:00
Martin Baulig 9bb4b379f4 [System]: Fix mono_btls_x509_get_public_key() implementation. (#9488)
* [System]: Fix `mono_btls_x509_get_public_key()` implementation.

* Copy corlib's `X509CertificateTest.Certificate8` into System, call it
  `Corlib_Test_Certificate8` and use `X509Certificate2`.

The test in corlib does not expose the problem because it would use the
fallback implementation.

* Use `[SetCulture ("")]` as suggested by Marek.
2018-07-12 19:17:13 +02:00
Martin Baulig e8a15b36cd [corlib]: Bring SafePasswordHandle from CoreFX. (#9468)
Part of #9416
2018-07-12 19:14:44 +02:00
Johan Lorensson 01f00d2623 Merge pull request #9457 from lateralusX/lateralusX/windows-x64-enable-simd
Enable SIMD optimization on Windows x64.
2018-07-12 14:59:21 +02:00
Bernhard Urban 6fbe35f6b6 [interp] fix class accessor 2018-07-12 12:12:40 +02:00
Bernhard Urban 79b383d100 [sdks] add interp-mixed to iOS SDK
AOT compile mscorlib, everything else runs in the interpreter
2018-07-12 12:12:40 +02:00
Marek Safar 262c5f40cb [corlib] Default to fast Span<T> (#9204)
Part of #7249
2018-07-12 10:15:07 +02:00
Jay Krell 493153ff02 Avoid thread local access in non-error case. (#9494) 2018-07-11 18:55:31 -07:00
Jay Krell 06f977ae9c Fix race conditions in init_com_provider_ms. (#9491) 2018-07-11 13:31:59 -07:00
Alexis Christoforides 270368fbed Merge pull request #9481 from alexanderkyte/app_param_merp
[runtime] Enable application to register path for MERP restart
2018-07-11 14:10:29 -04:00
Atsushi Eno 52dccf8c79 [sdk] Do not fix android platform-tools version. Make it configurable. 2018-07-11 19:43:01 +02:00
Vlad Brezae 5654522446 [coop] Fix MONO_HANDLE_TRACK_OWNER build (#9489)
[coop] Fix MONO_HANDLE_TRACK_OWNER build


<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-07-11 10:55:20 -04:00
Marek Safar 2a33d61581 [mcs] Implements awaited expression check for indirections 2018-07-11 13:31:30 +02:00
Bernhard Urban be695bc530 [sdks] bump timeout for builds on CI 2018-07-11 13:30:37 +02:00
Bernhard Urban bd239a8fa3 [sdks] build more runtimes, simulators and cross compilers on CI 2018-07-11 06:40:38 -04:00
Bernhard Urban 18e2efaf3e [crashing] fix watchos build regression
move functions which were behind ifdef for watchOS. introduced by
2a8fcbd9fe
2018-07-11 06:40:38 -04:00
Bernhard Urban 11f8956ada [bitcode] fix build regression of tvos and watchos
caused by 5e9af502c0
2018-07-11 06:40:38 -04:00
Alexander Schulz 491fa4d50d Return filled FormattedValueType instead of null 2018-07-11 10:53:26 +02:00
monojenkins 6ec6e1c397 [csproj] Update project files 2018-07-11 10:48:54 +02:00
Filip Navara e3f5739589 Fix typo. 2018-07-11 10:48:54 +02:00
Filip Navara 0ef368d868 Bump corefx. 2018-07-11 10:48:54 +02:00
Bernhard Urban a0d0af6d39 [ios sdk] add interp-only support (#9427)
[ios sdk] add interp-only support

depends on https://github.com/mono/mono/pull/9295

should be backported to `2018-06`
2018-07-10 17:49:51 -04:00
Alexander Kyte 720788998d [runtime] Enable application to register path for MERP restart 2018-07-10 13:44:15 -04:00
Jo Shields eb972950c1 Merge pull request #9460 from directhex/fix-llvm-out-of-tree-tarballs
Include build_llvm_config.sh in tarballs
2018-07-10 13:38:10 -04:00
Alexander Kyte 4b3fcbaf4a Merge pull request #9450 from alexanderkyte/merp_enum_param
[runtime] Make merp eventType icall argument
2018-07-10 12:06:55 -04:00
Jay Krell a76bc3a13b Better error reporting in mkbundle, i.e. https://github.com/mono/mono/issues/8225 (#8876)
* Better error reporting in mkbundle, i.e. https://github.com/mono/mono/issues/8225

* Combine desktop and UWP mmap implementation.
2018-07-10 08:19:03 -07:00
Marc-Andre Ferland 4cc26e90fa [corlib] Additional HashAlgorithm tests
Originated from PR #1283, they now pass because we're using referencesource
code for the hash algorithm classes now.

In RSAPKCS1SignatureDeformatterTest.cs we weren't testing against the
actual `badSignature` (it doesn't make a difference since the referencesource
code or .NET Framework throws NullReferenceException anyway, but is more correct).

Closes #1283
2018-07-10 15:26:11 +02:00
monojenkins 2a94e6ade9 [csproj] Update project files 2018-07-10 10:37:49 +02:00
monojenkins a40c4f8c44 Bump API snapshot submodule 2018-07-10 10:37:49 +02:00
Martin Baulig 256a6c45ec [corlib]: Enable HashCode in all profiles.
* `HashCode` is now enabled in all profiles.

* Added `RNGCryptoServiceProvider` based fallback implementation.

* Added internal `RNGCryptoServiceProvider.GetRandom(byte*,IntPtr)` overload.

* The fallback implementation is enabled by default in `corlib.dll.sources`,
  platforms which provide a native implementation need to add it to their
  `.exclude.sources`.
2018-07-10 10:37:49 +02:00
Aleksey Kliger (λgeek) c3e4cac52c [runtime] Print tids in hex in mono_threads_summarize (#9469)
[runtime] Print tids in hex in mono_threads_summarize

Match the rest of our debug output that prints MonoNativeThreadId in hex
2018-07-10 04:25:12 -04:00
Zoltan Varga a25830c650 [sdb] Avoid calling vm.GetThread () in the event callback, it could call into the debuggee leading to a deadlock if the thread mirror object has not been created yet. (#9411)
[sdb] Avoid calling vm.GetThread () in the event callback, it could c…

…all into the debuggee leading to a deadlock if the thread mirror object has not been created yet.



<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-07-10 01:10:10 -04:00
Vlad Brezae 4cc990579b [interp] fullaotmixedcheck fixes (#9461)
[interp] fullaotmixedcheck fixes


<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-07-10 00:10:19 -04:00
Jay Krell ef23a0655e Slightly reduce sensitivity to thread local win32 last error. (#9379)
It is too easily trashed, e.g. by mono_thread_info_uninstall_interrupt.

See https://github.com/mono/mono/pull/9104.
See https://github.com/Unity-Technologies/mono/commit/b6f1ba89f7ab285a0990e696e78798f7cf18dafb
Which this should be an alterate fix for, as discussed in 9104.

This is a small change, but ultimately we should be able to thread
gint32 *win32error around enough, such as to eliminate the thread local on Unix.
It doesn't appear to take much. Thread locals, it turns out, are not a good mechanism.
They are sensitive to loss as addressed here. They are slower to access than regular globals
or locals. They do have the advantage of "automatic threading through a callgraph", as long
as you are very careful with their use (this PR demonstrates that problem).

As well we could/should move the GetLastError calls down one layer on Win32,
from w32file.c to w32file-win32.c.

But this change addresses only ReadFile/WriteFile.

Also remove unnecessary void** vs. void* cast.
Also combine Unix mono_w32file_read and mono_w32file_write.
2018-07-09 14:21:33 -07:00
Jay Krell b1487b6116 Remove unused ves_icall_System_Array_CreateInstanceImpl64. (#9435)
* ves_icall_System_Array_CreateInstanceImpl64 appears to be unused.

* Remove ves_icall_System_Array_CreateInstanceImpl64 further.
2018-07-09 16:37:55 -04:00
Alexander Kyte f477da4bf7 Merge pull request #9401 from alexanderkyte/generalized_flight
[runtime] Create flight recorder logger backend
2018-07-09 16:19:43 -04:00
Rodrigo Kumpera f01271f20c [interp] Use _fast variants of array functions are the former because tons slower for being part of the runtime API. (#9433)
[interp] Use _fast variants of array functions are the former because tons slower for being part of the runtime API.
2018-07-09 14:25:26 -04:00
Bernhard Urban 6062fa39c3 [mini] make interp work with AOT image generated with aot=interp (#9295)
[mini] make interp work with AOT image generated with aot=interp

[aot-compiler] use mono_aot_mode_is_interp instead of directly using the flag

---------
[interp] add FULL_AOT flags to AOT image when `--aot=interp` is used

fixes regression from 67e995c6e2

---------
partial forward port of https://github.com/mono/mono/pull/9266

needs backporting to `2018-06`
2018-07-09 13:10:21 -04:00
Egor Bogatov dc56ae2acb Fix 9332 2018-07-09 18:52:23 +02:00
Filip Navara 5bc264ad33 System.Security: Fix unit tests to use SERIALNUMBER instead of OID.2.5.4.5. (#9453)
* Fix unit tests to use SERIALNUMBER instead of OID.2.5.4.5 in X.500 names. Modify the code to pass the tests.

* Add SERIALNUMBER for BTLS implementation.

* Fix one more place where SERIALNUMBER was not handled.
2018-07-09 17:49:27 +02:00
Vlad Brezae 6e4419a063 [interp] Optimise allocation path (#9443)
[interp] Optimise allocation path

Speeds up allocation by 30-40%

<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-07-09 11:25:39 -04:00
Jo Shields cd08670432 Include build_llvm_config.sh in tarballs (Closes https://github.com/mono/mono/issues/9456) 2018-07-09 10:00:45 -04:00
Maxim Lipnin f602125d10 CoreFX import for ProtectedData type (Windows part) (#9375)
As part of #7589 

- CoreFX import only for Windows platform (no support for non-Windows platforms, see https://github.com/dotnet/corefx/issues/22510)
- left Mono managed implementation for non-Windows platforms
- removed DataProtectionScope parameter value check (no such a check in CoreFX and NET Framework, see https://github.com/dotnet/corefx/pull/30726) and couple of related unit tests
- added CoreFX xunit tests
2018-07-09 15:29:07 +02:00
lateralusX 8dd6baee6e Enable SIMD optimization on Windows x64.
When implementing Windows x64 valuetype ABI mono’s SIMD optimization didn’t
handle the case when passed arguments uses ArgValuetypeAddrInIReg/
ArgValuetypeAddrOnStack so optimization was disabled on Windows x64.

This commit fixes mono SIMD support for ABI’s passing value types using
ArgValuetypeAddrInIReg/ArgValuetypeAddrOnStack on Windows x64. It does this
as part of regular value type decomposition, including a pass decomposing SIMD
intrinsic ending up as arguments of type OP_ARG into correct load/store of the
value type reference before argument can be used by SIMD instructions.

All JIT and full AOT regression tests pass with enabled SIMD optimization
on Windows x64. Running this optimization on some vector intensive applications
showed some great performance increase. Just running this on basic-simd.exe
regression shows:

Elapsed time: 0.040471 secs (no optimizations at all)
Elapsed time: 0.015756 secs (only simd and intrins optimization)

So in this small, isolated test, the optimization indicates a 2.5x performance increase.
2018-07-09 13:52:28 +02:00
Zoltan Varga 998365ab3c [sdks] Remove obsolete ios/MonoTestRunner project. (#9428) 2018-07-07 23:07:41 -04:00
Jay Krell ec6c1090a5 [Coop] Partial conversion of COM interop. (#9431)
Partial conversion of COM interop.
Remove some error_init() calls.
2018-07-07 17:33:10 -07:00
Zoltan Varga a502768b3a [runtime] Map memory used by code managers with MAP_JIT on osx. (#9419)
* [runtime] Map memory used by code managers with MAP_JIT on osx.

* [runtime] Use MAP_JIT only on osx mojave and later, it seems to cause crashes on earlier versions.

* [runtime] Add a constant for darwin 18.

* [runtime] Fix the race in get_darwin_version ().

* Fix indentation.
2018-07-07 19:48:58 -04:00
Alexander Kyte ecede4942d [runtime] Enable flight recorder logger with MONO_LOG_DEST
- Also defaults to a LOG_LEVEL of warning when the user sets it.
2018-07-06 22:40:11 -04:00
Alexander Kyte db6f0f4616 [runtime] Move dropped message logging behind print 2018-07-06 22:40:10 -04:00
Alexander Kyte a767bff9dc [runtime] Move utility thread helpers into new header 2018-07-06 22:40:10 -04:00
Alexander Köplinger 9ba333126e Apply .csproj changes from https://github.com/mono/mono/pull/9432 2018-07-07 02:06:58 +02:00
Alexander Köplinger 2bf7320e56 [System] Add new .sources files to EXTRA_DIST 2018-07-07 02:05:36 +02:00
Johan Lorensson 99729bc0b3 Restructure NetworkInformation classes to avoid full AOT compile errors. (#9432)
When doing full AOT of System.dll on Windows and other platforms building
runtime without HOST_DARWIN or HOST_BSD we will get an ugly error,
but compilation will still succeed leaving the user confused around the result.

The following error is printed:

--------------------------------------

cant resolve internal call to
"System.Net.NetworkInformation.MacOsIPInterfaceProperties::ParseRouteInfo_internal"
(tested without signature also)

Your mono runtime and class libraries are out of sync.
The out of sync library is: C:\github\mono\msvc\build\fullaot\winaot\system.dll

When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
cant resolve internal call to
"System.Net.NetworkInformation.MacOsIPInterfaceProperties::ParseRouteInfo_internal"
(tested without signature also)

Your mono runtime and class libraries are out of sync.
The out of sync library is: C:\github\mono\msvc\build\fullaot\winaot\system.dll

When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.

--------------------------------------

The problem is that MacOs/BSD specific NetworkInformation classes are build into
System.dll on all platforms. One way to solve this is to start splitting the different
platforms specific implementations into different source files so we could start to
include/exclude sources per platform and profile in a nicer way instead of just
ifdef:ing inside current source files. This strategy also matches how corefx have
structured their NetworkInformation sources making it easier in the future to bring
mono’s NetworkInformation implementation closer to corefx. This PR implements this strategy.

Due to the fact that we don’t have platform specific configs for all profiles
(like basic and build) we can’t exclude all platform specific sources from
common.sources in System and move them to platform specific profiles. Ones we
have that full capability we could drop the #if WIN_PLATFORM in all the Win32*
files and exclude them from common.sources and only include them in the corresponding
win32 specific profiles. The same strategy could then be applied for other platform
specific profiles as well.

For Windows specific profiles, like win32_net_4_x_System.dll and winaot_System.dll we
use the .exclude.sources to remove the unix/linux/macos NetworkInformation sources,
so with this commit we will get a System.dll that only includes the Win32 specific
NetworkInformation classes and none of the unix/linux/macos, this will make sure the
compile error during full AOT won’t happen since there is no classes left including
the icall not available on a Windows mono runtime.

Other platforms will have the same classes in System.dll as before for now
but the source code is now structured making it possible to include/exclude platform
specific source files for other platforms as well, when needed.
2018-07-07 02:04:50 +02:00
Alexander Köplinger 4a5500355b [System.ServiceModel] Remove deleted files from .sources 2018-07-07 01:49:44 +02:00
Alexis Christoforides 4583729dd9 Merge pull request #9440 from mono/migueldeicaza-wapi-drive-types
Add another Darwin file system
2018-07-06 19:02:52 -04:00
Alexander Kyte 076c0b9bf6 [runtime] Add file and line number to mono_pmip 2018-07-06 17:30:26 -04:00
Alexander Kyte d3394bec38 [runtime] Make merp eventType icall argument 2018-07-06 17:17:57 -04:00
Alexander Kyte 71c4abe38c Merge pull request #9420 from alexanderkyte/remove_d_open
[runtime] Fix llvm build on bockbuild
2018-07-06 16:53:38 -04:00
Alexander Kyte f9c4740f59 [runtime] Make quick message-passing system for global flight recorder
The previous system was a nice prototype, but it ran into the problem of
taking a global lock on every thread doing logging. A fully lockless
implementation of a data structure with so much state would have been
madness to debug, and I really didn't want to spend much time in the future
debugging this.

What I did is to make a thread that reads from a lockless queue and logs the
message from the queue.

Most of the rest of this code is to address the fact that hazard
pointers depend on state that is initialized after logging is expected
to come up.
2018-07-06 14:42:07 -04:00
Alexander Kyte 0146210751 [runtime] Make global logger that uses flight recorder 2018-07-06 13:44:51 -04:00
Alexander Kyte 55820ef508 [runtime] Factor out flight recorder from state machine 2018-07-06 13:44:51 -04:00
Aleksey Kliger (λgeek) 1ed1f23868 [checked-build] don't collect state transition backtraces on abort_blocking (#9436)
[checked-build] don't collect state transition backtraces on abort_blocking

for the same reason as the other cases in this function - if we're in `RUNNING`
or `ASYNC_SUSPEND_REQUESTED` under hybrid suspend we're supposed to cooperatively
suspend.  If we call `backtrace()`, we might block waiting for the low-level
dynamic linker mutex on Linux which may be held by a thread that was
preemptively-suspended already.
2018-07-06 12:40:05 -04:00
Bernhard Urban 8af2d11550 [profiler] account for nullbyte in allocated buffer in log- and coverageprofiler (#9438)
[profiler] account for nullbyte in allocated buffer in log- and coverageprofiler

similar to https://github.com/mono/mono/pull/9166
2018-07-06 06:55:15 -04:00
Miguel de Icaza bad4b557d7 Add another Darwin file system
This prevents a test failure when Time Machine partitions are mounted on the
host running the test.
2018-07-05 22:34:13 -04:00
Aleksey Kliger 9f340f50d7 [merp] Add suspend policy to native state summary 2018-07-05 21:03:07 -04:00
Aleksey Kliger e4cebc69cf [mini] Print suspend policy in mono --version output 2018-07-05 21:03:07 -04:00
Aleksey Kliger 7613bbaa83 [coop] Add mono_threads_suspend_policy_name
Returns a text description of the suspend policy currently in effect.

Also combine logic that probes for suspend policy defines and environment
variables into a single function that returns an enum value; use that to drive
the individual boolean predicate functions.

The policy is subject to configure flags from when mono was built, and the
assorted environment variables at runtime:
    MONO_ENABLE_COOPERATIVE_SUSPEND
    MONO_ENABLE_COOP
    MONO_ENABLE_HYBRID_SUSPEND
(the second one is a backward-compatible alias for the first)

The logic is:

If coop xor hybrid is enabled by configure flags, always return that policy.
Otherwise if coop and hybrid env vars are set simultaneously, it's an error.
Otherwise if MONO_ENABLE_COOP or MONO_ENABLE_COOPERATIVE_SUSPEND is set use full coop.
Otherwise if MONO_ENABLE_HYBRID_SUSPEND is set use hybrid.
Otherwise use full preemptive suspend.
2018-07-05 21:03:07 -04:00
Aleksey Kliger 574a8fd802 [ci] Explicitly disable hybrid suspend for preemptive and coop tags
Also we didn't have an explicit preemptive tag before, so add it now
2018-07-05 21:03:07 -04:00
Aleksey Kliger 711274ba7a [configure] print suspend policy in summary; add default hybrid suspend conf
Default hybrid suspend setting to "no", for now.
2018-07-05 21:03:07 -04:00
Alexander Kyte 09f5f5e955 [runtime] Make llvm not install when mono installs 2018-07-05 19:04:08 -04:00
Alexander Kyte 1888785f51 [runtime] Fix destdir visiblity to llvm sub-build 2018-07-05 19:04:08 -04:00
Alexander Kyte ef99532116 [runtime] Bump build requirement to 10.8 2018-07-05 19:04:08 -04:00
Alexander Kyte 9fbc41593a [runtime] Remove -D_XOPEN_SOURCE on OSX 2018-07-05 19:04:07 -04:00
Bernhard Urban 3e10378ad1 [mini] respect additional flags when caching runtime invoke wrappers (#9385)
[mini] respect additional flags when caching runtime invoke wrappers

depending on `virtual_` and `need_direct_wrapper` we generate slightly
different IL. The interpreter always set `need_direct_wrapper`, but the
JIT doesn't, so this gets problemantic with mixed mode. We need to be
careful when we cache those results.
2018-07-05 14:55:07 -04:00
Calvin 36ceeae574 Fix invalid preprocessor check for BE that broke System.Decimal (#9429)
This bug has been lurking for four years, being introduced in commit
5b2bb8c901. BYTE_ORDER != G_BYTE_ORDER.

Not throughly tested, but System.Decimal from csharp seems to return
sane results again. (related: is z or AIX CI available for PR checks?
if not, what test suite is System.Decimal under?)

Also remove my shoddy workaround from a few months ago, it got the
BCL building, but was incorrect.
2018-07-05 18:16:23 +02:00
Calvin 1ba158386d Tweaks for AIX in BoringSSL CMake (#9390) 2018-07-05 01:18:03 +02:00
Zoltan Varga 6e8a0e7524 [sdb] Add a AssemblyMirror.GetMetadata () method to read the metadata from the debuggee, make AssemblyMirror.Metadata return it, or null if its not set/read yet. (#9346)
* [sdb] Add a AssemblyMirror.GetMetadata () method to read the metadata from the debuggee, make AssemblyMirror.Metadata return it, or null if its not set/read yet.

Fixes a regression introduced by b26a41cc3e. Parts of Mono.Debugger.Soft would check
AssemblyMirror.Metadata against null, and that would throw an exception when the debuggee was using an older protocol version.

* Bump API snapshot submodule
2018-07-05 01:16:19 +02:00
Martin Baulig 86c3c50c8d Legacy TLS Removal Preparations (#9301)
This PR prepares the upcoming removal of the Legacy TLS Provider.

- The internal (and soon-to-be-removed) class `MD5SHA1` has been moved and changed namespace.
- `Novell.Directory.Ldap.Connection` now uses `SslStream` instead of Legacy TLS, this ports the Novell Ldap library to use TLS 1.2, see #9363.
- Removed obsolete Ssl/Spnego authentication from `System.ServiceModel`.
- Removed duplicate copy of the Legacy TLS Provider from `System.ServiceModel`.
- Ported `System.Web.Mail.SmtpClient` to use `SslStream`.
- Removed the `Mono.Security.Protocol.Tls` documentation.
2018-07-05 01:13:46 +02:00
Alexis Christoforides fe3ac71532 Merge pull request #9341 from kumpera/better-sgen-asserts
[sgen] Improve assertion message to help track android issue.
2018-07-03 17:06:47 -04:00
Aleksey Kliger 37ffbc8766 [ci] Mono.Profiler.Log tests can run under coop (and hybrid) suspend
It was fixed by https://github.com/mono/mono/pull/8497
2018-07-03 13:03:41 -04:00
Aleksey Kliger 27cb721778 [marshal] Use a MonoCoopMutex for marshal_mutex
Fixes https://github.com/mono/mono/issues/9407
2018-07-03 11:15:57 -04:00
Zoltan Varga 898575e082 [sdks] Restore the meaning of the IGNORE_PACKAGE_LLVM option. (#9412) 2018-07-03 09:55:34 -04:00
Johan Lorensson 6e2a44285c Merge pull request #9381 from lateralusX/lateralusX/custom-native-crash-post-handler
Add platform customization support for post native crash handler and native crash info.
2018-07-03 13:10:02 +02:00
Jay Krell 217a1424ee [Coop] Convert System.Security.Cryptography.RNGCryptoServiceProvider. (#9014)
* Functions at start of lines for grep ^foo.

* [Coop] Convert System.Security.Cryptography.RNGCryptoServiceProvider.

* Remove 'count' in more places in favor of inc/dec buffer/size.
Guard all loops with while (size > 0).
Don't pretend that sizeof int32/16/8 is other than 4/2/1.
assert instead of loop forever of degenerate systems with small RAND_MAX and
  without better random.
2018-07-02 15:21:18 -07:00
Alexander Köplinger 23cfac00c5 [ci] Add -mmacosx-version-min to OSX builds (#9397)
We're targeting 10.7 in the bockbuild package build, let's do it in testing builds too.
2018-07-02 18:39:40 +02:00
Cody Russell 748d5e8891 Bump bockbuild (#9383) 2018-07-02 18:36:23 +02:00
Johan Lorensson f382b06915 Merge pull request #9293 from lateralusX/lateralusX/windows-dynamic-load-jit-unwind
Add support for dynamic symbol resolve for all JIT unwind info registration functions on Windows
2018-07-02 16:20:28 +02:00
Johan Lorensson 467c8e4471 Merge pull request #9334 from lateralusX/lateralusX/fix-excluded-dyncall-tests-windows-x64
Fix a couple of failing DYNCALL scenarios on Windows x64.
2018-07-02 16:03:21 +02:00
lateralusX 2a8fcbd9fe Review feedback, moving unix implementation to mini-posix.c. 2018-07-02 14:44:47 +02:00
Alexander Köplinger 1136c3e8f8 [ci] Compress build log in packaging pipeline job 2018-07-02 14:06:20 +02:00
Jay Krell 643e6c47ee [Coop] Some conversion of custom-attrs.c. (#9309)
* [Coop] Some conversion of custom-attrs.c. (#9309)
* Add comment explaining mono_array_addr_with_size_fast vs. mono_array_addr_with_size.
* Have mono_array_addr_with_size reuse mono_array_addr_with_size_fast.
* split create_custom_attr_data into self and create_custom_attr_data_into_array, to avoid handle creation in loop (like alloca in loop)

Note there is a subtle semantic change here, in that previously
when invoke failed, we'd still store into the array.
The caller checks the error and throws out the data so it should be ok,
the same in the end.
2018-06-30 15:02:24 -07:00
Jay Krell f157a9b793 Combine mono_cominterop_get_com_interface and ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal which are nearly identical. (#9374)
* Combine mono_cominterop_get_com_interface and ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal which are nearly identical.

* Fix disabled COM.

* Replace unformative and possibly dangerous g_assert_not_reached with safer more informative g_assertf.
2018-06-30 09:21:39 -07:00
Jay Krell f2acf7d160 Fix many warnings like: icall.c:666:2: warning: format string is not a string literal (potentially insecure) [-Wformat-security] (#9308)
Fix many warnings like: icall.c:666:2: warning: format string is not a string literal (potentially insecure) [-Wformat-security]

Most uses of mono_error_set_argument do not take a format string.
So rename mono_error_set_argument to mono_error_set_argument_format
and provide mono_error_set_argument that just takes one string, not to be formated.

Visit every call to mono_error_set_argument and change just a few to be mono_error_set_argument_format.

While there, notice that method_encode_code forms up extra data and does not use it.
2018-06-30 12:10:06 -04:00
Jay Krell cb6e1f95ee Enable incompatible-pointer warnings on Windows/gcc like Unix/gcc. (#9221)
Suppress the very many Visual C++-specific warnings introduced recently by typesafe handles.
2018-06-29 23:59:26 -07:00
Jay Krell 2434117e41 Fix printf bug in error path, confusing integer and string. (#9354) 2018-06-29 22:56:58 -07:00
Alexander Kyte 78527f04f2 Merge pull request #8792 from alexanderkyte/llvm_uni
[runtime] Build LLVM inside of mono as part of build
2018-06-30 00:22:46 -04:00
Bernhard Urban 7707163927 [interp] remove unused macros (#9378)
[interp] remove unused macros

we use different macros to use computed gotos:
https://github.com/mono/mono/blob/431e7e7fd0d962480f7cd48b3224d4fff41b70ee/mono/mini/interp/interp.c#L2487-L2504
2018-06-29 18:55:21 -04:00
Rodrigo Kumpera a3e3e628a4 [wasm] Reorganize and simplify the location of all debugging support code. It's all now on library_mono.js under the same object. (#9370)
* [wasm] Add MonoRuntime.get_loaded_files

* [wasm] Add missing dependency.

* [wasm] Move bootstrap and debug interface to library_mono.js to help upstream.

* Update library_mono.js
2018-06-29 18:59:48 +02:00
Aleksey Kliger (λgeek) ebc98c0d22 [coop] mono_coop_cond_signal should switch to GC Safe thread state (#9347)
* [debug] mono_pmip shouldn't assume it's called from an attached thread

`mono_pmip` calls `get_method_from_ip` which needs to make a string with the
name of a method. It used to call `mono_method_full_name` which is a `MONO_API`
function and so tries to switch to GC Unsafe mode (which requires the thread to
be attached).

However `mono_pmip` is often used from GDB/LLDB and it might be invoked by the
developer from a stopped thread that isn't currently attached which would assert.

Instead call `mono_method_get_name_full` in `get_method_from_ip` which doesn't
switch the thread state.

* [coop] mono_coop_cond_signal and mono_coop_cond_broadcast should switch to GC Safe

Under Linux/glibc `pthread_cond_signal` and `pthread_cond_broadcast` can block
on a futex in `__cond_quiesce_and_switch_g1`, so switch the thread to GC Safe
mode around the blocking operation.

* [coop] ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal shouldn't swith to GC Safe

On Win32, still do the thread state change here; on other platforms
its handled in the implementation of mono_w32handle_signal_and_wait
2018-06-29 10:19:39 -04:00
Marek Safar c677475fe9 [build] Skips RemoteExecuted bases tests on monodroid
The proper implementation will be written later
2018-06-29 14:30:23 +02:00
lateralusX 336f5f7557 Add platform customization support for post native crash handler and native crash info.
Add support for platform customization of native crash info output.

Add support to replace implementation of a post native crash handler behavior
if needed (used on none desktop Windows platforms).

NOTE, currently alternative implementations are in separate source file only
for Windows (since there was a need  to implement in sources keept in external
closed repository). All other platforms (none Windows) still uses the exact same
logic still located in the same source file as before.
2018-06-29 14:22:47 +02:00
Alexander Köplinger 32736f639c Update csproj files 2018-06-29 14:04:19 +02:00
Bernhard Urban 431e7e7fd0 [interp] fix scope issue regarding klass var (#9348)
[interp] fix scope issue regarding `klass` var

`klass` exists in the main loop, but we defined `klass` again inside the
block, so the outer `klass` never had the right value.

Fixes https://github.com/mono/mono/issues/9023
2018-06-29 05:25:28 -04:00
lateralusX 9f5fa9c769 Addressed review feedback. 2018-06-29 10:31:58 +02:00
Katelyn Gadd e271c293ee Rework genproj to use gensources to build sources list for each profile and host platform (#8985)
* Update genproj makefile to include gensources
Update genproj argument parser to be more generous about displaying help

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Fix rebase issue

* Checkpoint

* Checkpoint

* Fix built sources only being added to one profile

* Fix typo

* Checkpoint

* Fix indentation

* Use csc instead of mcs

* Checkpoint

* Fix BUILT_SOURCES only being handled for the first profile processed

* Checkpoint

* Checkpoint

* Strip double slashes from paths to fix spurious csproj change

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint: Fix genproj compilation

* Checkpoint

* Checkpoint

* Checkpoint

* Fix crash when no targets were loaded (due to an error)

* Checkpoint

* Checkpoint

* Checkpoint

* Fix TryParseTargetInto bug

* Checkpoint

* Shuffle exclude logic around so that it works correctly during genproj diffing

* Remove gensources tracing

* Checkpoint

* Fix handling of oddball sources paths from executable.make

* Fix jay not being set to build

* Fix wrong slashes being used for embedded resource paths

* [csproj] Update project files
2018-06-29 08:01:31 +02:00
Aleksey Kliger (λgeek) 57b474ba90 [runtime] Second batch of GC Unsafe thread state transitions for the MONO_API (#9299)
* [runtime] MONO_API mono_assembly_name_new needs GC Unsafe

* [runtime] MONO_API mono_assembly_name_get_name needs GC Unsafe

* [runtime] MONO_API mono_assembly_name_get_culture needs GC Unsafe

* [runtime] MONO_API mono_assembly_name_free needs GC Unsafe

  Also add mono_assembly_name_free_internal which assumes the thread is already in GC Unsafe mode

* [runtime] MONO_API mono_class_vtable needs GC Unsafe

* [metadata] Add mono_class_is_assignable_from_checked that sets a MonoError

  Change mono_class_is_assignable_from to call the checked version.

* [runtime] MONO_API mono_class_is_assignable_from needs GC Unsafe

* [runtime] MONO_API mono_class_get_property_from_name needs GC Unsafe

* [runtime] MONO_API mono_config_for_assembly needs GC Unsafe

* [runtime] MONO_API mono_type_is_byref needs GC Unsafe

* [runtime] MONO_API mono_class_from_mono_type needs GC Unsafe

* [metadata] Mark mono_class_get_field_from_name external only

  Runtime should use mono_class_get_field_from_name_full

* [runtime] MONO_API mono_class_get_field_from_name needs GC Unsafe

* [metadata] Mark mono_class_get_method_from_name_flags external only

  Runtime should use mono_class_get_method_from_name_checked

* [metadata] Mark mono_class_get_method_from_name as external only

  Runtime should use mono_class_get_method_from_name_checked

* [runtime] MONO_API mono_class_get_method_from_name needs GC Unsafe

* [runtime] MONO_API mono_class_get_methods_from_name_checked needs GC Unsafe

* [sgen] MONO_API mono_gc_collect needs GC Unsafe

* [runtime] MONO_API mono_get_exception_execution_engine needs GC Unsafe
2018-06-28 23:08:17 -04:00
Alexander Kyte ce443f6670 [runtime] Download LLVM during ios sdk CI build 2018-06-28 22:35:31 -04:00
Alexander Kyte 28b9d4ac91 [runtime] Fix with_llvm with /llvm config maker 2018-06-28 22:35:30 -04:00
Alexander Kyte a40b4fd73c [runtime] Move llvm-config checks into /llvm subdir
We had a problem with order of operations before. Makefile.am.in is
interpolated twice in the standard build. The first time happens when
autoconf runs. The second time happens when we enter the mono/mini directory
and execute our build. In the refresh, we lose our AM_CONDITIONAL conditionals
defined that aren't also AC_DEFINE variables on linux.

That's what it's vital to define all variables in all namespaces to have maintainable
automake code.

Furthermore, some of the CFLAGS logic we defined is designed for older LLVM copies, as
it includes some flags like O3 and Wall that we don't want.

In order to not get hacky with this, I moved the logic for using llvm-config into
a bash file in /llvm that creates a makefile fragment. The logic says that this fragment
should be null on calling autoconf, and then will be instantiated after we build llvm.

This fixes the build on Linux. We can expect bash behavior to be more consistent between
OSX and Linux than we can with automake too. I think this is a reorg with good long-time
maintainability.
2018-06-28 22:35:30 -04:00
Ludovic Henry 3cc00c47ad [llvm] Fix build for Mono SDKs 2018-06-28 22:35:26 -04:00
Filip Navara 5d223b0a8a Use System.Security.Cryptography.Oid* from CoreFX. (#9297)
* Use System.Security.Cryptography.Oid* from CoreFX.

* [csproj] Update project files

* Add CoreFX unit tests.

* Add obsolete S/MIME OID to make the Oid CoreFX tests pass on non-Mac systems.

* Enable Windows specific implementation of OidLookup.
2018-06-28 15:54:49 -04:00
Ludovic Henry 7121e54676 [sdks] Only rebuild MXE when it doesn't exist, not when we just cloned the sources (#9328)
* [sdks] Only rebuild MXE when it doesn't exist, not when we just cloned the sources

* [sdks] Default to ~/android-toolchain and ~/android-archives to better share with XA
2018-06-28 17:31:12 +02:00
lateralusX c3122f707a Fix potential store reordering race condition during DYNCALL initialize. 2018-06-28 16:39:18 +02:00
Marek Safar 6235aa18e3 Bump linker 2018-06-28 13:49:15 +02:00
lateralusX c1b9548597 Fix DYNCALL issues on AMD64 when using stack arguments.
Current DYNCALL on AMD64 didn’t handle scenario when spilling parameters from
registers to stack and that parameter was of type float/double. It then incorrectly
updated the floating-point register slot, but should have written it into the general
stack slot, making sure it will be correctly placed on callers stack in correct slot.

Current DYNCALL implementation didn’t handle the Windows x64 ABI when hitting a scenario
when spilling a valuetype into stack, it currently only supported the regular ArgOnStack
storage type, but Windows x64 will use ArgValuetypeAddrOnStack storage type.

There was also an additional issue with the number of stack slots allocated since it used
the stack argument offset instead of number of slots represented by the offset
(as used in later calculations). This caused to much stack space to be allocated and copied
(but things still worked as expected).

Commit also include a number of new test in aot-tests.exe mini regression test hitting above
issues.
2018-06-28 13:28:27 +02:00
Bernhard Urban 251e76bc7d [mini] add workaround for AMD Ryzen Threadripper issue (#9321)
workaround for https://github.com/mono/mono/issues/9298
2018-06-28 13:22:07 +02:00
Jay Krell c28d4dbdd7 Modernize Windows random number generation. (#9090)
* Modernize Windows random number generation.
 - Less code.
 - Less chance for failure.
 - Not seedable.
 - Requires Windows 7 or newer -- er, require Vista or newer until/unless Unity drops it, under ifdef.

This might get much further pruned with CoreFX import, which is on hold here, and doesn't really change much, except to indeed drop Vista support. (https://github.com/mono/mono/pull/9249)
2018-06-27 19:53:31 -07:00
Alexis Christoforides 0b87a15efa Merge pull request #9339 from kumpera/better_debugging_p1
[wasm] Unbreak the wasm debugging and massively simplify writing wasm apps using our SDK.
2018-06-27 17:42:01 -04:00
Rodrigo Kumpera 2863b440b3 Fix the wasm bcl build. Ordering was wrong. 2018-06-27 14:54:19 -04:00
Rodrigo Kumpera 3630748f96 fix typo in the readme. Thanks @Suchiman 2018-06-27 13:32:12 -04:00
Rodrigo Kumpera f2754c48a0 [sdks] Enable building of nunitlite and test suites for the bcl. 2018-06-27 13:16:50 -04:00
Rodrigo Kumpera d1faea4003 [sgen] Improve assertion message to help track android issue. 2018-06-27 12:12:46 -04:00
Rodrigo Kumpera f25d22a0d5 [wasm] Adjust packager to better work with our sample. Update the sample to use the binding engine and, finally, update the README with this all. 2018-06-27 11:48:14 -04:00
Rodrigo Kumpera 5d6834872f [wasm] Switch the test suites to use packager. This massively simplify the Makefile. 2018-06-27 11:48:14 -04:00
Rodrigo Kumpera de8d9c722c [wasm] Introduce packager that simplifies A LOT deploying a wasm app with mono. Remove most manual copying needed and makefile juju. 2018-06-27 11:47:40 -04:00
Rodrigo Kumpera 8ac6a63df9 [wasm] Multiple fixes to the debugger engine post merge. 2018-06-27 11:43:17 -04:00
Rodrigo Kumpera 6bb1dbdf25 [debug] bp_reqs and ss_reqs are optional arguments. 2018-06-27 11:43:17 -04:00
Rodrigo Kumpera 31c4b7fc10 [debug] Move mono_debugger_log_init to debugger-engine. 2018-06-27 11:43:17 -04:00
Rodrigo Kumpera 11adefde5f [wasm] Rought sample of the debugger. 2018-06-27 11:43:17 -04:00
Marek Safar 439625bba1 [mcs] Implements C# 7.3 extensible fixed statement
Part of #6854
2018-06-27 13:43:24 +02:00
monojenkins 903e263315 [csproj] Update project files 2018-06-27 13:40:41 +02:00
Marek Safar 67426d796a [linker] Conditional string ctors dependency 2018-06-27 13:40:41 +02:00
lateralusX d3e8a7dec0 Enable aot-tests.exe mini regression tests previously excluded using !FULLAOT-AMD64.
After fixes issues in DYNCALL Windows x64 ABI all aot-tests.exe previously
excluded using !FULLAOT-AMD64 can now be reenabled since outstanding issues
have been fixed. There is one new test still failing on Windows x64,
test_42_arm64_dyncall_vtypebyval, that is now excluded until investigated
and fixed.
2018-06-27 13:22:57 +02:00
lateralusX 3f201a465f Fix DYNCALL value type parameters to follow Windows x64 ABI.
Correctly handle use cases when parameter storage is ArgValuetypeAddInIReg
or ArgValuetypeAddrOnStack. This is used for value types not fitting into
registers on Windows x64.
2018-06-27 13:20:31 +02:00
lateralusX 320e41ad00 Fix incorrect float parameter handling on Winx64 DYNCALL.
The Winx64 calling convention handles parameters in a way that was not
correctly implemented in some DYNCALL use cases. When using a method signature
like this (double, int, double), the Winx64 ABI dictates that the first parameter
goes into first floating point parameter register (XMM0), second parameter goes into
second general register (RDX) and third floating point goes into third floating point
parameter register (XMM2). So above call should use registers XMM0, RDX and XMM2,
but current DYNCALL implementation will just use next floating-point register,
like XMM0, RDX and XMM1 and this will load wrong parameter registers as expected by callee.

For an example https://msdn.microsoft.com/en-us/library/zthk2dkh.aspx#Anchor_2

Fix makes sure mono_arch_start_dyn_call uses the already evaluated registry information
for floating point parameters. Currently it assumes floating point registers are assigned
in a linear fashion and that works for System V ABI, but not for Winx64’s ABI.

Commit also adds a couple of tests into ao-test.cs that works with mixed signatures
together with DYNCALL.
2018-06-27 13:04:54 +02:00
Alexander Kyte b6971a981b Make requested MERP file format changes (#9274)
* [merp] Change and emit event type

* [merp] Change XML file output path
2018-06-27 12:20:07 +02:00
Zoltan Varga 3acfd166d3 [llvm] Avoid using the preserveall calling convention on watchos, xcode10 asserts on it. (#9322)
Fixes https://github.com/mono/mono/issues/9318.
2018-06-27 10:28:09 +02:00
Rodrigo Kumpera c2f6437628 [wasm] Small set of changes that are wasm specific. (#9305)
* [wasm] Add helper target to update the runtimes.

* [wasm] Reenable tests that previously crashed due to JS engine issues.

* [wasm] Update jsvu 1.3.1 so we get jsc on linux. Fix uname magic on OSX.
2018-06-27 10:26:47 +02:00
Alexander Köplinger 3eabde79db [ci] Report xunit test results to babysitter (#9312)
Now that we're running more xunit tests it's useful to include
those in the babysitter reporting.
2018-06-27 00:41:52 +02:00
monojenkins fefc755869 [csproj] Update project files 2018-06-26 16:14:57 +02:00
Maxim Lipnin 147278200c CoreFX import for AsnEncodedDataCollection and AsnEncodedDataEnumerator types 2018-06-26 16:14:57 +02:00
rjvdboon 16e7e18a53 Use positional parameters in calls to .format in gdb python scripts (#9311)
Omitting positional parameters works for gdb linked to python 2.7 / 3.1+. On older systems (e.g. redhat 6, centos 6) gdb might be linked to python 2.4-2.6 or 3.0, adding parameter ordinals enables proper backtraces on those systems.

Fixes #9292.
2018-06-26 15:10:07 +02:00
Jay Krell b826d40975 Cleanup resource management and error paths ahead of coop conversion. (#9291) 2018-06-25 22:35:03 -07:00
Jay Krell 75c3fdc416 [coop] Convert some exception handling and appdomain creation. (#9286)
* [coop] Convert some exception handling and appdomain creation.
2018-06-25 18:46:13 -07:00
Kadirov Yurij 228b717767 [System] Fix exception when process exit code is -1 on Windows (#9287)
A Unix-only exception is being thrown on Windows.

Fixes #9277
2018-06-25 23:35:58 +02:00
Martin Baulig 0a8b1b2666 [System]: HttpWebRequest now throws WebExceptionStatus.RequestCanceled on abort. (#9212)
* [System]: `HttpWebRequest` now throws `WebExceptionStatus.RequestCanceled` on abort.  #9031.

Cleanup the internal `HttpWebRequest.RunWithTimeout()` function and use
`GetWebException()` everywhere to throw `WebException` with
`WebExceptionStatus.RequestCanceled` on abort.

New tests for this will be added to the web-tests by extending the existing
`Xamarin.WebTests.HttpInstrumentationTests.AbortDuringHandshake` to check the
synchronous and begin/end async APIs as well, using both `GET` and `POST`.

See https://github.com/xamarin/web-tests/blob/master/Xamarin.WebTests.Tests/Xamarin.WebTests.HttpInstrumentationTests/AbortDuringHandshake.cs.

Fixes #9031.

* Fix exception checks, setting `TransferEncoding` without `SendChunked` is supposed to throw `InvalidOperationException`.
2018-06-25 23:16:32 +02:00
Martin Baulig 7accbbbec6 [System]: Renegotiation in AppleTls requires OS X 10.12+ (#9254)
* [System]: Renegotiation in AppleTls requires OS X 10.12+.

* Make renegotiation version check conditional to `!MONOTOUCH`.

The rest of the renegotiation code is currently conditional to `!MONOTOUCH`
as well, we might want to eventually revisit this at some point.

Fixes #9234
2018-06-25 23:06:11 +02:00
Jay Krell 4c8f036892 Cleanup some unnecessarily confusing code. (#9279)
Had additional restructure not been ok, at least typedefing the function pointer
  would have helped.

Add const for efficiency -- make the copy-on-write faults count for more and
  not take extra readonly data with them.

Remove unused and actually confusing parameter -- it is just zeroed memory
and almost cannot be used for anything (granted, could hash it).
2018-06-25 13:59:07 -07:00
Alexander Kyte 3eaced7d4b [runtime] Propagate automake variables to llvm's build.mk 2018-06-25 15:09:05 -04:00
Alexander Kyte a63067dab6 [runtime] Use libstdc++ on linux 2018-06-25 15:09:05 -04:00
Ludovic Henry 965f3b51fd [sdks] Download LLVM with llvm/ 2018-06-25 15:09:05 -04:00
Ludovic Henry 959effddb3 [sdks] Build LLVM+MXE with llvm/ 2018-06-25 15:09:05 -04:00
Alexander Kyte 8e8f92241a [runtime] Remove sdks targets that configure llvm, non-mxe 2018-06-25 15:09:05 -04:00
Alexander Kyte e449275b6d [runtime] Fix mono-state access to LLVM_API_VERSION 2018-06-25 15:09:05 -04:00
Alexander Kyte 269821eaec [runtime] Enable assertions with in-tree llvm with configure option 2018-06-25 15:09:04 -04:00
Alexander Kyte 27eb41354e [runtime] Make bockbuild build llvm through mono 2018-06-25 15:09:04 -04:00
Alexander Kyte 0c55e477fa [runtime] Fix version info interpolation 2018-06-25 15:09:04 -04:00
Alexander Kyte b86070339e [runtime] Made mono build llvm if it can't find it 2018-06-25 15:09:04 -04:00
Vlad Brezae c5b88ec4f3 [sgen] Use longs with nursery array fill (#9202)
* [sgen] Use longs with nursery array fill

Objects are 8 byte aligned. This enables us to support nurseries of up to 32GB.

* [sgen] Add explicit limit to nursery size
2018-06-26 00:53:44 +06:00
Jay Krell d781dee014 Fix backward error handling in mono_get_exception_reflection_type_load from commit (#9285)
42ddfea489 in 2016.
2018-06-25 10:45:58 -07:00
Jay Krell bdb7cf925f Remove 3 unused incorrectly written glib string functions. (#9261)
* g_string_insert does not update string->len, and copies the wrong number of characters around,
	and does not allow for overlapping parameters,
	and is not used -- remove it.

g_string_erase does not always update string->len,
	and is not used -- remove it.

g_string_prepend does not update string->len.
 Switch the only use to append in the reverse order, and fix a leak.
2018-06-25 10:44:26 -07:00
Rodrigo Kumpera 2e5a17f19f Merge pull request #9151 from kumpera/de_engine_part6
[wasm] Add single stepping to the debugger.
2018-06-25 12:26:17 -04:00
Alexander Kyte 3481b418bd [runtime] Fix debugger dumping when unused (#9273)
[runtime] Fix debugger dumping when unused

Somewhere in the daily rebasing to edit the PR, I lost the correct version of the early-exit. This fixes our native crash when we did not use the debugger. It's important to merge, or we'll crash before MERP/gdb dumping happens.
2018-06-25 07:55:15 -04:00
lateralusX 5638581329 Add support for dynamic symbol resolve for all JIT unwind info registration functions on Windows.
Using dynamic symbol resolve (LoadLibrary/GetProcAddress) for all unwind info related registration functions enables
building the same code on all Windows platforms where JIT is build and included.
2018-06-25 11:33:57 +02:00
Egor Bogatov 51935465ae Delete unused files in BCL (#9288)
The following files in `mcs/class/*.cs` are not used anywhere (*.csproj/*.source).
2018-06-25 11:15:20 +02:00
Jay Krell 540f077c58 Factor mono_get_exception_missing_field and mono_get_exception_missin… (#9282)
* Factor mono_get_exception_missing_field and mono_get_exception_missing_method into mono_get_exception_missing_member ahead of coop conversion.
2018-06-25 00:03:17 -07:00
Johan Lorensson 901e4f6cf1 Merge pull request #9230 from lateralusX/lateralusX/windows-x64-llvm-support-master
Add LLVM AOT/Full AOT support on Windows x64.
2018-06-25 08:34:11 +02:00
Zoltan Varga b14af0f14e [aot] Pass the soft-float argument to llc properly, the -soft-float option doesn't seem to exist anymore. (#9283) 2018-06-24 15:40:32 -04:00
Jay Krell e342ef7ac7 Omit handle type-safety on untested PowerPC, S390X, SPARC, MIPS, etc. (#9275) 2018-06-23 18:06:35 -04:00
Johan Lorensson e8c379d57f Change getenv to g_getenv in sources build on Windows platforms. (#9253)
There are Windows platforms (like UWP) that doesn't support getenv. The implementation
of g_getenv makes it possible to replace the implementation at build time on
none desktop platforms.
2018-06-22 22:16:28 +02:00
Vlad Brezae c6f1d112d2 [interp] Fix abort after finally block (#9265)
The throwing of the pending exception after the finally blocks are executed was in unreachable code.

Refactor the code a bit and exit the abort protected block directly in endfinally. We throw the abort after all guarding finally blocks were invoked, to avoid throwing from inside a finally block. Guard also fault handler, which are called from EH.
2018-06-22 22:15:45 +02:00
Rodrigo Kumpera 737095247b [runtime] Implement tombstone scrubbing for our concurrent hashtables. (#9176)
* [runtime] Implement tombstone scrubbing for our concurrent hashtables.

Tombstones must be scrubbed as they can end up taking up all space of a hashtable and make lookup fail.

* [runtime] Added regression stress test for #9176

This test triggers insertion and removal from runtime_invoke_hash to the point
that if there's no scrubbing it will cause a deadlock.

* [runtime] Disable new test under full-aot as it uses SRE.
2018-06-22 21:49:24 +02:00
Rodrigo Kumpera 92154f0386 [debugger] Clear the_ss_req when calling mono_de_cancel_ss. 2018-06-22 15:43:31 -04:00
Ludovic Henry 7a327fa5f2 [w32socket] Remove useless interrupt callback (#9246)
The callback consists in `mono_thread_info_abort_socket_syscall_for_close` which itself calls `mono_threads_suspend_abort_syscall`. The problem with the previously existing interrupt callback is that, even if `mono_threads_suspend_abort_syscall` is called by the thread suspend mechanism, it would still call `mono_thread_info_abort_socket_syscall_for_close` which would duplicate the call to `mono_threads_suspend_abort_syscall`
2018-06-22 12:37:57 -04:00
Johan Lorensson 622a1b6f55 Helper scripts running mini regression tests in JIT/Full AOT on Windows. (#9252)
* Helper scripts running mini regression tests in JIT/Full AOT on Windows.

A set of helper scripts running all mini regression tests, supporting both
JIT and full AOT (including building full AOT assemblies) using local build
Visual Studio mono runtime (can be switched in setp.env.bat). Includes logic
to pick correct Visual Studio toolchain and support to setup command prompt
targeting x64 full AOT build and running tests. NOTE, the scripts are not limited
to the mini regression tests, only includes a set of predefined assemblies making
it easier to execute regression tests.

Full AOT scripts includes capabilities to build dynamic library, static linked objects
or assembler output, it also supports switches to use LLVM when building full AOT
assemblies if supported by local build mono runtime.

By default, scripts follow default build configurations used by mono BCL builds and
Visual Studio x64 Release build mono runtime.

Examples to run all JIT regression tests:

run-jit-regression.bat all

To run individual programs using JIT (doesn’t need to be a regression test):

run-jit.bat [full path to assembly]

NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.

run-jit.bat basic.exe

Examples to build all regression tests using full AOT:

build-full-aot-regression-tests.bat all

Builds all regression tests in full AOT including all needed support and
BCL assemblies. All build assemblies will end up in msvc\build\fullaot\winaot
folder by default. It is possible to build individual assemblies as well using:

build-full-aot-regression-tests.bat [full path to assembly]

NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.

build-full-aot-regression-tests.bat basic.exe

Examples to run all regression tests using full AOT:

run-full-aot-regression-tests.bat all

Runs all regression tests in full AOT. It is possible to run individual assemblies
as well using:

run-full-aot-regression-tests.bat [full path to assembly]

NOTE, for regression tests there is a shortcut making them easier to locate,
so then just the assembly name can be used, not the full path is needed.

run-full-aot-regression-tests.bat basic.exe

There are some more features included in the scripts as well, but above shows
basic usage. It could also be possible to reuse the scripts in Visual Studio
build targets going forward to at least run the JIT regression tests
as part of Visual Studio build.

* Fixed some review feedback.

* Switching to 1 instead of -1 in case of errors.
* Used case insensetiv compare for some if's.
* Dropped use of ECHO OFF/ON in nested scripts.
* Removed clear of PATH (was not intended).
2018-06-22 18:23:08 +02:00
Alexander Kyte a49b96d72d Merge pull request #9062 from alexanderkyte/merp_json_params
[runtime] Package merp params in 3 ways needed
2018-06-22 12:21:17 -04:00
Martin Baulig 2dc7e89078 [System]: Fix bug in WebResponseStream.GetResponse() that will make some people happy. (#9228)
Test: https://github.com/xamarin/web-tests/commit/0777c6bbe3adc2b678ee286cd8e06067f29e548f

You need to construct the response like in the test.  Total size of the response must be somewhere between 4082 and 4092 bytes and you must send this as a blob - that is, using a single write operation.
2018-06-22 18:09:23 +02:00
Rodrigo Kumpera 55950a0608 [mini] Implement delegate tramp info using gsharing context. (#9238)
* [mini] Implement delegate tramp info using gsharing context.

* [mini] Remove duplicate patch type.

* expand a FIXME to include what needs fixing.

* [mini] Copy MonoDelegate::method from the delegate tramp info instead of emiting a rgctx fetch. This is 6% faster on a delegate microbenchmark.
2018-06-22 08:58:09 -04:00
Zoltan Varga e6c8726243 [sdks] Delete ios simulators created by old versions of xcode if needed. (#9263) 2018-06-22 13:51:18 +02:00
Calvin 363e91c461 System.Diagnostics.Process improvements for AIX (#9180)
* Fix Process.ProcessName on AIX

AIX has a procfs with raw structures congruent with Solaris. For i,
which lacks procfs, fall back to a libc call.

This doesn't solve the Process weirdness that bungs up the test
suite, but I hope it's a start.

* Bye bye, annoying AIX setschedparam warning

AIX (but weirdly, not i) complains every time you do this. Squelch
the warning on AIX and avoid line noise.

* Remove more assumptions of /proc on AIX

	* should probably always use getprocs64 for w32process,
	  but looks like we could just use proclib on the fallback?

	* there's some more cases relating to resource usage stat,
	  will have to investigate those cases further

* Basic process modules support on AIX (but not i)

Not aware of a PASE compatible API, but this will work on AIX. Not
sure about .ModuleName versus .FileName, but it seems to fill it in...
2018-06-22 13:16:32 +02:00
Alexander Kyte 80d11ebc0c Merge pull request #9256 from alexanderkyte/debugger_flight_move
[runtime] Move debugger flight recorder printing earlier in crash
2018-06-21 23:18:09 -04:00
Alexander Kyte bc1769d4ee Merge pull request #9047 from alexanderkyte/merp_abandon
[runtime] Make mono-state dumper abandon stuck threads
2018-06-21 23:17:35 -04:00
Katelyn Gadd 4c32406df7 Make gensources.cs fail on missing files or zero-match wildcards (#9239)
The gensources.cs currently checked in to master doesn't fail on missing files by default because it didn't work at the time. This turns that behavior on. It is currently only in my other in-progress branch so I'm moving it here.

Fixes #9232

* Enable failing on missing files in gensources

* Copy over the missing file checks from genproj2

* Trim whitespace off file names from sources files

* Strip double slashes from paths to fix spurious csproj change
2018-06-22 01:17:20 +02:00
Ankit Jain 8046a5f140 Bump msbuild to track xplat-master (#9240) 2018-06-22 01:15:14 +02:00
Alexander Kyte e19be45d36 [runtime] Move debugger flight recorder printing earlier in crash
Previously we called it only if gdb was enabled, and we called it after
we invoked handlers asynchronously, in ways that could eat our session
state. By moving it higher up, we can increase the numbder environments in which
debugger crashes are logged, and log them even in the case when
telemetry dumping kills the runtime quickly.
2018-06-21 17:40:39 -04:00
Alexander Kyte f84f5ff4b8 [runtime] Use GUID rather than assembly name in json 2018-06-21 17:21:30 -04:00
Alexander Kyte ca795d96ed [runtime] Package merp params in 3 ways needed 2018-06-21 17:21:30 -04:00
Rodrigo Kumpera 9c02aa6356 [debugger-engine] Make some symbols private. 2018-06-21 12:19:47 -04:00
Rodrigo Kumpera 7b6e970a52 [sdb] Use mono_de_cancel_ss instead of mono_de_ss_req_release. 2018-06-21 12:17:05 -04:00
Jay Krell 88d853487e Werror at the end of configure.ac because autoconf requires warnings to be success -- fix for gcc 4.x. (#9251) 2018-06-21 11:33:15 -04:00
Aleksey Kliger (λgeek) 43b0fa6261 [runtime] Add GC Unsafe transitions to some MONO_API functions (#8847)
* [runtime] MONO_API mono_assembly_get_object needs GC Unsafe

* [runtime] MONO_API mono_array_length needs GC Unsafe

* [runtime] Make MONO_API mono_reflection_load_from_full external only

  Also mono_reflection_load_from ()

  Also make them both transition to GC Unsafe

* [runtime] Make MONO_API mono_assembly_load_full external only

  And make it transition to GC Unsafe

* [runtime] Make MONO_API mono_assembly_loaded external only

  Runtime should use mono_assembly_loaded_full.

  Make mono_assembly_load transition to GC Unsafe

* [runtime] MONO_API mono_assembly_open needs GC Unsafe

  Also mono_assembly_open_full

* [runtime] MONO_API mono_check_corlib_version needs GC Unsafe

* [runtime] MONO_API mono_class_enum_basetype needs GC Unsafe

* [runtime] MONO_API mono_value_box needs GC Unsafe

* [runtime] Make mono_type_get_object external only

  Runtime should use mono_type_get_object_checked or mono_type_get_object_handle

* [runtime] MONO_API mono_string_to_utf8 needs GC Unsafe

* [runtime] MONO_API mono_raise_exception needs GC Unsafe

* [runtime] Make mono_reflection_type_get_type external only

  Also make it use GC Unsafe.

  Runtime should use mono_reflection_type_get_handle

* [runtime] MONO_API mono_object_new needs GC Unsafe

* [runtime] MONO_API mono_domain_assembly_open needs GC Unsafe

* [runtime] MONO_API mono_method_get_object needs GC Unsafe

* [runtime] MONO_API mono_method_full_name needs GC Unsafe

* [runtime] MONO_API mono_method_signature needs GC Unsafe

* [runtime] MONO_API mono_thread_create needs GC Unsafe

* [runtime] MONO_API mono_field_get_type needs GC Unsafe

* [runtime] MONO_API mono_field_get_value needs GC Unsafe

* [runtime] MONO_API mono_field_set_value needs GC Unsafe

* [runtime] Mark mono_image_open_from_data_with_name external only

  Runtime should use mono_image_open_from_data_internal

* [runtime] MONO_API mono_image_open_from_data_with_name needs GC Unsafe

* [runtime] MONO_API mono_field_static_set_value needs GC Unsafe

* [runtime] MONO_API mono_property_set_value needs GC Unsafe

* [runtime] Make MONO_API mono_assembly_load_with_partial_name external only

  Runtime should use mono_assembly_load_with_partial_name_internal.

  Make mono_assembly_load_with_partial_name transition to GC Unsafe

* [profiler] Log whenever the profiler library fails to load

* [test] Fixup return type of mono_gc_toggleref_add

* [sgen] Don't pin obj in test_toggleref_callback under coop

  Don't call mono_field_get_value which under coop will perform a thread state transition to GC Unsafe and that may include copying the stack data which will pin the toggle object and subsequently make the toggleref test fail.  Call mono_field_get_value_internal which assumes we're already in GC Unsafe mode.
2018-06-20 13:52:55 -04:00
Rodrigo Kumpera 1d48f931cf [debugger-engine] Clear the_ss_req when its value gets freed 2018-06-20 13:46:17 -04:00
Rodrigo Kumpera 67e8b13d3d [wasm] Add new single stepping JS function. 2018-06-20 13:31:49 -04:00
Rodrigo Kumpera 8b0457ee88 [wasm] Implement debugging on top of debugger-engine. 2018-06-20 13:31:49 -04:00
Rodrigo Kumpera 5f0166d7eb [debugger-engine] Add a couple new functions. 2018-06-20 13:31:49 -04:00
Rodrigo Kumpera 1d60a597c1 [debugger-engine][sdb] Move single stepping engine to debugger-engine.c.
This involves a series of callbacks. Some of the callbacks are hiding code that should be later moved as well but for now are not needed.
2018-06-20 13:31:49 -04:00
Rodrigo Kumpera 2eed9c0902 [debugger-engine][sdb] Move single stepping engine to debugger-engine.c.
This involves a series of callbacks. Some of the callbacks are hiding code that should be later moved as well but for now are not needed.
2018-06-20 13:31:49 -04:00
lateralusX a86b6c19fe Fix build issue on OSX. 2018-06-20 14:10:59 +02:00
lateralusX d37796c71c Add LLVM AOT/Full AOT support on Windows x64.
Uses mono LLVM master branch, build using cmake and VisualStudio 2015/2017.
Commit adds support for AOT/Full AOT LLVM codegen for Windows x64 Visual Studio
build mono runtime. Normal configure/make using cygwin won’t support LLVM and will
trigger an error if configured.

In order to build using LLVM first mono LLVM master branch must be build using
static linked LLVM configuration (dynamic loading can be added later),
NOTE mono LLVM build needs to include the following commit,
https://github.com/mono/llvm/commit/9b92b4b87607e137266f84dc307181b8842fe54a
in order to successfully build on Windows x64.

Build mono LLVM branch using the following cmake configuration:

-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ZLIB=OFF
-DLLVM_TARGETS_TO_BUILD="X86"
-DCMAKE_CROSSCOMPILING=False
-DCMAKE_SYSTEM_NAME=Windows

Use cmake with -G "Visual Studio 14 2015 Win64" to generate VS 2015 x64
targets. NOTE, if mono runtime is build using VS 2017, then LLVM should
be build using the same VS version using -G "Visual Studio 15 2017 Win64"

To enable LLVM build in mono.sln, set MONO_ENABLE_LLVM to “true” and make
sure MONO_LLVM_INSTALL_DIR_PREFIX points to the install directory used in
LLVM build above, default msvc/dist/llvm. Above LLVM properties can also
be set if build using msbuild.

A sample LLVM configure script has been included in msvc/llvm-cmake-config.bat.
2018-06-20 13:38:49 +02:00
Jay Krell bf06441ead Ignore GetAttributes_ReadOnly and Create_Path_ReadOnly when running as root. (#8904)
root can still write to a file even if the readonly bit is set.
2018-06-20 12:31:29 +02:00
Jay Krell 8562f3a28f Refine typesafe coop handles to not cast function pointers. (#9219)
* [typesafe coop] Go through generated token-pasted helpers
instead of casting function pointers. This should be safer and
not trigger quashed gcc warning and I had hoped it would
work with WebAssembly, but seemingly not.

Add MONO_TYPEOF_CAST to avoid repitition.
2018-06-20 02:53:58 -07:00
Zoltan Varga d38449c186 [runtime] Disable llvm disabled tests when running with --with-runtime-preset=fullaot_llvm as well. (#9213) 2018-06-20 11:40:28 +02:00
Alexander Köplinger aa536443d3 Update api-snapshot and csproj
For https://github.com/mono/mono/pull/9222
2018-06-20 10:44:32 +02:00
Zoltan Varga 275d7bfc2c [runtime] Switch Nullable to the corefx version. (#9222)
* [runtime] Switch Nullable to the corefx version.

* [bcl] Add Nullable tests from corefx.

* [sdb] Fix assumptions about field order in Nullable<T>.
2018-06-19 20:38:55 -04:00
Alexander Kyte fbfbb15eb5 Merge pull request #8865 from alexanderkyte/debugger_state
[runtime] Make debugger log to ring buffer and maintain thread state model
2018-06-19 19:34:44 -04:00
Calvin da0bb49fa6 Add AIX CI badge (#9224)
attempt at "the build is broken" development. it's marked (cs) like the others.
2018-06-19 20:54:15 +02:00
Alexander Kyte 783df4c5b0 [runtime] Fix windows type-safety of handle.h 2018-06-19 12:51:14 -04:00
Alexander Kyte fde6209204 [runtime] Fix windows build of debugger state machine 2018-06-19 12:44:19 -04:00
Alexander Kyte 17f4388563 [runtime] Duplicate breakpoint state to avoid taking loader lock 2018-06-19 12:44:19 -04:00
Alexander Kyte 83ad49a3a0 [runtime] Make debugger logger use separate mutex 2018-06-19 12:44:19 -04:00
Alexander Kyte 05598ed957 [runtime] Move debugger logging behind runtime toggle 2018-06-19 12:44:19 -04:00
Alexander Kyte 6e6ff337a4 [runtime] Print debugger state on unhandled exception 2018-06-19 12:44:19 -04:00
Alexander Kyte bc25af8d04 [runtime] Fixup mono-debugger json formatting 2018-06-19 12:44:19 -04:00
Alexander Kyte 65475b9216 [runtime] Add breakpoint and externally-started-thread support to debugger log 2018-06-19 12:44:19 -04:00
Alexander Kyte bb1f6aaa0d [runtime] Report client connection state with the debugger 2018-06-19 12:44:19 -04:00
Alexander Kyte 7e9d25c56b [runtime] Log runtime events and state changes into model
Here we have a structured log and a richer "model" of states.
This serves to be a 10-foot view of the debugger. The debugger
has a lot of layers of abstractions, and lots of intermingled
bookkeeping.

This debugger log serves to be a summary of the state of the debugger
as a whole, and our ringbuffer of recent events helps put the debugger
state into context.

It also allows us to easily identify, for instance when we resume
a new thread versus a suspended thread. We can see single-stepping
through the breakpoints added, removed, and hit. Lastly, we have a view
of how commands and events are totally ordered over the TCP socket,
helping the server to understand what the client has seen and in which
order.
2018-06-19 12:44:18 -04:00
Alexander Kyte 3515da7c68 [runtime] Make files for debugger state machine 2018-06-19 12:44:18 -04:00
Alexander Kyte 0fbb3bbfbb [runtime] Make DebuggerTlsData an opaque type 2018-06-19 12:44:18 -04:00
Alexander Kyte c98810959e [runtime] Make debugger-engine.h includable
Previously one had to include the proper types for this header in
the file including this header, before this header is included. Rather
than put irrelevant includes in other files, I'm adding includes here so
this file brings in its own dependencies.
2018-06-19 12:44:18 -04:00
Jay Krell 475a69f7c5 Make coop handles typesafe. (#9183)
* Make coop handles typesafe.

Type-safe handles are a struct with a pointer to pointer.
The only operations allowed on them are the functions/macros in handle.h, and assignment
from same handle type to same handle type (which cannot be prohibited in C, but is ok here anyway.)

Type-unsafe handles are a pointer to a struct with a pointer.
This is a leakier abstraction and besides the type-safe operations, also allows:

1. compared to NULL, instead of only MONO_HANDLE_IS_NULL
2. assigned from NULL, instead of only a handle
3. MONO_HANDLE_NEW (T) from anything, instead of only a T*
4. MONO_HANDLE_CAST from anything, instead of only another handle type
5. assigned from any void*, at least in C
6. Cast from any handle type to any handle type, without using MONO_HANDLE_CAST.
7. Cast from any handle type to any pointer type and vice versa, such as incorrect unboxing.
8. mono_object_class (handle), instead of mono_handle_class.

None of those operations were likely intended and some are crashing sort of bugs, esp.
the last two. See https://github.com/mono/mono/pull/9188 for the last two. The rest all occur also but are not necessarily harmful. Raw(NULL_HANDLE) and IsNull(NULL_HANDLE) were both access violations, so NULL just as well. MONO_HANDLE_CAST is still pretty liberal in what it allows.
NULL_HANDLE has been brought into question and this will allow grepping for it instead of the plainer NULL (i.e. returning them as handles).

The interaction of these handles with JITed code depends on the ABI to pass/return a struct
with a pointer the same as a pointer. Marshalling assumes this.
There might be some OS/CPU ABIs that do not support this.
CI suggests it is broadly but not 100% viable (disabled for non-Mac non-Windows x86, but enabled for arm, arm64, amd64, Mac/x86, Windows/x86).

* Typesafe handles enforcement brings with it a little more pointer enforcement, mostly around const and volatile. Repair a bit, and disable temporary for Windows.

 * Fix MONO_HANDLE_IS_NULL (NULL_HANDLE) to not null dereference.

 * Fix MONO_HANDLE_RAW(NULL_HANDLE) to not null dereference.
This depends on a gcc/clang extension, and a Visual C++ (C) quirk.
Otherwise we have to chose double evaluation, or C++, or assignment or cast from void* to temporary (possibly passing more types to more macros).
Another choice is a runtime assert, and double evaluation or not.
Asserts seen can be covered up by first checking MONO_HANDLE_IS_NULL, which will not null  dereference nor assert.

Prior to making RAW(NULL) not null derefence, fixing code of the form:
```gboolean is_null_handle = handle && MONO_HANDLE_IS_NULL(handle)```
to be
```gboolean is_null_handle = MONO_HANDLE_IS_NULL(handle)```
while working on this change led to failures.

* Add gcc -Werror=incompatible-pointer-types to catch some handle type mismatches.
This has slight collateral damage on other code, mostly around const and volatile, mostly in Android-specific code. Disabled for Windows/gcc at first.

* Change mono_icall_handle_new_interior to return gpointer instead of MonoObjectHandle. It isn't returning a handle and making the non-handle typesafe is unnecessary/incorrect.
Likewise change mono_handle_new_interior to return gpointer instead of MonoRawHandle (same thing).
gpointer* is more correct, gpointer is more opaque; unclear which is preferred here.
gpointer makes this a smaller semantic change, as MonoRawHandle was already equivalent, just a rename.

* Move NULL_HANDLE, NULL_HANDLE_STRING, NULL_HANDLE_ARRAY so they are near the comment that refers to all of them.

* Remove mono_handle_new_full prototype, the function does not exist.

* Remove unnecessary casts.

* Remove unused MONO_HANDLE_INIT.

* Add an assert to handle_assign.

* A refinement of this change should enable WebAssembly and skirt underlying safety less. WebAssembly does not allow the function pointer casts used here.
2018-06-19 06:39:18 -07:00
Aleksey Kliger 9b9e4f4bb6 [loader] Add null checks around domain_assemblies
Try to catch situations leading to a segv in mono_domain_assembly_search by
checking that we never put NULL into domain_assemblies and that callers of
mono_assembly_names_equal_flags never pass NULL args to it.
2018-06-18 16:57:43 -04:00
Filip Navara 736bf9d3a3 Detect the private key type from the supplied OID instead of guessing from the content. (#9168)
* Detect the private key type from the supplied OID instead of guessing from the content.

* Use oid constants from X509Certificate.
2018-06-18 15:18:59 -04:00
Zoltan Varga 4d3822188b [bcl] Bump corefx. (#9203) 2018-06-18 15:17:07 -04:00
Vlad Brezae 4d6a4ae132 [coop] Use coop mutex (#9159)
* [coop] Use coop mutex

ldstr_section can be taken during jit compilation.

* [runtime] Switch to non recursive mutex

ldstr_section only guards hashtable accesses.
2018-06-18 15:02:36 -04:00
Marek Safar 55b7051f52 [mcs] Extend emit preparation to binary expressions. Fixes #9155 2018-06-18 19:31:53 +02:00
Rodrigo Kumpera bf3c71ef3f Merge pull request #9128 from kumpera/de_engine_part5
Last round of cleanups before moving single stepping to debugger-engine.c Continuation of #9079
2018-06-18 11:31:56 -04:00
Zoltan Varga 4296d70e07 [runtime] Allow --enable-llvm to work with newer llvm versions as well. (#9186) 2018-06-18 11:15:51 -04:00
Zoltan Varga 813588bd9f [runtime] Fix the freeing of BStr members in pinvoke. (#9184)
Fixes https://github.com/mono/mono/issues/9010.
2018-06-18 11:14:54 -04:00
Bernhard Urban d5d116b787 [code hashtable] change remove function so that it does not fail on removing a non-existing element (#9137)
[code hashtable] change remove function so that it does not fail on removing a non-existing element

saves us one lookup operation
2018-06-18 07:56:10 -04:00
Filip Navara 6db2c5a1f8 Import System.Security.Cryptography.Pkcs from CoreFX. (#8994)
* Import System.Security.Cryptography.Pkcs from CoreFX.

* Change 'as' operator to a cast.

* Add missing EnvelopedCms overloads.

* Include CMS signing classes in all builds.

* [csproj] Update project files

* Add missing DSACertificateExtensions class.

* Update references.

* Rename EnvelopedCms.Overloads.cs to EnvelopedCms.cs.

* Enable some of the System.Security.Cryptography.Pkcs xunit tests.

* Update references.

* Bump API snapshot submodule

* Disable xunit tests that may depend on Windows PAL.

Contributes to https://github.com/mono/mono/issues/7589
2018-06-18 09:39:19 +02:00
Filip Navara ec988c857d Improve certificate type detection and exception messages on import (#9162)
One unit test is removed as part of the commit because it is not consistent with documentation and CoreFX behaviour on non-Windows platforms (https://github.com/dotnet/corefx/issues/30416).

The main goal of this patch is to actually get meaningful error messages when constructing X509Certificate2 from a byte array. Previously PKCS#12/PFX certificate import could fail due to unimplemented features (such as ECDsa support) or bugs. The certificate import would then be retried as PKCS#7 and the original error message was lost.
2018-06-18 09:18:51 +02:00
Bernhard Urban 9472fb990f [System] align Nullable.Equals behaviour with .NET core (#9165) 2018-06-18 08:49:07 +02:00
Jay Krell 929936e9c2 Reduce calls to mono_target_pagesize. 2018-06-17 23:41:21 -07:00
Jay Krell b372714862 Disable thread7 test for interpreter, like thread6. (#9191)
Tracked in https://github.com/mono/mono/issues/9000
2018-06-18 02:38:44 +02:00
Jay Krell 507464a36b Cleanup. 2018-06-16 23:03:47 -07:00
Jay Krell f3319f7935 Fix non-interprter hang at shutdown of thread6 and thread7. 2018-06-16 23:03:47 -07:00
Jay Krell fef2948af7 Add subset of thread6.cs. It merely hangs randomly at shutdown, but always passes.
A launcher with short timeout would ideally exist around it.
2018-06-16 23:03:47 -07:00
Jay Krell 95e7ae9c29 Fix some handle type violations. (#9154)
* Fix some handle type violations.

* MONO_HANDLE_CAST (MonoArray, NULL_HANDLE)
is fragile and deprecated except in optimized hot paths,
prefer NEW instead. NULL_HANDLE is const and cannot be assigned to,
NEW is not const and can be assigned to. It takes extra validation
to insure NULL_HANDLE is correct, and it is usually not worthwhile.
2018-06-16 16:51:54 -07:00
Bernhard Urban 56de3e9a82 [profiler] account for nullbyte in allocated buffer (#9166)
[profiler] account for nullbyte in allocated buffer

probably fixes https://github.com/mono/mono/issues/9106
2018-06-16 09:25:06 -04:00
Alexander Köplinger c0ebd71174 Bump bockbuild to fix environment variables expansion bug (#9178)
Brings in https://github.com/mono/bockbuild/pull/67.

This fixes the msbuild build problem where it'd crash with `error MSB4242: The SDK resolver "NuGetSdkResolver" failed to run. Unexpected failure reading NuGet.Config. Path: '@/external/bockbuild/builds/msbuild-15/artifacts/toolset/restore.proj/$HOME/.config/NuGet/NuGet.Config'.`.

The reason is that bockbuild exported the `XDG_CONFIG_HOME` environment variable with the value `$HOME/.config`. The problem is that the `$HOME` in there is never expanded so it just stays as the literal value.

`XDG_CONFIG_HOME` is later used by e.g. `Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)` which is what nuget uses to construct the path to NuGet.config - hence why we end up with the weird path.

We now just expand the variables in bockbuild before we pass them on.

Fixes https://github.com/mono/mono/issues/9179

(cherry-picked from cb54c26f6c)
2018-06-16 10:38:50 +02:00
Jay Krell f93455f80c A little combining of common code before coop convereion. (#9160) 2018-06-15 16:36:38 -07:00
Alexander Kyte b6c70d1bbe [runtime] Make mono-state dumper abandon stuck threads
Threads which do things with signals and locks may end up unresponsive
to our signals. I cannot get threads that crash in a lock to respond to
SIGTERM on Darwin even if I explicitly unmask SIGTERM on those threads.

In order to defensively program against platform bugs around signals and
stubborn threads, we need to be able to abandon these threads and
continue, dumping other threads.
2018-06-15 17:49:20 -04:00
Bernhard Urban 0a9976f1c8 [tests] reduce IO load in process-stress-3 (#9152)
[tests] reduce IO load in process-stress-3

The spawned process by the test iterates through the whole mono repo,
including submodules. On a loaded machine with a already slow I/O
device, 10 seconds could be a tight time budget. Instead of increasing
the timeout, let's try to reduce the generated output.

Fixes https://github.com/mono/mono/issues/6947 hopefully.
2018-06-15 16:55:05 -04:00
Jay Krell 91d9c7224d Don't call mono_thread_info_current_unchecked for non-alertable waits. (#9157) 2018-06-15 13:28:19 -07:00
Alexander Köplinger 9660cd2290 Bump bockbuild 2018-06-15 19:00:30 +02:00
Alexander Köplinger 0638564f5b Bump bockbuild 2018-06-15 18:59:53 +02:00
Cody Russell 97791c408f Bump bockbuild to get GTK fix for find_nsview_at_pos() (#8951) 2018-06-15 18:58:19 +02:00
Marek Habersack 028ff0d34c [Linux,XA build] Fix building of Windows cross-compilers on Ubuntu Linux (#9150)
Ubuntu Linux (possibly others too, but only Ubuntu is tested thus the
limitation) don't need to build or use `mxe`, they instead use mingw packaged
for the distribution, thus making the build faster.

This commit detects the Linux flavor in use and, if it's Ubuntu, configures the
build so that system mingw is used instead of mxe.
2018-06-15 00:40:04 -07:00
Jay Krell 832e31227b Restore the ability to regenerate opcode.def form Perl/XML, though CI cannot and does not. (#9111) 2018-06-14 23:00:12 -07:00
Jay Krell 86784a9bac Save a coop/handle frame per PR feedback. (#9110) 2018-06-14 14:26:19 -07:00
Alexander Köplinger 7817a8f152 [Mono.Profiler.Log] Disable HeapshotDataIsValid and fix MonitorEventsAreRecorded tests (#9143)
See https://github.com/mono/mono/issues/8709.
2018-06-14 22:39:05 +02:00
Aleksey Kliger 2bedfdee2c Revert "[mini] Remove unneeded restriction on fast delegate creation for context-using generic delegate under gshared. (#8987)"
This reverts commit 0c9719c496.
2018-06-14 16:00:27 -04:00
Aleksey Kliger 702604725d [loader] extra debug trace messages 2018-06-14 16:00:27 -04:00
Aleksey Kliger f9667d338f [mini] Add open instantiation type to error message when jitting 2018-06-14 16:00:27 -04:00
Aleksey Kliger 60f06e6ca2 [loader] Refonly load of problematic image is allowed.
Followup for 9ad5255338

Note that on win32 we already did the right thing because of nested
conditionals in mono_image_open_a_lot, but on non-win32 we need the extra
check.
2018-06-14 16:00:27 -04:00
Rodrigo Kumpera 28a20c336c [sdb] Extract sdb specific code from process_single_step_inner. 2018-06-14 14:49:08 -04:00
Rodrigo Kumpera 0b3e8ff851 [sdb] Factor sdb specific code out of process_breakpoint/process_single_step_inner. 2018-06-14 14:49:08 -04:00
Rodrigo Kumpera 1892e4c50a [sdb] Push debugger-engine types a bit further on where we should expect them to show up later. 2018-06-14 14:49:08 -04:00
Rodrigo Kumpera 36df5a3a94 [sdb] Update ss_calculate_framecount to have out params for frames and frame count. 2018-06-14 14:49:08 -04:00
Rodrigo Kumpera fb80d964fb [sdb] Converge all frame state update under a single function. 2018-06-14 14:49:08 -04:00
Ilya Shipitsin d8dcc3a3f1 cleanup: fix string formatting (#9123)
[mono/mini/helpers.c:195]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.

[mono/mini/helpers.c:197]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.
2018-06-14 13:49:12 -04:00
Rodrigo Kumpera 5b8c9d0f36 Merge pull request #9079 from kumpera/de_engine_part4
[WIP] Next batch of sdb changes towards splitting the debugger engine.
2018-06-14 11:28:40 -04:00
Jay Krell c4d056928d Quash countless warnings until/unless other work is done to address them. (#9115) 2018-06-14 10:33:16 -04:00
Jay Krell 15a40b60b9 Replace powershell in winsetup.bat with pure batch script (#9093)
This reduces our dependency on powershell.
2018-06-14 16:07:45 +02:00
Ludovic Henry 927ae95702 [build] Rename darwin platform to macos + Add unix host platform (#9022)
* [mcs] Rename darwin paltform to macos

Darwin is common to both macOS and iOS/tvOS/watchOS, while we use the darwin platform only for macOS.

* [mcs] Add Unix platform for other Unixes than Linux

* [mcs] Remove PLATFORMS from xammac_net_4_5 since it only make sense on macos

* [bcl] Bump corlib version

* [csproj] Update project files
2018-06-13 20:39:56 -04:00
Marek Habersack 049af74f60 [SDKS,Android] Install cmake when provisioning Android SDK (#9125)
Android NDK supports cmake in addition to the older make-based ndk-build as the
build system and Xamarin.Android is in the process of switching the build of its
native bits to cmake. The reason for this switch is that certain parts of
Xamarin.Android (libmonodroid) are built for both the host system and
the Android target. The host system build currently uses hand-crafted code
directly in .csproj to build the native bits while the Android build uses
ndk-build. This results in duplication of code, compiler parameters are
specified in two locations - it is easy to introduce incompatibilities, bug
fixes may be applied only in one scenario etc.

Using cmake allows us to use a single build "script" for all the targets, thus
making the build more reliable. Android SDK has a cmake package which contains
full support for NDK builds and allows us to easily use cmake across all the
supported platforms without having to install cmake on the host system.

This commit adds the cmake package to the Android SDK provisiong process and,
alas, at the same time adds a workaround to properly unpack the package. Unlike
other Android SDK packages, cmake doesn't unpack to a single subdirectory of the
zip root, instead all its files and directories are placed directly in the zip
root. This requires yet another workaround to install the package properly.
2018-06-13 15:19:18 -07:00
Bernhard Urban a51df5a9f8 [null checks] do implicit null checking only on first page (#8912)
[segfault] hard crash if it is not a NRE

that is, if a `ji` is available, but the offset is too large to be a
plausible implicit null pointer.


The "upper bound" must be higher, but I don't know a good value. Any good suggestions other than "increase the value until all tests are passing"?
2018-06-13 16:25:32 -04:00
Rodrigo Kumpera a2899e50f9 [mini] Eliminate some sources of quadratic behavior. Improves on #7809. (#9100)
* [mini] Change region formation pivot from BB to EH clause.

The original BB region computation would loop all BBs and search which EH clause each of them.
EH search is implemented as a linear search, meaning performance was count(BB) * count(clauses).
Since each clause generates at least one BB, it's quadratic on the number of clauses.

Degenerate methods, with tens of thousands of EH clauses, would lead to minutes of JIT time.

New code loops over the clauses and mark all BBs covered by each of them. Given EH ranges are a much
smaller subset of all BBs, this performs significantly better. It remains possible to construct methods
that leads to degenerate compilation times, but it's less likely now.

* [mini] Bound the size of a linked list during liveness.

The `visited` linked list can grown to tens of thousands of entries with some degenerate methods.
This change uses a stack allocated array and switches to a hashtable on overflow.

* [mini] Change printf to g_print

* [mini][amd64] Limit more precise branch target optimization based on number of basic blocks.

On amd64 we update branch target data before each BB is emitted. This has quadratic behavior on number of basic blocks
and can lead to excessive compilation times in degenerate cases.

Limit the increased precision to methods with less than 800 basic blocks.

Reduces compilation time of #7809 by 88% (from 44s to 5s).
2018-06-13 20:37:17 +02:00
Bernhard Urban 9d777bf78d [interp] check existence of InterpMethod before removing it from interp code hastable (#9116)
When creating dynamic methods, we put those in a queue so they can be collected later via `mono_jit_free_method ()`. the interpreter part was assuming, as soon as we allocate a dynamic method, it will be executed eventually and therefore an InterpMethod must exist in `info.interp_code_hash`, but this isn't necessarily the case.

Fixes https://github.com/mono/mono/issues/9109
2018-06-13 14:57:11 +02:00
Rodrigo Kumpera a03301dbd1 [profiler] Don't raise events until the profiler transitions to the ready state. Fixes #8866.
We can't raise event before that as the profiler depends on too much runtime
infrastructure at this point for it to reliably work.

For example, we need the threading infrastructure to be init'd so we can access the
thread-local profiler state to store events there.
2018-06-13 14:40:30 +02:00
Zoltan Varga 421bc2b228 [ppc] Lower OP_LMUL_IMM. (#9108) 2018-06-13 12:59:47 +02:00
Filip Navara 272d70cfdc Fix quoting of BMPString names in X501Name. (#9105)
* Fix quoting of BMPString names in X501Name.

* Fix the set of characters in X.501 name that need quoting.
2018-06-13 10:37:45 +02:00
Martin Baulig 626ac86a03 [System]: Fix another SocketAsyncEventArgs issue for #8871. (#8938) 2018-06-13 10:18:27 +02:00
Rodrigo Kumpera 5d19857e77 [wasm] Add new icall signature needed by upcoming CoreFX merge. (#9107) 2018-06-13 09:23:00 +02:00
Katelyn Gadd fb28fefbc2 Fix canon names not being returned from mono_get_address_info. Fixes issue #8935. 2018-06-12 19:15:26 -07:00
Rodrigo Kumpera 626ab1064c [corlib] Allow DM with an extra param to have the first one bound to null. Fixes #9033. 2018-06-12 13:39:01 +02:00
Ilya Shipitsin 03bdf34ec9 cleanup: remove redundant condition (#9081)
issue detected by cppcheck

[mono/metadata/threads.c:3993] -> [mono/metadata/threads.c:3991]:
(warning) Either the condition 'if(location&&location->source_file)'
is redundant or there is possible null pointer dereference: location.

condition is redundant indeed, it is nested in "if (location) {"
2018-06-12 13:15:25 +02:00
Alexander Köplinger 285ac217fe Bump api-snapshot submodule 2018-06-12 11:25:11 +02:00
Maxim Lipnin 7454c2de2b Include pseudo custom attributes to CustomAttributes property (#9024)
Fixes #7615
2018-06-11 23:42:05 -07:00
Artem Bukhonov b26a41cc3e Reading of Metadata and pdb blobs via Soft debugger protocol (#9082)
* Support reading metadata and pdb from vm

* Add tests for reading metadata and pdb from vm
2018-06-11 23:40:46 -07:00
Zoltan Varga 2c3cb8dd81 [jit] Add Span<T> intrinsics. (#9086)
* [jit] Add some rules to the local propagation pass to transform iconst+sext+mul into mul_imm.

* [jit] Make OP_LDLEN more general by storing the offset of the array length field in it.

* [jit] Add span intrinsics.

* [jit] Avoid converting Span.get_Length () to OP_LDLEN, it doesn't help abcrem. Avoid asserts when running on portable spans.

* [jit] Convert Span.get_Length () to OP_LDLEN, only mark the loading of array lengths invariant.
2018-06-11 18:35:07 -07:00
Jay Krell a48ba551de Improve UWP support. (#8963)
* [uwp] UWP supports: ReplaceFile CopyFile LockFile UnlockFile GetDriveType GetComputerNameW
Some of these were already supported and identical code copied.

* Remove pre-Windows 2000 support -- use GetFileSizeEx instead of GetFileSize.
UWP does not support GetFileSize.

* Introduce fine-grained ifdefs.
This should make maintenance of Win32 subsets easier (see w32subset.h).

* Generally the code should be/stay in "classic.c" and the "uwp.c" files can/should go away. The uwp.c files were a medium-sized granularlity of reuse/replace, but the fine-grained ifdefs are better/smaller -- more code reuse.
2018-06-11 16:13:03 -07:00
Jay Krell 3ac50563db [Coop] Convert ves_icall_System_Threading_Thread_GetAbortExceptionState. (#9050)
Which involves:
	`serialize_object`
	`deserialize_object`
	`mono_object_xdomain_representation`

and then the other users of `mono_object_xdomain_representation`:
	`create_unhandled_exception_eventargs`
	`call_unhandled_exception_delegate`
2018-06-11 12:22:04 -07:00
Jo Shields 288b3b8c0e [dist] Ensure gensources.cs is included in tarballs (#9098) 2018-06-11 20:17:30 +02:00
Egor Bogatov 247bb19e59 bump corefx for #79 2018-06-11 08:21:38 -07:00
Calvin Buckley b30cedda60 Check for *_CLOEXEC flags used by CoreFX PAL 2018-06-11 08:20:29 -07:00
Jay Krell 1b10d7d9b7 [Coop] Convert Mono.Security.Cryptography.KeyPairPersistence and System.Security.Principal.WindowsImpersonationContext. (#8608)
* [Coop] Convert Mono.Security.Cryptography.KeyPairPersistence and System.Security.Principal.WindowsImpersonationContext.

* Bump corlib version.
2018-06-10 22:25:26 -07:00
Zoltan Varga 1a91bb9939 [runtime] Store the interpreter method invoked by the delegate in MonoDelegate.interp_method, make MonoDelegate.method_ptr always point to a JIT callable entry point. (#9019)
* [runtime] Add an 'interp_method' field to MonoDelegate.

* [runtime] Add a MONO_LD_DELEGATE_PTR jit opcode which is used to load the method ptr from a delegate, so the JIT and interpreter could have a different implementation.

* [runtime] Store the interpreter method invoked by the delegate in MonoDelegate.interp_method, make MonoDelegate.method_ptr always point to a JIT callable entry point.

* [interp] Avoid sharing pinvoke and non-pinvoke signatures in mini_get_interp_in_wrapper ().

* [interp] Fix interp_get_remoting_invoke (), it receives a interp entry trampoline as well.

* [interp] Store remoting invokes into interp_method in delegates.

* [interp] Handle compilation failures in do_jit_icall (). Handle calls to delegates created in JITted code.

* [jit] Add a 'aot-skip=' MONO_DEBUG option to skip loading the Nth aot loadable method, useful for forcing mixed mode transitions during testing.

* [jit] Add tests for fullaot+interp mode

The tests work by injecting interp-jit transitions in varying locations controlled by the MONO_DEBUG=aot-skip= option.

* [interp] Avoid races when caching method pointers. Fix wasm support.

* Revert "[interp] Avoid races when caching method pointers. Fix wasm support."

This reverts commit 0f78c230b5102d625c300a4e1c6eaf97ad055dd5.

* [interp] stub native-to-managed on platforms where it is not working

* [ci] add fullaotmixed-regression step
2018-06-09 07:55:23 -07:00
Alexis Christoforides 5e842cd20d Update bockbuild for artifact expiration (#9068)
Fixes https://github.com/mono/mono/issues/8707
2018-06-08 12:26:47 -07:00
Jay Krell 0d27e20b32 [Coop] Partially convert COM interop. (#8947)
* [Coop] Convert ves_icall_System_ComObject_CreateRCW.

* Move mono_class_init_checked from static in icall.c to class-internals.h / class-init.c.
Also have it return gboolean (redundant with MonoError).

* [Coop] Convert ves_icall_System_ComObject_GetInterfaceInternal.

* [Coop] Convert ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal.

* [Coop] Partial convert ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal.

* [Coop] Convert ves_icall_System_Runtime_InteropServices_Marshal_GetCCW.
2018-06-08 11:53:58 -07:00
Egor Bogatov 973ca67c4f library.make: track changes in *.sources (#9061)
Currently if we change for example `corlib.dll.sources` and then execute `make` - the `make` won't rebuild the lib, because it depends only on `net_4_x_corlib.dll.sources` and doesn't depend on all `#include` inside it.
As a temporarily solution we can depend on all *.sources files in the directory so a change in any of them will trigger rebuild. Unfortunately changes in un-related profiles will also trigger the rebuild but it's better than nothing for now I guess. For better experience we should fetch all #includes recursively for the current profile
2018-06-08 10:56:47 -07:00
Alexis Christoforides 7952c2d3de Merge pull request #8704 from MaximLipnin/corefx_import_System.Security
CoreFX import for set of simple common types in System.Security
2018-06-08 09:31:58 -07:00
monojenkins 5354fa98a7 [csproj] Update project files 2018-06-08 16:30:11 +00:00
Jay Krell 9bc218dc11 Disable flaky interp thread6 test. (#9059) 2018-06-07 22:35:22 -07:00
Mikhail Filippov 8b0f258d9d Unblock signal when adding mono signal handler (#9054) 2018-06-07 18:03:22 -07:00
Rodrigo Kumpera 05e32f52d0 [sdb] Move some declaration to debugger-engine.h 2018-06-07 17:42:39 -07:00
Rodrigo Kumpera 751f2211d1 [sdb] Extract ss_args_destroy to cleanup SingleStepArgs. 2018-06-07 17:34:25 -07:00
Rodrigo Kumpera 06ae298d16 [sdb] Extract ss_create_init_args that has all sdb-specific logic. 2018-06-07 17:31:30 -07:00
Rodrigo Kumpera 13a51cc707 [sdb] Pack ss_start arguments into a struct. They depend too much on sdb specific state. 2018-06-07 17:12:43 -07:00
Rodrigo Kumpera d9dad5254e [sdb] Extract ensure_runtime_is_suspended 2018-06-07 16:22:35 -07:00
Atsushi Eno 4a0dc74d14 update to Android P final API. (#9069) 2018-06-07 16:14:19 -07:00
Rodrigo Kumpera 5bb181aeaf [sdb] Small cleanup to frame management code. 2018-06-07 15:58:30 -07:00
Jay Krell 999e7afa83 Add missing error check and factor out common code. (#8873)
* Add missing error check between open and stat.
* Factor common code.
2018-06-07 15:27:11 -07:00
Rodrigo Kumpera 067b85c038 Merge pull request #8937 from kumpera/de_engine_part3
[sdb][wasm][debugger-engine] Cleanup & extract enough that it's possible to move the breakpoint code over.
2018-06-07 15:24:19 -07:00
Rodrigo Kumpera 0c9719c496 [mini] Remove unneeded restriction on fast delegate creation for context-using generic delegate under gshared. (#8987)
The only reason for the restriction was that handle_alloc previously would not handle generic instances.

This speeded up the following microbenchmark by 19x (3.38s x 0.17s):

```
class Driver {
	static T Identity<T> (T t) {
		return t;
	}

	[MethodImpl(MethodImplOptions.NoInlining)]
	static Func<T,T> MakeDelegate<T> () {
		return new Func<T, T> (Identity);
	}

	static void Main () {
		object o = new object ();
		for (int i = 0; i < 400 * 1000; ++i) {
			MakeDelegate<object>()(o);
		}
	}
}
```
2018-06-07 13:58:23 -07:00
Jay Krell 30313d2c44 Refactor ves_icall_System_Threading_Monitor_Monitor_pulse and pulse_all. (#8960) 2018-06-07 01:46:04 -07:00
Jay Krell 9bd3b2d01f Add volatile to error message to improve debuggability. (#9032)
https://jenkins.mono-project.com/job/test-mono-pull-request-coop/4300/testReport/junit/MonoTests/runtime/threadpool_exceptions5_exe_timedout/

`#22 0x000055da5ac70001 in mono_fatal_with_history (msg=<optimized out>) at checked-build.c:331`
2018-06-05 19:36:27 -07:00
Jay Krell cfceb6643b [Coop] Cleanup ahead of converting ves_icall_System_Threading_Thread_… (#9027)
* [Coop] Cleanup ahead of converting ves_icall_System_Threading_Thread_GetAbortExceptionState.
 - serialize_object and deserialize_object are almost identical and
   can be implemented on top of the same function.
 - Error propagation was a little wierd and had FIXME comments.
   It involved MonoError, MonoException, and gboolean *failed, and
   some conversions. Converge on mostly MonoError, with fewer conversions,
   albeit still sometimes holding a MonoException.

* Move error parameter to last.
Move static locals to global -- more easily seen in debugger.
Remove errant exclamation point.
2018-06-05 21:53:18 -04:00
Jay Krell c99d248336 [Coop] Convert System.Security.Principal.WindowsPrincipal. (#8943)
* [Coop] Convert System.Security.Principal.WindowsPrincipal.
* Start functions at start of line for grep.
2018-06-05 16:12:03 -07:00
Zoltan Varga 1f2aec08dd [interp] Transition mono_interp_transform_method () to use MonoError. (#9029) 2018-06-05 19:03:33 -04:00
Zoltan Varga b0707c178a Mixed testing (#9021)
* [jit] Make the interp_in wrappers work better with byref arguments.

* [runtime] Move some EH tests to exceptions.cs.

* [interp] Fix some problems in the interp entry/exit code in mixed mode.

* [jit] Avoid code patching from gshared code when the callee is an interp entry trampoline.

* [aot] Map byref return values to int&.

* [interp] Handle r4 return values in do_jit_call ().
2018-06-05 12:42:56 -04:00
Maxim Lipnin 3deca0e19d [System.Security] Revert the change for AlgorithmIdentifier type due to unresolved API breaking change on corefx side. 2018-06-05 17:09:12 +03:00
Jay Krell 6fcb562d5e [coop] Convert ves_icall_System_Runtime_Versioning_VersioningHelper_GetRuntimeId. (#9012) 2018-06-05 00:47:29 -07:00
Maxim Lipnin f1ab78f699 Merge branch 'master' into corefx_import_System.Security 2018-06-05 10:27:09 +03:00
Egor Bogatov 18a3eefdc8 Bump corefx (#9020)
The aim is to get this fix dotnet/coreclr#18254
2018-06-04 13:09:14 -07:00
Jo Shields 74ac98b74c Bump version to 5.17 (#9016) 2018-06-04 13:07:37 -07:00
Alexander Köplinger 3bc113b6df Fix monolite build 2018-06-04 10:15:32 -07:00
Alexander Köplinger ae5a579e22 Update csproj files 2018-06-04 10:05:49 -07:00
Maxim Lipnin f93105cce1 Merge branch 'master' into corefx_import_System.Security 2018-06-04 11:37:30 +03:00
Jay Krell 8ecf04ff48 Ensure order of evaluation is guaranteed. (#9006) 2018-06-03 21:09:05 -07:00
Alexis Christoforides 01cfa52e3c Merge pull request #8989 from jaykrell/comrace
Fix race condition in ves_icall_Mono_Interop_ComInteropProxy_AddProxy.
2018-06-03 14:32:54 -04:00
Jay Krell 0ddf2d839e [bitcode] Fix building -with-runtime-preset=bitcode. (#8969)
* [bitcode] Fix building -with-runtime-preset=bitcode.
Not clear if this is correct, but let build progress.

* Use libmono_dep instead.
2018-06-03 08:50:37 +02:00
Marek Safar a6d12ab738 [System.Runtime.Serialization] Makes more APIs work for mobile 2018-06-03 08:44:06 +02:00
Jay Krell 68dfbf9bc6 Remove ServiceControllerTest.cs.
Mitigates https://github.com/mono/mono/issues/9002.
2018-06-03 08:30:02 +02:00
Marek Safar 6dc371f6df [build] Adds System.IO.Compression csc dependency 2018-06-02 09:44:00 +02:00
Paul Fertser 62c0db6457 [wcf] Fix memory leak processing requests
This partially reverts commit 1628f04de5 .

Runtime tested and confirmed to fix issue #8970 and allows long-term
operation of RapidSCADA.
2018-06-01 17:38:04 +02:00
Alexis Christoforides 72471b5325 Merge pull request #8978 from migueldeicaza/ikdasm-bump
Bring ikdasm changes to support private protected decompilation
2018-06-01 08:02:40 -04:00
Zoltan Varga 0c8073200a [bitcode] Fix the generation of invalid llvm IR for some Span code. (#8980) 2018-06-01 05:54:57 -04:00
Calvin Buckley 4ada161b3c Make the sendfile with 6 args check use AC_TRY_LINK
This lets the linker catch any missing symbols, and fixes a problem
I had building AIX with CoreFX PAL. Fixes #8979, though there may
be more cases like this.

dotnet/corefx#30012 is blocking on this.
2018-06-01 11:18:14 +02:00
Rodrigo Kumpera 081c4b4c14 [sdb] Extract try_process_suspend. 2018-06-01 01:25:05 -04:00
Rodrigo Kumpera fc24b16072 [sdb] Remove duplicate code in process_breakpoint. 2018-06-01 01:25:05 -04:00
Rodrigo Kumpera 1626ad0026 [sdb] [wasm] Extract DbgEngineStackFrame struct that has the fields used by bp/ss. 2018-06-01 01:25:05 -04:00
Jay Krell ca4c26380f Fix race condition in ves_icall_Mono_Interop_ComInteropProxy_AddProxy. 2018-05-31 16:53:37 -07:00
Jay Krell f3157ed8ed Cleanup varargs. (#8589)
Change 3 ifdef versions to one portable one.
Remove supporting autoconf that did not work as intended.
See https://github.com/mono/mono/issues/8587.
2018-05-31 15:59:15 -07:00
monojenkins ab4d81e794 [csproj] Update project files 2018-05-31 23:34:33 +02:00
monojenkins d361c88e67 Bump API snapshot submodule 2018-05-31 23:34:33 +02:00
Marek Safar 7787785af3 [corlib] Removes multiplex approach 2018-05-31 23:34:33 +02:00
Miguel de Icaza c05effd7f4 Bring ikdasm changes to support private protected decompilation 2018-05-31 13:47:34 -04:00
Martin Baulig da2de44fe8 [corlib]: Add System.HashCode - revisiting #8822 and #8879. (#8934)
Enable `System.HashCode` again, cleanup the `.sources` files and fix the Windows build.
2018-05-31 16:46:00 +02:00
Martin Baulig e5cd5a992e [build]: Make 'gensources' look for platform-specific .sources files as well. 2018-05-31 15:59:36 +02:00
Nick Craver 23fd728c9a Issue template: update help link to https://
Since GitHub pages rolled out HTTPS support, links to `www.mono-project.com` can now be `https://` :) This also removes a `www.` 301 users currently hits.
2018-05-31 14:24:28 +02:00
Zoltan Varga c972668876 [runtime] Fix the --enable-minimal=aot build. (#8952)
Fixes https://github.com/mono/mono/issues/8430.
2018-05-30 19:52:50 -04:00
monojenkins 3a630bff26 Bump API snapshot submodule 2018-05-31 00:01:58 +02:00
EgorBo 8afcf1b455 remove implicit operator String (ReadOnlySpan<char> value) 2018-05-31 00:01:58 +02:00
Alexis Christoforides 42b9868dda Merge pull request #8719 from mono/fix-gh-8712
[System.IO] Finish initializing all FileSystemWatchers, not just the f…
2018-05-30 15:31:49 -04:00
Marek Safar 7912154616 [acceptance-tests] Bump roslyn tests to match bundled version 2018-05-30 17:41:21 +02:00
Alexis Christoforides bc4a1b31c5 [System.IO] Dispatch events asynchronously in FileSystemWatcher.DispatchEvents()
This used to happen in RaiseEvents(), but some CoreFX FSW tests require that a derived FSW be able to fire its event synchronously.
2018-05-30 09:54:02 -04:00
Alexis Christoforides 2fe6c6bfba [System.IO] Prevent the CoreFX bridge from even try-entering a monitor.
In the case of the FSEvent FileSystemWatcher, the CFRunLoop event loop thread has already an interrupt handler installed in the icall, and mono_monitor_try_enter  may try to install one as well which is not supported. So we create separate event tasks before we use the Operation() method.
2018-05-30 09:42:57 -04:00
Bernhard Urban 2731ac99f8 [native crash] limit output of process mapping (#8910)
[native crash] limit output of process mapping

less noise
2018-05-30 09:40:09 -04:00
Bernhard Urban a7f8569be7 [native crash] dump memory around instruction pointer (#8911)
[native crash] dump memory around instruction pointer

It can help to identify issues in generated code. We don't want to ship a disassembler, so we just do a hexdump. It looks like this:

```
Memory around native instruction pointer (0x10ca1b50e):
0x10ca1b4fe  48 c7 04 24 00 00 00 00 48 8b 44 24 10 48 8b f8  H..$....H.D$.H..
0x10ca1b50e  83 38 00 48 8d 64 24 00 49 bb 3a b5 a1 0c 01 00  .8.H.d$.I.:.....
0x10ca1b51e  00 00 41 ff d3 48 89 04 24 e9 00 00 00 00 48 8b  ..A..H..$.....H.
0x10ca1b52e  04 24 e9 00 00 00 00 48 83 c4 18 c3 e8 c1 1c 53  .$.....H.......S
```

Offline tools can be used to disassemble the code.
2018-05-30 09:25:08 -04:00
Alexander Köplinger 3a8218e5d5 [bcl] Fix ONO_PATH warning during resgen (#8933)
We'd get the following warning during the build:

```
'/Users/alexander/dev/mono/mcs/class/System.Data.Services.Client/ONO_PATH' in MONO_PATH doesn't exist or has wrong permissions.
```

The reason is that we didn't escape the $ symbol in the resgen template
so the embedded $$MONO_PATH in the RESGEN variable ended up being mangled.

I'm kinda surprised this worked at all for so many years ¯\_(ツ)_/¯
2018-05-29 20:01:07 -04:00
Marek Safar f37db9cf90 [System.Web] Fix bug with not preserving state of CheckBoxList after postback because of value beeing rendered (#8928) 2018-05-30 00:31:51 +02:00
Marek Safar 6a7bd7be27 [Facades] Adds few netcore extensions (#8907)
* [Facades] Adds few netcore extensions

Fixes #7947

* Bump API snapshot submodule

* [csproj] Update project files
2018-05-30 00:22:36 +02:00
Ankit Jain 4adf7104ea Bump binary-reference-assemblies (#8929)
Includes the fix for https://bugzilla.xamarin.com/show_bug.cgi?id=23668
via https://github.com/mono/reference-assemblies/pull/7
2018-05-30 00:10:37 +02:00
Ankit Jain dd6fe29769 [roslyn][msbuild] Copy the new Microsoft.Managed.Core.targets file in roslyn. (#8931)
Fixes https://github.com/mono/mono/issues/8897 .
2018-05-30 00:09:31 +02:00
Rodrigo Kumpera 49bf0734af [debugger-engine] Extract breakpoint code from sdb into debugger-engine. 2018-05-29 16:40:21 -04:00
Alexis Christoforides 183d994a91 [System.IO] Finish initializing all FileSystemWatchers, not just the first one
Fixes https://github.com/mono/mono/issues/8712
2018-05-29 16:25:21 -04:00
Rodrigo Kumpera 010eb31409 [sdb] Move domain handling to debugger-engine. 2018-05-29 16:16:05 -04:00
Rodrigo Kumpera 42e03148ac [sdb] Move all iteration over domain to use foreach. Will make it easy to move domain management to DE later. 2018-05-29 16:07:41 -04:00
Marek Safar 362fc27e2b [build] Includes tools used by XI/XA build CI in build profile (#8924) 2018-05-29 13:36:07 -04:00
Marek Safar 8a26830b47 Update issues template (#8920) 2018-05-29 13:35:02 -04:00
Aleksey Kliger (λgeek) 6bd212f142 [loader] Ignore version if asssembly name isn't a strong name (#8821)
* [loader] Make mono_assembly_names_equal_flags visible

Previously was static assembly_names_equal_flags in assembly.c

Add "mono" prefix to all the names

* [loader] Ignore version if assembly name isn't a strong name

When checking if a loaded assembly satisfies a request for a given assembly
name, don't compare versions if requested name doesn't include a public key
token.

Fixes https://github.com/mono/mono/issues/8820

* [loader] Add MONO_ANAME_EQ_IGNORE_CASE flag

In some circumstances we may need to compare one MonoAssemblyName to another
ignore case differences in simple names (ie "Asm1" vs "asm1" should be
considered equal)

* [tests] Regression test for simple name assembly preloading

Regression test for https://github.com/mono/mono/issues/8820

If one assembly references another that has a simple name (no public key), then
the requested version and the actual version don't need to match.

Also - the simple names are compared case-insensitively.

* [loader] When looking for already loaded assemblies, ignore case differences

When we're looking for a loaded assembly by simple name, ignore case differences.
2018-05-29 13:26:04 -04:00
Vlad Brezae afa15fe0a0 [interp] Fix monitor-abort.exe (#8880) 2018-05-29 13:21:08 -04:00
Rodrigo Kumpera 93748c6453 [sdb] Extract event_requests_cleanup from breakpoints_cleanup. 2018-05-29 13:15:27 -04:00
Marek Safar cc131fedcc [sdks] Fixes llvm branch name (#8926) 2018-05-29 13:08:20 -04:00
Rodrigo Kumpera 6963fc5cd5 [debugger-engine] Transplant logging macros to ease landing sdb code. 2018-05-29 13:07:28 -04:00
Rodrigo Kumpera 26bb29b842 [sdb] Extract collect_breakpoints_by_sp and cleanup ifdef in remove_breakpoint. 2018-05-29 12:57:26 -04:00
Jay Krell 3c7a203fc0 Fix failure to set out parameter. (#8902)
* Fix failure to set out parameter.
2018-05-29 05:10:41 -07:00
Marek Safar 4f50921689 [runtime] Remove incorrect checks which are also duplicates of MakeTypedReference checks.
Fixes #8915
2018-05-29 13:22:58 +02:00
EgorBo fbb7c4d877 make SocketAsyncEventArgs reusable 2018-05-29 08:18:47 +02:00
Zoltan Varga 7c38aca9ab [sdks] Include the embedded.mobileprovision file in the generate apps on ios. (#8906) 2018-05-28 08:54:14 -04:00
Alexis Christoforides a1bb39504f Bump corefx 2018-05-27 11:13:36 +02:00
Marek Safar e6192eaa59 Bump corefx 2018-05-26 19:27:14 +02:00
Bernhard Urban 92d9a3ca16 [Mono.Debugger.Soft.Test] Use interp on debugee (#8851)
* [debugger tests] use runtime flags for debugee

* [debugger] handle managed-to-native frames

fixes DebuggerTests.InspectThreadSuspenedOnWaitOne on the interpreter

* [interp] set SP in monoctx that is passed to exception handling

fixes DebuggerTests.ExceptionFilter on the interpreter

* [debugger] fix debugger_invoke frame in interp case

fixes DebuggerTests.BreakpointDuringInvoke on the interpreter
2018-05-25 17:57:51 -04:00
Jay Krell fae3b3506a Fix bunch of new gcc/linux warnings I recently introduced by accident. (#8810)
Due to commits 1507b9b531 and 298aa78a47.

Note the warnings to not indicate a bug and fixing the warnings does not change behavior.
2018-05-25 14:51:24 -07:00
Ludovic Henry 583a9960f0 [icall] Add a NOHANDLES wrapper (#8862) 2018-05-25 17:43:06 -04:00
Alexander Kyte 2e6adee718 [runtime] Fix capitalization on merp config file field name (#8868) 2018-05-25 14:39:54 -04:00
Mikayla Hutchinson acb62ba21a Add wasm gitignore (#8890) 2018-05-25 14:39:18 -04:00
Vlad Brezae ba0c0591f3 [threadpool] Clear data field of MonoListItem after we are done with it (#8863)
Currently the list elements are allocated in the root domain, while the data can be allocated in other domains. We need to clear the reference when removing the list element so we are not left with hidden cross domain refs.

Ideally we should have per domain lists, so we also would just let the list and elements die, without having to iterate through them at domain unload time.
2018-05-25 14:31:17 -04:00
Rodrigo Kumpera 446fff38fc [debugging] Move start/stop single stepping to debugget-engine.c 2018-05-25 14:12:36 -04:00
Alexander Köplinger 84d0f324c3 Bump boringssl submodule 2018-05-25 19:36:01 +02:00
Alexander Köplinger e59628c27c Bump api-snapshot for HashCode revert 2018-05-25 18:53:14 +02:00
Rodrigo Kumpera d82d67c707 [sdb] Extract try_process_suspend. 2018-05-25 12:48:55 -04:00
Rodrigo Kumpera be4c5f7ebf [sdb] Remove duplicate code in process_breakpoint. 2018-05-25 12:48:55 -04:00
Rodrigo Kumpera 542b072a4f [sdb] [wasm] Extract DbgEngineStackFrame struct that has the fields used by bp/ss. 2018-05-25 12:48:55 -04:00
Marek Safar df0267f2c6 Bump Roslyn to 2.8.2 2018-05-25 18:14:36 +02:00
Rodrigo Kumpera 32424b1668 Sanitize TLS handling in the profiler. (#8824)
* [mono-threads] Introduce mono_thread_info_get/set_tools_data so they can store data sanely.

The tools_data is a helper to bind tls data lifecycle to MonoThreadInfo.
This is needed to make it sane to deal with posix TLS destructors.

* [profiler] Switch tls storage to use mono_thread_info_get/set_tools_data. Fixes #7683

External threads are detached using TLS destructors and this leads to non-determinism around to cleanup ordering of keys.
This causes the profiler to see the profiler tls key null'd even though it was not detached yet.

* [profiler] Since we depend on thread_info to be attached before tls works, do so for the helper threads.

We can't just move the mono_thread_attach call earlier as it leads to all sorts of weird crashes (as it generates events and we won't be attached).
2018-05-25 17:23:37 +02:00
Alexander Köplinger 5ee38e0694 Revert "[corefx] Import System.Hashcode (#8822)" (#8879)
It broke the Windows build.
2018-05-25 17:16:47 +02:00
Rodrigo Kumpera d8b0e7a74e [wasm] [sdb] Initial PR towards making some of sdb's code shareable. (#8750)
This PR adds the new files, moves the enums / structs and a small bit of code to validate the change.
2018-05-25 17:10:58 +02:00
Marek Safar f09bac7e1c [corlib] Optimizes Stream:CopyTo 2018-05-25 16:21:55 +02:00
Zoltan Varga 6fca21119e [jit] Fix the EqualityComparer.get_Default () optimization, a different comparer type is used on mobile platforms. (#8874) 2018-05-25 05:50:39 -04:00
monojenkins 61d1fe5a73 Bump API snapshot submodule 2018-05-25 11:01:42 +02:00
Martin Baulig 5715aee671 [System]: Epic: Client Certificate Support - Part Two.
This is the second and final part to bring Client Certificate support.
It needs to be landed on top of #8753 and #8756.

* `Mono.Security.Interface.IMonoSslStream`: Add `CanRenegotiate` and `RenegotiateAsync()`.

* `Mono.Security.Interface.MonoTlsSettings`: Add `DisallowUnauthenticatedCertificateRequest`.

* `AppleTlsContext`: fully support renegotiation.
  - we may now receive `SslStatus.PeerAuthCompleted` and `SslStatus.PeerClientCertRequested`
    during `Read()`.  It should in theory not happen during `Write()`, but I added it there
    as well just to be on the safe side.
  - `SetSessionOption()` may only be called before the initial handshake.

* `MobileAuthenticatedStream`: this is the major part of the work and the most complex one.
  - added a new `Operation` enum to keep track of what is going on and detect invalid state.
  - a renegotion may only be triggered while we're idle - that is no handshake, read or write
    operation is currently active.
  - `InternalWrite()` may now be called from `SSLRead()`, the new `Operation` tells us what
    is currently happening.
  - `ProcessHandshake()` now takes a `bool renegotiate` argument.
  - added sanity checks to `ProcessRead()` and `ProcessWrite()`.

* `MobileTlsContext.SelectClientCertificate()`: check for
  `MonoTlsSettings.DisallowUnauthenticatedCertificateRequest`

* `MonoTlsProviderFactory.InternalVersion`: bump the internal version number.

Tests have already been added to `web-tests/master`, they will auto-enable themselves when
using a Mono runtime that contains this code.
2018-05-25 11:01:42 +02:00
Alexis Christoforides 5076f806dc [corefx] Import System.Hashcode (#8822)
* [System.Native] Add pal_random

* Bring HashCode.cs.

* Use platform-specific .sources files.

* Bump API snapshot submodule
2018-05-25 10:57:24 +02:00
monojenkins 41ba0b6d2e [csproj] Update project files 2018-05-25 10:27:21 +02:00
Marek Safar a64209caf0 Bump linker to resolve XA issues 2018-05-25 10:27:21 +02:00
Joshua Peterson aaa49b7ff4 Remove two methods with incorrect arguments (#8860)
* Remove two methods with incorrect arguments

These two methods on `IPersonalizable` don't match the .NET 4.7.1 API.
In both cases the methods should take one `PersonalizableDictionary`
argument, but _that_ type does not exist.

Since nothing in the current class library code is using these methods,
just remove them.

* Bump API snapshot submodule
2018-05-24 21:59:39 +02:00
Martin Baulig 0c2e5133d3 [System]: Epic: Client Certificate Support - Part One. (#8756)
This is the first of two Pull Requests to implement Client Certificates :-)

Part One binds the new native APIs that will be used internally, finishes
the certificate selection callbacks, but without the more riskly changes
to the underlying handshake and I/O layer.

Part Two will bring support for TLS Renegotiation - and due to the required
changes in the underlying handshake, it is the more risky one.

* `Mono.Security.Interface.MonoTlsSettings`: Add `ClientCertificateIssuers`.

* `MobileTlsContext`:
  - fully implement `SelectClientCertificate()`; the `acceptableIssuers` parameter
    is now actually set and we also have a reasonable default selection.
  - add `CanRenegotiate` and `RenegotiateAsync()` - these are not hooked up yet.

* `AppleTlsContext`:
  - we will only ever call `RequirePeerTrust()` once per session, so we can
    also remove it alltogether and just use `EvaluatePeerTrust()` instead.
  - use proper exceptions for `SslStatus.PeerNoRenegotiation` and `PeerUnexpectedMsg`.
  - don't call `SetClientSideAuthenticate()` on the client side.
  - bind and hook up `SSLAddDistinguishedName()` and `SSLCopyDistinguishedNames()`.
  - bind `SSLReHandshake()`.

* `MobileAuthenticatedStream`: minor cleanups; there will be more uses of the new
  `GetInvalidNestedCallException()` helper class once Part Two lands.

* Enable some more constants in `SecureTransport.cs`.

* Add new `MonoBtlsError.GetErrorReason()` and `mono_btls_error_get_reason()`
  implementation, only supporting `SSL_R_NO_RENEGOTIATION` at the moment.

* Add new native `mono_btls_ssl_ctx_set_client_ca_list()` function and managed
  `MonoBtlsSslCtx.SetClientCertificateIssuers()`; hooked up via
  `MonoTlsSettings.ClientCertificateIssuers`.

* According to a comment in the header file, `SSL_get_client_CA_list()` may only
  be called during the selection callback or while the handshake is paused.
  To respect this restriction, we now call it during the client certificate
  selection callback and pass the list from native to managed.
  - changed signature of `MonoBtlsSelectFunc` from
    `int (* MonoBtlsSelectFunc) (void *instance)` to
    `int (* MonoBtlsSelectFunc) (void *instance, int countIssuers, const int *sizes, void **issuerData)`.
  - the managed counter-part is in `MonoBtlsSslCtx.NativeSelectFunc` / `NativeSelectCallback`.

* MonoBtlsContext:
  - use the new `MonoBtlsError.GetErrorReason()` to throw a `TlsException` with
    `AlertDescription.NoRenegotiation` that can be checked for by user code.
  - `SelectCallback()` now has a `string[] acceptableIssuers` argument; pass it
    to `SelectClientCertificate()`.
  - the native backend does not support TLS Renegotiation, so `CanRenegotiate`
    always returns false.

Implements #7075
2018-05-24 21:12:49 +02:00
Alexander Kyte d6af9f7bf7 [runtime] Change merp to emit files for MERP upload mode (#8694)
An example of the emitted files can be found here
https://gist.github.com/alexanderkyte/47307c95f77ef6e6a2d5efc73cb76dec
2018-05-24 14:27:36 -04:00
Zoltan Varga 9bef90a845 [jit] Disable the EqualityComparer.get_Default () optimization for now, it seems to cause failures in the corlib tests on the ios simulator. (#8856) 2018-05-24 14:24:24 -04:00
Jay Krell e4d72f88f3 Prune unused incorrect looking zip code. (#8752)
Not sure what is happening here. Is the type incorrect throughout, or being passed to wrong function?
2018-05-24 13:56:05 -04:00
Alexander Kyte c8efdaff17 [runtime] Gracefully handle crashes before mono-state dependencies initialized (#8840) 2018-05-24 12:38:58 -04:00
David Benjamin 27c4f785e2 [btls] rewrite mono_btls_ssl_ctx_set_ciphers (#8849)
Rather than reaching into the library internals and potentially
violating its invariants, assemble a cipher string and call the
supported public API. (There's no need to touch the version-specific
cipher lists because mono/btls never configures them.) The existing code
also had a bug; it incorrectly assumed OPENSSL_malloc returned a
zero-initialized buffer for in_group_flags. (Though Mono doesn't set
SSL_OP_CIPHER_SERVER_PREFERENCE, so I suspect this was a no-op.)

Additionally, this should hopefully ease updating to a less outdated
version of BoringSSL in the future.

Note I've changed the return value of this function from returning the
number of ciphers to merely returning 0/1 for whether the operation
succeeded. The only caller of this function, MonoBtlsSslCtx.SetCiphers,
only cares about success vs. failure.
2018-05-24 12:33:19 -04:00
monojenkins 435ea75843 [csproj] Update project files 2018-05-24 15:00:15 +02:00
monojenkins 0c27e0a02e Bump API snapshot submodule 2018-05-24 15:00:15 +02:00
Marek Safar e1e94cb6b1 [corlib] Finish System.Memory facade types import
Fixes #8623
2018-05-24 15:00:15 +02:00
Zoltan Varga c06c9b78c1 [interp] fullAOT mixed mode (#8838)
* [jit] Move the handling of special methods like pinvoke etc. into mini-runtime.c, since they are not handled by the JIT.

* [jit] Add a --full-aot-interp command line argument which is the same as --full-aot with a fallback to the interpreter.

* [jit] Implement fallback to the interpreter in full-aot+interp mode.

* [jit] Add a 'methods using the interpreter' stat.
2018-05-24 11:49:19 +02:00
monojenkins 319b410764 Bump API snapshot submodule 2018-05-24 10:00:52 +02:00
Marek Safar ac0cdca9ae Bump cecil 2018-05-24 10:00:52 +02:00
Marek Safar 2824c84427 [corlib] Update TaskFactory tests to accommodate running on different sync context
Fixes #8721
2018-05-24 09:23:26 +02:00
Marek Safar 178a49de7b [mcs] Adds parser support for C# 7.2 readonly references 2018-05-24 09:09:38 +02:00
Zoltan Varga b10647c0cf [jit] Fix box+brtue optimization broken by 298aa78a47. (#8846) 2018-05-23 23:37:34 -04:00
Zoltan Varga f3bf7e880f [jit] Add a 'verbose-gdb' option to turn on very verbose gdb crash dumps. (#8844) 2018-05-23 23:09:38 -04:00
Bernhard Urban c5eafe18c4 [ppc64] implement move_f_to_i8 / move_i8_to_f 2018-05-24 00:48:23 +02:00
Bernhard Urban f37d7a9fce [ppc] use different thunk machinery that works on ppc64
The old thunk machinery was sort of working on 64bit (before
f4bd084438 ), but it relies on having on
the memory layout of allocated chunks for code. Either the property got
lost due to some refactoring, or it was never true on ppc64. Anyway,
this patch switches the implementation to something we do on arm32 too:
If we potentially need some thunks for the emitted code, we reserve some
space for it at the end of the code buffer. That wastes a bit more
memory, because we often don't need it, but at least it works reliable.

Untested on 32bit systems.
2018-05-24 00:48:23 +02:00
Bernhard Urban 74735b55c9 [ppc] narrow immediate value for relative branches
since we don't know the exact distance yet, we have to guess. sometimes
this guess was not defensive enough.
2018-05-24 00:48:23 +02:00
Bernhard Urban 2789bdb592 [ppc] use gcc builtin for icache flushing 2018-05-24 00:48:23 +02:00
Zoltan Varga 9511ca1604 [llvm] Disable the 'x86-call-frame-opt' pass on x86, it generates code which breaks unwinding. (#8831) 2018-05-23 14:27:21 -04:00
Zoltan Varga c889056dea [llvm] Set the visibility of the llvm globals referring to the jit module to hidden, otherwise they can resolve to symbols outside the aot image. (#8833) 2018-05-23 14:26:32 -04:00
Marek Safar 0f8862bee4 [corlib] Disables test which depends on LogicalCallContext for mobile
Fixes #8787
2018-05-23 16:12:22 +02:00
Alexis Christoforides 52f79b48de Merge pull request #7412 from mono/update-macsdk-nuget
[MacSDK] Update Nuget to 4.7.0
2018-05-23 09:51:16 -04:00
Alexis Christoforides c1c7daa697 [MacSDK] Update Nuget to 4.7.0
This update includes (should include) https://github.com/NuGet/NuGet.Client/commit/eca1a8d23a54818c116eef63875de6a554227ea7 which we need in Mono.
2018-05-23 09:50:13 -04:00
Marek Safar 054e087471 [mcs] Don't report internal error when Span type is not available 2018-05-23 13:46:45 +02:00
Aleksey Kliger 0ed55711ad fix uninited var 2018-05-23 12:15:13 +02:00
Aleksey Kliger 9ad5255338 [loader] LoadFrom of problematic images should reprobe
The "problematic images" are Windows-specific assemblies that are often
included with applications that do not work on Mono, but for which Mono has its
own implementation.

Previously (9ec8ec5389) we changed mono to deny
loading problematic images using Assembly.Load or when one assembly references
another and we find a problematic image using the usual assembly search.

For Assembly.LoadFrom, we used to emit a warning and then load the assembly anyway.

In this commit, we change the behavior: If Assembly.LoadFrom tries to open a
problematic image, we will instead probe for an assembly of that name in the
default context.  That should eventually end up opening Mono's version of that
assembly.

Example:
  Suppose a problematic System.Runtime.InteropServices.RuntimeInformation.dll
  is in the application bin path: /home/user/myapp/bin

  1. User code does (for whatever reason)
  Assembly.LoadFrom ("/home/user/myapp/bin/System.Runtime.InteropServices.RuntimeInformation.dll")

  2. We find the image and try to open it; add it to the images absfpath to
  image hash; note that there are no binding redirects; but that it is a
  problematic image.  We extract the assembly
  name ("System.Runtime.InteropServices.RuntimeInformation", version x.y.z.w
  and public key token 123456789a) from the problematic image.

  3. We probe for "System.Runtime.InteropServices.RuntimeInformation version
  x.y.z.w public key token 123456789a" in the default context.

  4. We find
  /home/user/myapp/bin/System.Runtime.InteropServices.RuntimeInformation.dll in
  the application bin path; we try to open it, we see it's already in the
  images hash, but it's a problematic image,  and we're not in a loadfrom
  context (we re-probed with default!) so we keep probing

  5. We find
  <prefix>/lib/mono/4.5/Facaded/System.Runtime.InteropServices.RuntimeInformation.dll,
  it's not a problematic image, so we open that and return it to (3)

  6. We return to (2) and close the problematic image and return the good one
  instead.

  7. Assembly.LoadFrom returns with the good image.

Fixes https://github.com/mono/mono/issues/8726
2018-05-23 12:15:13 +02:00
Alexander Köplinger 3ac579420b Bump api-snapshot 2018-05-23 11:20:13 +02:00
Bernhard Urban 8df4a70439 [ppc] disable some tailcall tests (#8825)
they fail similar:

```
===============
tailcall/coreclr/JIT/Methodical/nonvirtualcall/tailcall.exe.stdout
===============
* Assertion at method-to-ir.c:2259, condition `tailcall || !mini_get_debug_options ()->test_tailcall_require' not met, function:test_tailcall, tailcalllog fail from CallFromInsideGrandChild
```
2018-05-23 11:16:58 +02:00
Vlad Brezae 4adac40657 [monitor] Fix abort of synchronisation wrapper
When we switched to the new version of Monitor.Enter, we didn't expand the try block to include the call. This led to unreleased locks when we acquired the lock but were aborted shortly afterwards.
2018-05-23 08:59:54 +02:00
Vlad Brezae 8ad36032d5 [tests] Fix pinvoke test (#8774)
Pinvoke signatures need to match the native ones from libtest.c

Fixes https://github.com/mono/mono/issues/7058
2018-05-22 17:17:50 -04:00
Martin Baulig 89441b5acc [System]: Pull some 'System.Net.Mail' APIs from CoreFX. (#8794)
This brings the internal `MailAddressParser` class and switches `MailAddress` and `MailAddressCollection` to the CoreFX version.

The tests have been updated to reflect the CoreFX behavior, which is more strict about rejecting invalid addresses.
2018-05-22 23:04:14 +02:00
Alexander Kyte 6a8795f9d7 [debugger] Add locking around tls->frames usage/freeing (#6456)
* [debugger] Add locking around tls->frames usage/freeing

* [debugger] more locking and avoid race around mono_threads_join_lock & loader lock
2018-05-22 21:43:30 +02:00
sancheolz 6c6c52958f [System.Windows.Forms] Fix PropertyGrid (#8813)
When PropertyGrid contains more than one propertyTab it crashes whith NullReferenceException. And when clicking on propertyTab toolstripbutton it didn't switch to this tab.
2018-05-22 20:47:21 +02:00
Rodrigo Kumpera 8de852ea9e [wasm] Improve binding code with support for booleans and binding of static C# methods. (#8714) 2018-05-22 14:04:48 -04:00
Zoltan Varga 34795a59cd [jit] Implement devirtualization of some EqualityComparer<T>.Equals calls, the corefx code assumes this. (#8690)
* [jit] Unify the way the results of inlined calls are pushed on the stack.

* [jit] Allow class inits during inlining if the class has no cctor.

* [bcl] Mark EqualityComparer<T>.get_Default () with MethodImplOptions.AggressiveInlining, its used in inner loops in the corefx code.

* [jit] Implement devirtualization of some EqualityComparer<T>.Equals calls, the corefx code assumes this.

* [jit] Rename has_array_access to needs_decompose to better reflect its meaning.
2018-05-22 13:32:54 -04:00
Marek Safar a925220d9d [wasm] Unify csc settings with the rest of Mono tree 2018-05-22 18:49:14 +02:00
Josh Peterson 227f15a3ad Add missing sre features to the mscorlib link.xml
To make sure that System.Reflection.Emit types in the class libraries
are properly removed by the linker, mark them with the "sre" feature in
the embedded linker descriptor file for mscorlib.
2018-05-22 16:14:28 +02:00
Alexander Köplinger 7f347cfc10 [packaging] Ignore Mac path in MSBuild .targets file during check
It contains this fragment:

```
<TargetFrameworkFallbackSearchPaths Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworkFallbackSearchPaths);/Library/Frameworks/Mono.framework/External/xbuild-frameworks</TargetFrameworkFallbackSearchPaths>
```
2018-05-22 16:09:12 +02:00
Alexander Köplinger 9cc1ddee72 Bump api-snapshot 2018-05-22 15:53:27 +02:00
Martin Baulig e74758bc10 [corlib]: Bring 'System.Buffers.Text.Utf8Parser' and 'Utf8Formatter' from CoreFX. (#8680)
Part of #8623
2018-05-22 13:12:24 +02:00
Martin Baulig 544fb5d84f Bump CoreFX and reflect latest StringBuilderCache changes. (#8800)
* Bump CoreFX and reflect latest StringBuilderCache changes.

* [csproj] Update project files
2018-05-22 12:39:21 +02:00
Marek Safar 6d4a96667a [Facades] Enables more forwarders in System.Memory (#8790) 2018-05-22 12:33:50 +02:00
Niklas Therning fa17b541f9 Added corlib .sources files for the ORBIS profile (#8783) 2018-05-22 12:32:49 +02:00
Katelyn Gadd f5d42d2d55 [bcl] Start replacing gensources.sh with gensources.cs (#8619)
This PR introduces a new tool, gensources.cs, which replaces gensources.sh. It is able to parse the whole set of .sources files for a library in one go so that genproj can use that information to encode all our platform and profile specific files into one csproj file.

For now this PR just introduces it and switches libraries to using it instead of gensources.sh.
2018-05-22 12:22:53 +02:00
Zoltan Varga f04da0f7c7 [jit] Disable an invalid IL test when running with bitcode. (#8809) 2018-05-22 05:56:47 -04:00
Jay Krell ad24751ad5 Fix assert to print and not crash, build the eglib tests and fix their warnings. (#8727)
* Fix assert to print the error, and not sometimes itself crash. It was evaluating varargs twice.

* Fix all the warnings in the eglib tests. Leave them not building for now.
2018-05-21 21:05:50 -07:00
Ludovic Henry eec6abca72 [corefx] Build System.Native (#8051) 2018-05-21 14:26:23 -04:00
Vlad Brezae ae5d45e559 [monitor] Fix monitor aborts (#8757)
Replaces semaphore usage with condition variable.

Fixes https://github.com/mono/mono/issues/6834
2018-05-21 14:04:56 -04:00
Jay Krell d878e6fde1 LLVM 6.0 JIT fails always. Fix it:
$  cat 1.cs
class B
{

    public static void  Main(string[] args)
    {
    }
}

MONO_PATH=/s/mono/mcs/class/lib/monolite-darwin/1051500005/  /s/mono/mono/mini/mono --llvm 1.exe
Expected<T> must be checked before access or destruction.
Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).
Stacktrace:

Native stacktrace:

    0   mono                                0x00000001028a00e8 mono_handle_native_crash + 264
    1   libsystem_platform.dylib            0x00007fffb3ca2b3a _sigtramp + 26
    2   mono                                0x0000000105217860 _ZZN4llvm4dbgsEvE7thestrm + 0
    3   libsystem_c.dylib                   0x00007fffb3b27420 abort + 129
    4   mono                                0x00000001028f1892 _ZNK4llvm8ExpectedINSt3__115__list_iteratorINS1_10unique_ptrINS_3orc28RTDyldObjectLinkingLayerBase12LinkedObjectENS1_14default_deleteIS6_EEEEPvEEE22fatalUncheckedExpectedEv + 226
    5   mono                                0x00000001028edd86 _ZN11MonoLLVMJIT9addModuleEPN4llvm8FunctionENSt3__110shared_ptrINS0_6ModuleEEE + 246
    6   mono                                0x00000001028ecd70 _ZN11MonoLLVMJIT7compileEPN4llvm8FunctionEiPP15LLVMOpaqueValuePPvS7_ + 304
    7   mono                                0x00000001028d79a5 emit_method_inner + 12165
    8   mono                                0x00000001028d47d1 mono_llvm_emit_method + 849
    9   mono                                0x00000001027f10ae mini_method_compile + 878
2018-05-21 18:42:59 +02:00
EgorBo ea5701b9c0 don't fail on unsupported ipv6 in BeginConnect 2018-05-21 18:36:38 +02:00
Zoltan Varga 14c8a6c57f [jit] Decompose CEE_BOX later, to enable more optimization opportunities. Optimize Enum.HasFlags (). (#8428)
* [jit] Decompose some CEE_BOX opcodes later to allow more optimizations.

Optimize a code sequence emitted for Enum.HasFlag () by newer csc versions.
Also mark the temporary bblocks used by decompose_vtypes () as out-of-line if
the bblock under processing is out-of-line. Mark the domainvar as volatile to avoid
optimizing it away since references to it can now be generated later from the
decomposition of OP_BOX.

* [jit] Check that the enum types are the same.

* [jit] Fix support for generic enums.

* [jit] Disable the optimization with 64 bit enums on 32 bit platforms.
2018-05-19 08:43:11 -04:00
Jay Krell d8af77551d Use size_t for gsize if it matches, else C99 uintptr_t. type-based instead of size-based autoconf printf(size_t) (#8570)
* Use size_t for gsize if it matches, else C99 uintptr_t.

Using size_t provides for an exact match with functions like malloc and pthread_attr_getstack, no warnings.

* GINT_TO_POINTER and co. need no autoconf, beyond chosing gsize, gssize.

* Use autoconf to find size_t among unsigned int, long, long long, __int64 for printf purposes.
Avoid 18+ year old C99 print("zu") dependency but still less likely to warn than the previous approach which only looked for matching size, not matching type.
2018-05-18 23:49:02 -07:00
Calvin b7061fa90b Small cleanups for mini-ppc.h (#8764)
* mini-ppc-os.h doesn't exist. If the OS lacks a define,
	  give an error instead of a broken include.

	* Remove redundant Mac OS case.

	* Move AIX define for sigaction above cross-compile case,
	  so it won't get lost in the noise there.
2018-05-19 02:06:48 -04:00
Zoltan Varga 36843e8ac8 [aot] Fix encoding/decoding of types with custom modifiers. (#8729)
* [aot] Fix encoding/decoding of types with custom modifiers.

Fixes https://github.com/mono/mono/issues/8701.

* [aot] Add a test, disabling for now because it depends on c# 7.2.

* [aot] Bump AOT file format version.

* [aot] Only disable the test with mcs.

* [aot] Fix compilation of test.
2018-05-18 19:10:55 -04:00
Jay Krell 31be0a13a6 No _Static_assert in old compiler. (#8760)
Fixes #8759
2018-05-19 00:26:13 +02:00
Alexander Köplinger 9e778b9e37 Fix csproj diff 2018-05-19 00:25:22 +02:00
Jay Krell 21a4dfa094 Disambiguate test output. (#8755) 2018-05-18 14:23:21 -07:00
Aleksey Kliger (λgeek) 459bfdca0c [sre] ParameterBuilder.SetConstant for a Nullable<T> parameter (#8736)
* [sre] ParameterBuilder.SetConstant should work with Nullable<T>

Rewrite ParameterBuilder.SetConstant like CoreCLR

Same logic as TypeBuidler.SetConstantValue from coreclr at
    src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs

The details are different because we don't have CorElementType in corlib (so
use TypeCode), and we want to write to a var instead of directly invoking an icall.

Among other things, this enables ParameterBuilder to work with Nullable<T>.
If a parameter is of type Nullable<T> then pb.SetConstant (null) should work.
Also pb.SetConstant (value) should work when T is one of the supported
types (primitives, enum, datetime, etc).

Fixes https://github.com/mono/mono/issues/8597 and fixes https://github.com/mono/mono/issues/8504

* [test] ParameterBuilder.SetConstant with a nullable type
2018-05-18 15:13:15 -04:00
Marek Habersack 170e9442c9 mkbundle interop changes
mkbundle works by generating a small C source file which, in addition to
embedded assemblies/configs/etc, contains a certain amount of code to initialize
the bundle, uncompress the assemblies and set runtime options (e.g. AOT mode).
This source code is generated based on a number of templates shipped as
resources inside `mkbundle.exe` and is not part of any public, maintained API.

The generated code contains calls to Mono runtime which work just fine when
mkbundle is used to generate a desktop application bundle with the default
template code. However, it breaks when a third party (like Xamarin.Android)
embeds Mono runtime and loads it dynamically **after** the application is
initialized. Such third parties must ensure that the bundle's startup code is
able to access the Mono runtime functions it needs by providing pointers to
them, loaded using e.g. the `dlsym` function.

However, as the Mono calls are hard-coded into the generated source code, the
third party needs to resort to search-and-replace methods (e.g. Xamarin.Android
https://github.com/xamarin/xamarin-android/blob/62e7792ca52949f2fa213330d292865ad78d2bfa/src/Xamarin.Android.Build.Tasks/Tasks/MakeBundleNativeCodeExternal.cs#L159-L166)
which are very fragile and prone to undetected breakage.

One example of such breakage which slipped under the radar is
https://github.com/xamarin/xamarin-android/issues/1651 which was caused by
addition of the `mono_jit_set_aot_mode` call to the generated code. The change
slipped under the radar and was discovered only after release.

This commit attempts to make the situation better by establishing a sort of a
code contract between "upstream" mkbundle and the third party. Since the
template code is not "public" (nor should it be), the third party cannot simply
include a header file with the API definitions. Instead, the idea here is to
ensure that all and any Mono runtime calls needed by the template code are
placed in a dispatch structure as pointers to functions and that the structure
needs to be initialized by the embedding party before calling the
`mono_mkbundle_init()` function. The third party is responsible for maintenance
of its own version of the dispatch structure as well as for its initialization
via the `initialize_mono_api` function in the template code. The generated code
must include the third party's version of the structure, in place of the default
one as shipped with `mkbundle`, and to make it possible this commit adds the
`--mono-api-struct-path` mkbundle parameter which points to a file that's
injected into the generated code, replacing the default structure definition.

Following that, the `mono_mkbundle_init()` code calls the `validate_api_struct`
function which checks each and every pointer in the structure for `null`,
exiting the application with error if any `null` pointer is encountered.
This (along with the `initialize_mono_api` function in the template) has the
additional effect that if the third party's structure is incompatible with the
default one a build error will happen, thus allowing early detection of obvious
incompatibilities/omissions.

As long as all the new Mono runtime calls are added to the structure, the above
should make it possible for issues like the one linked to above to not happen in
the future.
2018-05-18 19:37:04 +02:00
Martin Baulig 0429856f02 [System]: Cleanup SslStream callbacks and internal validation code. (#8753)
* `SslStream`: Reject attempts of setting conflicting callbacks using both the
  Mono-specific `MonoTlsSettings` and the new `SslClientAuthenticationOptions` /
  `SslServerAuthenticationOptions`.

  This makes it consistent with CoreFx behavior where those callbacks may only be
  specified in one of the possible places.

* `ChainValidationHelper` - this internal class has received a major overhaul and
  lots of old and unused code removed.

  All callbacks are not invoked with the correct `sender` parameter to make it
  match the .NET / CoreFx behavior.

* `Mono.Security.Interface.CertificateValidationHelper`: remove unused internal code.
2018-05-18 12:35:24 -04:00
Cody Russell 890bfea319 Bump bockbuild to get Pango patch (#8748) 2018-05-18 16:52:13 +02:00
Joshua Peterson 2447ab1149 Correct the base types for a few enum types (#8740)
To match the .NET 4.7.1 profile, these enum types should have special
base types.

* Bump API snapshot submodule
2018-05-18 15:31:03 +02:00
Ankit Jain fe34b9dae9 Bump msbuild to track xplat-master (#8725) 2018-05-18 15:14:23 +02:00
Alexis Christoforides 0ecd9dcef5 Merge pull request #8746 from lewurm/fix-PrincipalFlowsToAsyncTask
[corlib tests] improve ThreadPrincipalTests regarding SynchronizationContext
2018-05-18 09:06:21 -04:00
Alexander Köplinger fa9579a8fa [ci] Fix URL for apidiff/csprojdiff report
The upgraded HTML publisher plugin on Jenkins now generates a different URL.
2018-05-18 14:23:21 +02:00
Bernhard Urban 5bb972e99a [corlib tests] improve ThreadPrincipalTests regarding SynchronizationContext 2018-05-17 18:23:44 +02:00
Ludovic Henry 9805cda80f [android] Fix truncating of messages longer than 4096 characters (#8735)
Fixes https://github.com/mono/mono/issues/8282
2018-05-17 12:00:22 -04:00
Zoltan Varga a88c24b0d6 [jit] Fix casting of arrays of special array interfaces. (#8741)
Fixes https://github.com/mono/mono/issues/6647.
2018-05-17 11:58:45 -04:00
Jay Krell 4304788610 [jit] Volatile static field accesses lack barriers, contributing to FullAOT-LLVM test failure. (#8738)
* Volatile static field accesses lack barriers.
This is a contributing factor to https://github.com/mono/mono/issues/8321.
finally_block_ending_in_dead_bb.exe does not poll the volatile field.
This is not the entire problem.

* [llvm] Notice the MONO_INST_VOLATILE flag on load/store, not just MONO_INST_FAULT.
This is related to https://github.com/mono/mono/issues/8321 finally_block_ending_in_dead_bb.exe
however emitting a barrier suffices to get LLVM to do the read.
2018-05-17 01:29:11 -07:00
Zoltan Varga 2674424a1b [runtime] Fix the marshalling of class types using MarshalAs(UnmanagedType.Struct). (#8732)
Fixes https://github.com/mono/mono/issues/8250.
2018-05-16 20:48:19 -04:00
Jay Krell 298aa78a47 method_to_ir: factor out operand decoding and stack checking (#8718)
* method_to_ir: Factor out operand decoding, including of constants.
* Cleanup unused file.
* Use MonoOpcodeEnum_Invalid instead of (MonoOpcodeEnum)-1.
* Move CHECK_STACK and CHECK_STACK_OVF mostly to central place, except variable
ones like call/ret/newobj.
* No _Static_assert on msvc.
2018-05-16 11:41:12 -07:00
Ankit Jain 3d8125e54d Bump msbuild to track xplat-master (#8681) 2018-05-16 02:17:23 +02:00
Cody Russell 6e14d3f143 Bump bockbuild to pull in GTK userSpaceScaleFactor deprecation warning fix. (#8541) 2018-05-16 02:13:30 +02:00
Marek Safar 9dd02f8ce5 [packaging] Bump mono-basic to fix build with master and add deprecation message (#8722) 2018-05-16 02:11:22 +02:00
Jay Krell 1507b9b531 Some method-to-ir cleanup. (#8667)
* Remove some FIXMEs.

* Remove an inline.

* Less use  of `tailcall_calli`, more use  of `tailcall`, by assigning first to second.
And then eliminate `tailcall_testvalue`, as it just becomes `tailcall`.

* Merge the end, almost just the end, of CALLI with CALL/CALLVIRT.
Also merge the start, and with JMP, i.e. initializing shared variables.

This eliminates a bunch of shared code, without being too complicated (subjective)
and gives CALLI its missing sequence point.

goto here is disliked, maybe later a function.

* Change virtual_ from int to gboolean, assign it TRUE and FALSE instead of 0 and  1.

* Change guint32 call_opcode to MonoOpcodeEnum il_op.

* Replace *ip with il_op.

il_op is chosen over op, to disambiguate IL from IR.

And this is why C++ enums are not just ints:
	enum Animal {dog, cat};
	enum Color {red, blue};
	Color color = dog; //  valid C, invalid C++ (sometimes a warning in C)
	Animal animal;
	if (color == animal) ... // valid C, invalid C++ (sometimes a warning in C)

* add a FIXME
2018-05-15 12:12:07 -07:00
Jay Krell 2b9145d215 Use guchar instead of unsigned char for brevity/style. (#8717) 2018-05-15 09:02:45 -07:00
Martin Baulig dc93f55a0e [System]: New SslStream APIs from CoreFX. (#8665)
* Bring `SslClientAuthenticationOptions`, `SslServerAuthenticationOptions`
  and `SslApplicationProtocol` from CoreFX.

* SslStream: Added new public overloads from CoreFX:
  - All authentication methods have a new overload without the `SslProtocols` argument.
  - New `AuthenticateAsClientAsync(SslClientAuthenticationOptions,CancellationToken)`.
  - New `AuthenticateAsServerAsync(SslServerAuthenticationOptions,CancellationToken)`.
  - We now use `SecurityProtocol.SystemDefaultSecurityProtocols` (which is zero) as
    default value everywhere.

Everything below is internal:

* `Mono.Security.Interface`: Add internal `MonoServerCertificateSelectionCallback`,
  `IMonoAuthenticationOptions`, `IMonoSslClientAuthenticationOptions` and
  `IMonoSslServerAuthenticationOptions`.

* `Mono.Security.Interface.IMonoSslStream`: Add new overloads without the
  `SslProtocols` argument.

* `Mono.Security.Interface.IMonoSslStream2`: New internal interface, extending
  `IMonoSslStream` with the new internal APIs.

* `Mono.Net.Security`: New internal `MonoSslAuthenticationOptions`,
  `MonoSslClientAuthenticationOptions` and `MonoSslServerAuthenticationOptions`
  classes; these are just proxies for `SslClientAuthenticationOptions` and
  `SslServerAuthenticationOptions` (which unfortunately don't share a common
  base class).

* `Mono.Net.Security.MobileAuthenticatedStream`:
  - Implement `IMonoSslStream2`.
  - `ProcessAuthentication()` now takes `MonoSslAuthenticationOptions` instead
    of the old argument list, added `CancellationToken`.
  - All `IMonoSslStream` facing APIs now construct `MonoSslAuthenticationOptions`
    to pass it to `ProcessAuthentication()`.

* `Mono.Net.Security`: `MobileTlsContext` and `MobileTlsStream` now use
  `MonoSslAuthenticationOptions` to store all options.

Tests for the new APIs are in https://github.com/xamarin/web-tests/commit/fe347589326206f36d3cd42b59d305ff3c291857.
2018-05-15 13:06:17 +02:00
EgorBo 5dabf277f8 match .net behavior in ParameterInfo.ToString 2018-05-15 09:56:49 +02:00
Jay Krell 0e30bebf4c Fix incorrect readbehind and try to make readahead clearer and easier. (#8691)
* Use MonoOpcodeEnum instead of int. Provide MonoOpcodeEnum_Invalid = -1.

* Fix and cleanup bounds checks.
Some were off by one, some could be clearer.
This pattern will go away anyway and is partly gone below.

* Prepare to fix incorrect read behind.

* Add test to hit assert in incorrect readbehind in ldvirtftn.

* Confuse the JIT (or runtime) into crashing.

* Fix parens.

* Move some macros from verify.c to verify-internals.h.

* Attempt to make IL readahead easier to understand, by having
less spread out instruction sizing and decoding.

This converts several readaheads but not all.

It is possible we should just convert to a large array of pointers,
and then do these optimizations.

This also fixes the incorrect readbehind.

* Disable new test. Fixing the readbehind fixes the assertion failure but still sigsegvs later in trampoline.

* More use of common code. More to do here.
2018-05-14 18:48:18 -07:00
Miguel de Icaza d32424632c [Mono.CSharp] Mimic the settings from System to track the feature flags, fixes GitHub #8698 (#8703)
* [Mono.CSharp] Mimic the settings from System to track the feature flags, fixes GitHub #8698

* [csproj] Update project files
2018-05-14 21:01:29 +02:00
Zoltan Varga 0f48e11945 Don't set LDFLAGS on the libmono-ee library. Fixes this warning: (#8671)
libtool: warning: '-version-info/-version-number' is ignored for convenience libraries
2018-05-14 10:50:25 -04:00
Zoltan Varga 2864dd4165 [jit] Extract the intrinsics generation functions into a separate intrinsics.c file. (#8664) 2018-05-14 10:20:33 -04:00
Maxim Lipnin 42459ca99d [System.Security] CoreFX import for SubjectIdentifierOrKeyType type. 2018-05-14 15:42:27 +03:00
Maxim Lipnin 342b1df757 [System.Security] CoreFX import for SubjectIdentifierOrKey type. 2018-05-14 15:42:22 +03:00
Maxim Lipnin 8764171a1a [System.Security] CoreFX import for DataProtectionScope type. 2018-05-14 15:42:17 +03:00
Maxim Lipnin 52d85bbe08 [System.Security] CoreFX import for RecipientInfoType type. 2018-05-14 15:42:12 +03:00
Maxim Lipnin 78bcca7505 [System.Security] CoreFX import for PublicKeyInfo type. 2018-05-14 15:42:08 +03:00
Maxim Lipnin eb5534eb5c [System.Security] CoreFX import for SubjectIdentifierType type. 2018-05-14 15:42:03 +03:00
Maxim Lipnin b338b6a128 [System.Security] CoreFX import for CmsRecipient, CmsRecipientCollection and CmsRecipientEnumerator classes. 2018-05-14 15:41:58 +03:00
Maxim Lipnin c12803841c [System.Security] CoreFX import for AlgorithmIdentifier class 2018-05-14 15:41:53 +03:00
Marek Safar 44b91804db [mdoc] tests updates 2018-05-14 14:38:30 +02:00
Marek Safar e115d0c796 [corlib] Copying null references to value type array is not allowed 2018-05-14 14:38:30 +02:00
Maxim Lipnin d703d1888c [System.Security] Replace some common System.Security.Cryptography files with corefx sources. (#8629)
As part of https://github.com/mono/mono/issues/7589
2018-05-14 14:22:54 +02:00
Vlad Brezae bdef03f6dd [interp] Add null checks for ldind (#8647) 2018-05-14 13:19:29 +02:00
Jay Krell afb9fcb573 Fix build failure on Redhat 6.8 with GCC 4.4.7. (#8579)
Old gcc does not allow pragma diagnostic within function.

Fixes #8572

#if is a deliberate shorter form than #ifdef
	- shorter
	- allows for #define foo 0
	- standardly undefined silently evaluates to 0
	- potential for if instead of #if, though that does require #define foo 0, no
	  silent undefined => 0
2018-05-14 11:00:52 +02:00
Zoltan Varga 76deacd047 [jit] Fix a warning about disabling an unknown warning: trace.c:147:32: warning: unknown warning group '-Wframe-address', ignored [-Wunknown-warning-option] (#8696)
* [jit] Fix a warning about disabling an unknown warning: trace.c:147:32: warning: unknown warning group '-Wframe-address', ignored [-Wunknown-warning-option]

* [jit] Fix a warning.

* [jit] Fix a warning.
2018-05-14 01:45:06 -04:00
Jay Krell 0106bc34e4 Fix OSX x86 warnings. (#8480)
Fix OSX x86 warnings.

In particular:

 1) Be sure to pass a function all of its parameters, no more, no less.
 You can't have a stack imbalance because parameters usually fit in registers,
 and because calling conventions except for __stdcall are explicitly designed
 to accomodate common programming mistakes, e.g. printf ("%d") and printf ("%d", 1, 2),
 are well defined on all modern ABIs to never crash (except for the extreme
 case of printf ("%d") where stack is near the top and it accesses invalid next page,
 most unlikely).

 2) size_t and gsize are not always the same type.
 For example, one can be unsigned int and the other unsigned long (32bit).
 Or unsigned long and unsigned long long (64bit).

 3) gsize is not necessarily unsigned long, nor even the same size as it.
 It could be any of:
  unsigned int -- viable on all 32bit (Win32 and Unix32)
  unsigned long -- viable on Win32 and all Unix (Unix32 and Unix64)
  unsigned long long -- viable on Win64 and Unix64
  unsigned __int64 -- viable on Win64, possibly same as unsigned long long

 To printf a gsize in the "u" style (not the "x" nor "d" styled), G_GSIZE_FORMAT is provided.
  (Fix for Win32 and Win64 forthcoming.)

 We should strongly consider typedef size_t gsize but this a larger change.

 4) Pop without push.

```
mono-publib.c:27:30: warning: incompatible function pointer types initializing 'gpointer (*)(gsize)' (aka 'void *(*)(unsigned int)') with an expression of type
      'void *(*)(size_t)' (aka 'void *(*)(unsigned long)') [-Wincompatible-function-pointer-types]
        GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
                                    ^~~~~~~~~~~~~~
mono-publib.c:27:46: warning: incompatible function pointer types initializing 'gpointer (*)(gpointer, gsize)' (aka 'void *(*)(void *, unsigned int)') with an
      expression of type 'void *(*)(void *, size_t)' (aka 'void *(*)(void *, unsigned long)') [-Wincompatible-function-pointer-types]
        GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
                                                    ^~~~~~~~~~~~~~~
mono-publib.c:27:77: warning: incompsatible function pointer types initializing 'gpointer (*)(gsize, gsize)' (aka 'void *(*)(unsigned int, unsigned int)') with an
      expression of type 'void *(*)(size_t, size_t)' (aka 'void *(*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
        GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
                                                                                   ^~~~~~~~~~~~~~
mono-time.c:204:1: warning: unused label 'exit' [-Wunused-label]
exit:
^~~~~

mono-threads-posix.c:92:43: warning: incompatible pointer types passing 'gsize *const' (aka 'unsigned int *const') to parameter of type 'size_t *'
      (aka 'unsigned long *') [-Wincompatible-pointer-types]
                res = pthread_attr_getstacksize (&attr, stack_size);
                                                        ^~~~~~~~~~
/usr/include/pthread.h:250:85: note: passing argument to parameter here
int pthread_attr_getstacksize(const pthread_attr_t * __restrict, size_t * __restrict);
                                                                                    ^

profiler.c:1062:57: warning: incompatible pointer types passing 'void (MonoProfiler *, MonoProfilerGCEvent, uint32_t)' (aka 'void (struct _MonoProfiler *,
      MonoProfilerGCEvent, unsigned int)') to parameter of type 'MonoProfilerGCEvent2Callback' (aka 'void (*)(struct _MonoProfiler *, MonoProfilerGCEvent,
      unsigned int, int)') [-Wincompatible-pointer-types]
                mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
                                                                      ^~~~~~~~~~~
../../mono/metadata/profiler-events.h:85:1: note: passing argument to parameter 'cb' here
MONO_PROFILER_EVENT_3(gc_event, GCEvent2, MonoProfilerGCEvent, event, uint32_t, generation, mono_bool, is_serial)
^
profiler.c:908:2: note: expanded from macro 'MONO_PROFILER_EVENT_3'
        _MONO_PROFILER_EVENT(name, type)
        ^
profiler.c:897:103: note: expanded from macro '_MONO_PROFILER_EVENT'
        mono_profiler_set_ ## name ## _callback (MonoProfilerHandle handle, MonoProfiler ## type ## Callback cb) \
                                                                                                             ^
marshal.c:4770:72: warning: format specifies type 'unsigned long' but the argument has type 'gsize' (aka 'unsigned int') [-Wformat]
                mono_error_set_out_of_memory (error, "Could not allocate %lu bytes", size);
                                                                         ~~~         ^~~~
                                                                         %u

trace.c:146:32: warning: unknown warning group '-Wframe-address', ignored [-Wunknown-warning-option]
                               ^
trace.c:148:24: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
                       ^

```
2018-05-12 19:25:07 -04:00
Ludovic Henry 3fea4c7e0d [sdks] Only compile MXE on platforms where it's needed (#8666) 2018-05-11 21:52:48 -04:00
Jay Krell 43d27fee05 [jit] Cleanup IL opcode sizing and IP advancement -- mostly data driven (#8676)
* Cleanup IL operation size checks -- data driven.

* Removed duplicate declaration.

* Prepare to cleanup IL IP advancement. Do a self-checking run first, which found incorrect sizing of switch, dyncall, icall.

* Cleanup -- looks like macro debris.

* Cleanup IL IP advancement -- mostly data driven.
2018-05-11 11:19:48 -07:00
Aleksey Kliger (λgeek) ef97d0f00c [ppdb] Print some info if looking up an out of range method token (#8662)
Occasionally due to https://github.com/Microsoft/visualfsharp/issues/4637
Mono will assert if it tries to load a PPDB file that has an incorrect number
of MethodDebugInformation rows:

    * Assertion at metadata.c:1117, condition `idx < t->rows' not met

Instead of asserting, check that the method index is in bounds, and print a more informative error.
2018-05-11 19:58:30 +02:00
Jay Krell 822f75e8c7 Fix sizing of cee_switch, mono_dyn_call, mono_icall. (#8673)
* Fix mono_icall and mono_dyn_call operands in opcode.def.
This might require cpan install XML::Parser, or disable
the generation of opcode.def in Makefile.am.

* Fix sizing of switch instructions: 5 + 4 * n, not 4 + 4 * n.
2018-05-11 19:06:36 +02:00
Alexander Köplinger 72f1a21b2a [tests] Include assembly name in crash test result name
It'd just show up as "crash" in test reporting tools which is less useful
than e.g. "net_4_x_System.Xml_test.dll.crash".
2018-05-11 15:01:56 +02:00
Tony Valenti 13cefa9732 "On" field breaks compatibility with System.Net.Http because of "Internals Visible To" & member type mis-match (#8669)
* Hi Mono Team,
This commit fixes an interesting bug that relates to the  System.Net.Http nuget packages.

So the short story is that System.Net.Http can view the internals of this assembly because of InternalsVisibleTo and the HttpClient references System.Net.Logging's "On" _property_.  The problem is that mono has implemented "On" as a _field_ . When the latest version of System.Net.Http.HttpClient tries to invoke a SyncAsync using Mono, you get a MissingMethodException because:
bool System.Net.Logging.get_On()
does not exist.

This commit is simple and only changes the signature of On to match that of the reference source (property instead of field).  This will cause the Missing Method Exception not to be thrown.

* Fix indentation
2018-05-11 14:18:09 +02:00
Jay Krell ad58c88acf Fix s390x typo. (#8677) 2018-05-11 14:14:57 +02:00
Calvin 877466c432 Support setting thread names on Haiku (#8672)
Makes it easier to know what thread does what when trying to debug
these issues I've been having with things like finalizer threads.
2018-05-11 14:06:27 +02:00
Alexander Köplinger 6c621e2640 Update csproj files 2018-05-11 13:04:01 +02:00
Alexander Köplinger ef102dcbb9 [bcl] Fix bogus file paths in .sources files 2018-05-11 03:24:47 +02:00
Zoltan Varga 6baf32526e [aot] Avoid loading AOT images compiled without --llvm into a runtime running with --llvm, since --llvm was presumably used to achieve maximum performance. (#8661) 2018-05-10 21:22:11 -04:00
Martin Baulig d125afca84 [System]: The big WebConnectionStream cleanup. (#8569)
* [System]: The big WebConnectionStream cleanup.

`WebResponseStream` has been broken down into smaller pieces and now
fully supports GZip / Deflate decompression.

The entire `contentLength`, `readBuffer` and `totalRead` logic has been
replaced by a nested layer of `WebReadStream` classes.

* `WebReadStream` is a new abstract base class.

* `BufferedReadStream` handles the situation where we have some buffered
  data and an (optional) inner stream to read from.

* `ContentDecodeStream` takes care of GZip / Deflate decompression.

* `FixedSizeReadStream` handles the `contentLength` logic - ie. making sure
  we are only reading up to `contentLength` bytes from the stream.

* The old `MonoChunkStream` has been renamed into `MonoChunkParser` (as it was
  really just a parser and not a stream) and a new `MonoChunkStream` has been
  added that's based on `WebReadStream`.

* Remove HttpWebRequestTest.TestLargeDataReading().

This test was using Reflection to poke around implementation internals.

* [csproj] Update project files

* Cosmetic cleanups.
2018-05-10 20:17:21 -04:00
Martin Baulig c6158d4a00 [corlib]: Misc updates from CoreFX. (#8614)
* [corlib]: Misc updates from CoreFX.

* CancellationTokenRegistration: use the CoreFX version.

* String: add `implicit operator String (ReadOnlySpan<char> value)`.

* TimeSpan: add `TimeSpan operator / (TimeSpan timeSpan, double divisor)`
  and `double operator /(TimeSpan t1, TimeSpan t2)`.

* BitConverter: add `uint ToUInt32(ReadOnlySpan<byte> value)` and
  `ulong ToUInt64(ReadOnlySpan<byte> value)`.

* Fix the tests.

* Bump API snapshot submodule

* [csproj] Update project files
2018-05-11 00:04:26 +02:00
Jay Krell baf58ed6eb [btls] Fixes for windows. (#8653)
* [btls] Do not give gcc flags to msvc.

* [btls] #include "btls-foo.h" instead of #include <btls-foo.h> to work
with existing build system, on Windows, with out-of-tree build.
Not sure which factor does not like <> but "" should be ok.

* [blts] MONO_API is not used consistently and therefore errors on Windows.
1. Make it be nothing.
1b. Use a .def file if there are actual exports.
Really, .def files are a good idea.

 or

2. Use it consistently.

This does #1.
2018-05-10 14:35:27 -07:00
Jay Krell a7bebe779e [Tailcall] Classify some CoreCLR test problems, enable more, partially implement tail.calli for them. (#8621)
* Fix, classify, enable some CoreCLR tests.
* [Tailcall] Add partial calli support, so a test passes.
* Disable r4/r8 mismatch for all architectures, and one due to interface on ARM.
2018-05-10 12:40:21 -07:00
Aleksey Kliger (λgeek) 5e39d36bc7 [runtime] Transition to GC Unsafe in MONO_API functions (#8613)
* [runtime] Transition to GC Unsafe in MONO_API functions

The idea is that on any external->runtime transition we want to ensure that we
switch to GC Unsafe mode (and back on return).  This allows Mono embedders to
be oblivous about hybrid suspend - the runtime will run native embedder code in
GC Safe mode (and use preemptive suspend when necessary) and when they switch
back to the runtime we will switch to GC Unsafe mode (and use cooperative suspend).
2018-05-10 12:27:39 -04:00
Jay Krell 63bd3523ff Fix s390x more and make amd64.md file not executable. (#8649)
* Fix s390x more.

* Make it not executable.
2018-05-09 23:45:53 -04:00
Alexander Kyte bb15b3d963 Merge pull request #8511 from alexanderkyte/freeform_merp_cleanup
Implement Freeform Unmanaged Error
2018-05-09 23:17:16 -04:00
Alexander Kyte f72d9b0529 [runtime] Make unhandled state dumper OSX-specific
Since this needs to be backported, we're going to make this osx-specific
for now, and then I'll backport this. This is fully working on linux,
including the android SDK at the time of this commit
2018-05-09 17:19:24 -04:00
Aleksey Kliger (λgeek) 5a00750752 [runtime] Fix debug_log prototype in runtime callbacks (#8643)
The debug log fnptr is used with MonoStringHandle arguments since
cc7406b226

The corresponding functions and prototypes in mini/ have already been updated.
2018-05-09 17:06:03 -04:00
Jay Krell 613f15f720 Fix PowerPC64 not just PowerPC32. (#8645) 2018-05-09 20:55:46 +02:00
Alexander Köplinger d8531c5b86 [csproj] Fix diff rendering when XML comments appear in the diff (#8642)
The renderer would stop at the first XML comment `-->` which means
the diff was cut off.

We can fix this by switching from storing the diff in an HTML div to
a script tag instead.

Fixes https://github.com/mono/mono/issues/8469
2018-05-09 20:38:38 +02:00
Jay Krell cc236a3471 Fix powerpc and s390x compilation. (#8641) 2018-05-09 18:45:08 +02:00
Alexander Kyte 4f43fd12dd [runtime] Fix windows build 2018-05-09 11:26:40 -04:00
Alexander Kyte 0c6a69a188 [runtime] Fix merp reference in mono-state code 2018-05-09 11:25:59 -04:00
Alexander Kyte 581e2d866e [runtime] Add freeform dumper preprocessor symbols to autogen 2018-05-09 11:25:58 -04:00
Alexander Kyte 02689c25d6 [runtime] Add CI dumper using mono-state 2018-05-09 11:25:49 -04:00
Alexander Kyte 86045d13b6 [runtime] Integrate signal-based state machine with merp forking 2018-05-09 11:24:34 -04:00
Alexander Kyte 1b7cbbb2c0 [runtime] Write unmanaged exception dumper 2018-05-09 11:24:25 -04:00
Alexander Kyte 55d41889fb [runtime] Add helper to get portable IP value 2018-05-08 23:41:39 -04:00
Alexander Kyte 0fd43064f5 [runtime] Make assertion message fetchable 2018-05-08 23:41:39 -04:00
Jay Krell 1c91423be3 [Tailcall] Fill in some missing pieces: x86reg, armreg, armmembase, align x86patch, x86aot, armhardfloat. (#8591)
* [Tailcall]  Implement x86 OP_TAILCALL_REG (https://github.com/mono/mono/issues/8582)
This should enable calli, which isn't just for cee_calli but also internal purposes.

* [Tailcall] Split x86_align_for_patch out of emit_call.

* [Tailcall] Align x86 tailcall patches, using x86_align_for_patch.

* [Tailcall] Allow x86 tailcall to be AOTed.

* [Tailcall] Make all the 'missed tailcall' cases more similar looking.

* [Tailcall] Fill in a little more tailcall support.

* [arm] emit_big_add: Handle degenerate imm == 0 and dreg == sreg.

* [arm] Split emit_call_reg into emit_call_reg and emit_jmp_reg (for reuse by tailcall).

* [arm] handle hardfloat in tailcall

* [arm] Fill in TAILCALL_MEMBASE and TAILCALL_REG (reuse emit_jmp_reg)
virtual calls should work now (but not interface)

* [Tailcall] Comment about tail.calli -- no this-type in signature, to check for byref valuetype.
(data is available on compile-time staci, and a proposal to check for ldloca/ldarg pending)

* Add some asserts.

* More detangling of vtable_arg/imt_arg (extra_arg) from tailcall_supported -- they must be set, or nullness predicted, earlier.

* [Tailcall] Capture inputs to is_supported_tailcall and assert they don't change.

* [Tailcall] ARM32 tailcall not supported if mono_class_is_interface (cmethod->klass).
2018-05-08 19:02:37 -07:00
Jay Krell 5a3137214b [Coop] Convert Mono.SafeStringMarshal. (#8603) 2018-05-08 18:20:54 -07:00
Jay Krell f12cf1746c [Coop] Convert System.Diagnostics.DefaultTraceListener. (#8617) 2018-05-08 17:27:04 -07:00
Martin Baulig 89427f4938 [System]: Free ServicePoint instances when they're no longer used. (#8562)
* [System]: Free ServicePoints when they're no longer used.

* Cleanup.

* Don't crash when ServicePoint.CloseConnectionGroup() is called after the ServicePoint has been freed.

* Remove the CloseConnectionGroupConcurrency() test.

This test was for a regression in a piece of code that no longer exist
and the test is poorly designed as it depends on precise timings.
It also attempts to make a web request to a non-exisiting server and
just ignores the error - it is unclear whether that is intentional or not.
2018-05-08 23:21:46 +01:00
Martin Baulig e891290932 [tools]: resx2sr now takes an '-i file' argument.
Pass all manually created 'SR.cs' files using the new '-i' argument
and it will automatically eliminate all duplicates.
2018-05-08 23:19:20 +01:00
Martin Baulig 86981b96a5 [System]: Allow SecurityProtocolType.SystemDefault.
In CoreFX, `ServicePointManager.SecurityProtocol` defaults to
`SecurityProtocolType.SystemDefault` (which is zero).

We now allow this value to mean "whatever the system default is"
in both AppleTls and BTLS.

The default value of `ServicePointManager.SecurityProtocol` has also
been changed to be consistent with CoreFX.
2018-05-08 23:17:55 +01:00
Zoltan Varga ebdd620d29 [sdb] Fix some debugging logging before an assert so it prints even if the log level is 0. (#8628) 2018-05-08 18:11:51 -04:00
Alexander Köplinger 1280f6c1e3 [vscode] Update c_cpp_properties.json (#8630)
The C/C++ extension was updated yesterday and bumped the version in that file.
2018-05-08 14:35:29 -04:00
Jay Krell 423304db13 [jit x86] Move microoptimization down a level: x86_mov_reg_reg do not… (#8609)
* [jit x86] Move microoptimization down a level: x86_mov_reg_reg do nothing
if source == desta and size == 4 (size is always 4, except in amd64 reuse,
which was only used once, unnecessarily, remove it).

[jit x86] x86_mov_reg_reg size is always 4,
split into unused. x86_mov_reg_reg_size and specialized x86_mov_reg_reg

* Remove last parameter from x86_mov_reg_reg that is always 4.
2018-05-08 09:00:22 -07:00
Jay Krell cc7406b226 [Coop] Convert System.Diagnostics.Debugger. (#8618) 2018-05-08 11:45:25 -04:00
Vlad Brezae caad949923 [interp] Disable tailcall on valuetypes (#8616)
It is not guaranteed to work if the valuetype was allocated in the same stackframe.

This was initially leading to crashes because when storing in **this**, we were storing as a valuetype instead of the pointer (**this** valuetype is passed as pointer). Even if we fixed this issue, the other problem still exists.
2018-05-08 11:31:17 -04:00
Jay Krell 0b5e692323 [Coop] Convert Mono.RuntimeMarshal. (#8602) 2018-05-07 20:47:48 -07:00
Jay Krell 311d75e902 [Coop] Convert Mono.RuntimeClassHandle. (#8600) 2018-05-07 19:51:52 -07:00
Jay Krell 42dd7d3e84 [Coop] Convert Mono.RuntimeGPtrArrayHandle. (#8601) 2018-05-07 14:20:08 -07:00
Jay Krell 2f38e6454d [Coop] Convert Mono.Runtime to coop. (#8599) 2018-05-07 13:44:39 -07:00
Jay Krell 856e93838c [Coop] Convert System.CLRConfig to coop. (#8606) 2018-05-07 13:37:53 -07:00
Vlad Brezae 20530bdaa1 [interp] Fix stobj (#8574)
* [interp] Fix stobj

When writing to a stackval, we write at least 4 bytes. Because we were wrongly casting destination to stackval*, we could be clearing other fields for 1/2 byte stores.

* [interp] Use memmove also with stackval_to_data

As we do with stackval_from_data to prevent unaligned faults.
2018-05-07 08:48:44 +02:00
Jay Krell 6f590e214e [Tailcall] Fix CoreCLR tests to return success:0 instead of success:100 and run some. (#8533)
* [Tailcall] Change CoreCLR tests to return success:0 instead of success:100
* [Tailcall] Cleanup redundant test disabling.
* [Tailcall] Remove loop tests incorrectly classified as tailcall tests.
* [Tailcall] Enable CoreCLR tests, having changed success return value from 100 to 0.
* [Tailcall] Clarify why some tests fail.
2018-05-06 20:33:33 -07:00
Zoltan Varga 771353bf1e [sdks] Use cmake to build llvm. (#8260)
* [sdks] Use cmake to build llvm.

* [sdks] Build all targets for llvm32 as well, since android might not build llvm64.

* [sdks] Build the llvm windows builds using cmake as well.

* Address review comments.

* Switch to the release60 branch of LLVM as an experiment.

* [sdks] Bump LLVM.

* Bump LLVM.

* [sdks] Fix the build.

* [llvm] Emit default debugging info for all llvm builders otherwise methods without debug info like iterators will fail to compile.

* Fix a crash if ctx->minfo is not set.

* [sdks] Add an LLVM_BRANCH variable.
2018-05-06 11:18:55 -07:00
Alexander Köplinger 397be364fb [wasm] Add .wasm mime mapping for python3 in server.py too (#8592)
It was only done in the python2 case.
2018-05-06 11:05:16 -07:00
Maxim Lipnin f265e64bf3 CoreFX: System.Xml.Linq (#8274)
These changes replace references sources with CoreFx System.Private.XML.Linq sources.

Fixes: https://github.com/mono/mono/issues/8122
2018-05-06 19:37:10 +02:00
Zoltan Varga cad251da62 [llvm] Emit default debugging info for all llvm builders otherwise methods without debug info like iterators will fail to compile. (#8584)
* [llvm] Emit default debugging info for all llvm builders otherwise methods without debug info like iterators will fail to compile.

* Fix a crash if ctx->minfo is not set.
2018-05-06 09:32:07 -04:00
Alexander Köplinger d686d6dd07 [bcl] Add xunit to STD_TARGETS and precompile tests (#8594)
Similar to how we do it for nunit.
2018-05-05 17:28:50 -07:00
Marek Safar ed15e75a94 [corlib] Use ArrayPool from coreclr (#8399) 2018-05-05 18:14:29 +02:00
monojenkins e350fa07b5 [msvc] Update csproj files (#8593) 2018-05-05 18:04:52 +02:00
Alexander Köplinger 1b2fb14d0a Bump api-snapshot 2018-05-05 17:30:28 +02:00
Alexander Köplinger 73f137b80d [mk] Add .gitignore 2018-05-05 15:51:13 +02:00
Jay Krell f5373adc8a [Tailcall] Allow RegularAOT and HybridAOT x86/arm64 tailcalls. (#8583)
This strongly motivates additional CI lanes.
2018-05-04 22:30:29 -07:00
j-p 56f8556df8 [Mono.Cairo] Add OpenGL texture Surface support (#2443)
* Add OpenGL texture Surface support

* reorganize with EGL,WGL,GLX Device classes, and a single GLSurface class
2018-05-04 18:43:53 -07:00
Jay Krell 89b6b4b286 Free and destroy, of any type, should do nothing, silently, give a null pointer. (#8458)
Remove excess null checks.
2018-05-04 17:10:15 -07:00
Zoltan Varga 37e9efc20b [llvm] Set debug info when breaking up large bblocks, recent llvm versions fail without it: (#8576)
inlinable function call in a function with debug info must have a !dbg location
2018-05-04 17:34:38 -04:00
Jay Krell 06ce5f3f02 [Tailcall] Allow tailcall when returning valuetypes. (#8550)
* [Tailcall] Add tailcall-return-valuetype.il test.
This can be fixed easily -- when F1 calls F2 tailcalls F3.
F2 can pass F3 the temporary it got from F1 instead of having another temporary.

* [Tailcall] Add a test for passing large valuetypes by value.
This has problems on some ABIs but not others -- arm64 and Windows/amd64 fail.
Presumably the temporary is either within the paramete area
or is a local. The first works, the second does not.

* [Tailcall ppc/s390x] Update ppc/s390x to be more like x86/amd64/arm/arm64
i.e. matching return storage, and s390x matching struct-ness/size.

* [Tailcall] Let valuetypes be returned through tailcalls.

Specifically there was already this handling them:

mono_emit_call_args:
{

   if (tailcall) {
	   if (mini_type_is_vtype (sig_ret)) {
		   call->vret_var = cfg->vret_addr;
		   //g_assert_not_reached ();
	   }

so when F1 calls F2 and F2 tailcalls F3, F3 will return the value
where F1 was expecting it. There is no extra code needed after F3
returns to copy it from F2's temporary.


* CallInst.tailcall field is read before written in amd64, and is also wrong for llvmonly.

Replace CallInst.tailcall with MONO_IS_TAILCALL_OPCODE when accuracy is desirable and works.
Add FIXME when inaccurate CallInst.tailcall is presently required.
Tailcall field should probably be replaced by FALSE, except CEE_JMP needs attention first.
(see https://github.com/mono/mono/pull/8571)

* [Tailcall arm64 amd64 s390x] Do not allow tailcall when passing large valuetypes.
For s390x this is being conservative and might not be needed.
For ppc it is already done. Needed?

arm32/x86 seem to pass struct inline so it works, nice.

Small structs are sometimes passed in registers as well.

* Disable tailcall/coreclr/JIT/opt/ETW/TailCallCases.exe.
It passes a struct by value and fails.
2018-05-04 13:54:59 -07:00
Rodrigo Kumpera f238209bc4 Merge pull request #8442 from kumpera/sample_bindings
[wasm] Add Sample binding engine.
2018-05-04 12:20:07 -04:00
monojenkins dbfbffb559 Bump API snapshot submodule 2018-05-04 10:35:30 +02:00
EgorBo 1c00af3197 temporarily ignore failed tests 2018-05-04 10:35:30 +02:00
EgorBo c79e38f870 Add System.ComponentModel.Composition xunit tests 2018-05-04 10:35:30 +02:00
Martin Baulig d17ad304b3 [tools]: Use the official 'SslStream' APIs in certmgr. 2018-05-04 10:34:10 +02:00
José Manuel Serrano Mármol 40d1ac3371 FormsAuthenticationTicket should expire with persistent cookies (#8522) 2018-05-03 17:50:25 -07:00
Jay Krell 294461fa49 ifdef reduction (#8309)
Typo: is_adressable_valuetype_load => is_addressable_valuetype_load
Don't mark large multi-called function inline.
Remove lines that are all whitespace (leave whitespace at ends of lines, there is a lot).
One case of spaces to tabs.
2018-05-03 17:43:04 -07:00
Vincent Povirk d1020ab5a1 [tests] Fix out-of-tree build. (#8476) 2018-05-03 17:39:56 -07:00
Rodrigo Kumpera 3eaa5c2f48 [System] When doing process redirect, use Console.OutputEncoding instead of Console.Out.Encoding. (#8438)
* [System] When doing process redirect, use Console.OutputEncoding instead of Console.Out.Encoding. Fixes #8417.

This change makes mono behave in the same way as dotnet, which uses Console.OutputEncoding instead of whatever Console.Out is.

* [System] Add regression test for #8417.
2018-05-03 17:35:51 -07:00
Jo Shields a81e5afce5 [build] Add a -march forcing crypto extensions on ARM64 (#8542)
We only care about CPUs with this extension, and it fixes https://github.com/mono/mono/issues/8488
2018-05-03 17:32:36 -07:00
Miguel de Icaza 52d977a316 [mono] Add support for response files, using --response=FILE (#8560) 2018-05-03 17:28:59 -07:00
Jay Krell e4bacdc82c [Microsoft.Build] Bump timeout for BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion. (#8556)
https://jenkins.mono-project.com/job/test-mono-pull-request-coop/3429/testReport/junit/(root)/BuildSubmissionTest/EndBuildWaitsForSubmissionCompletion/

```
BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion

Failing for the past 1 build (Since Unstable#3429 )
Took 36 sec.
add description
Stacktrace
                                                MESSAGE:
                                                  #5
  Expected: less than or equal to 00:00:02.5000000
  But was:  00:00:09.1408213

                                                +++++++++++++++++++
                                                STACK TRACE:
                                                  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) [0x0003b] in /mnt/jenkins/workspace/test-mono-pull-request-coop/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```
2018-05-03 22:26:16 +02:00
Vincent Povirk 4949d7eaa0 Support native-to-managed thiscall wrappers (#3391)
* [x86] Add support for tracing native-to-managed thiscall wrappers.

* [x86] Add support for native-to-managed thiscall wrappers.

* Add test for managed thiscall methods.
2018-05-03 12:43:38 -07:00
Alexis Christoforides 5f7de5dd25 [process] Wait for exit for ShellExecute with 'xdg-open' (#8477)
Fixes https://github.com/mono/mono/issues/6466
2018-05-03 12:22:35 -07:00
Bernhard Urban 6f87ea1fa9 [native types] fix nfloat:NaN on arm64 JIT and interp (#8552)
interp: If one of the operands is NaN, we have a default result: It is false (0)
when doing a compare (`ceq_r8`), but must be true (1) on `cne_r8`.

JIT: match behaviour what C# compiler would generate for float/double.
2018-05-03 12:15:39 -07:00
Vlad Brezae f2d15bf067 [runtime] Fix runtime invoke with generic enums (#8554)
Fixes corefx generic list tests with interp.
2018-05-03 12:14:51 -07:00
Miguel de Icaza 588d6b20e4 Deambiguate TLS (#8561) 2018-05-03 12:11:18 -07:00
Miguel de Icaza 8a07116020 [ilasm] Add support for assembling vbbyrefstr, fixes https://github.com/mono/mono/issues/8447 (#8467) 2018-05-03 14:22:15 -04:00
Aleksey Kliger (λgeek) a920e7cdb6 [loader] If binding redirection redirects to the same version, ignore it (#8547)
If you load Foo.dll and it happens to be version 2.0.0.0 and an app.config says
to redirect all versions of Foo.dll to version 2.0.0.0, we're there already -
don't close the image and probe again, that's silly.
2018-05-03 13:10:34 -04:00
Marek Safar f71b208ca7 [mcs] Mimic csc behaviour when attribute value is a typedef and add also assembly reference for it 2018-05-03 08:56:11 +02:00
Ankit Jain 344c473cfa Bump msbuild to track xplat-master (#8501) 2018-05-03 02:45:35 +02:00
rbazinet-exago 6c465b42d5 Update HtmlForm.cs for issue #8526
When running with cookieless sessions, the file_path does not necessarily contain a leading '/' character which can lead to a Uri being constructed from something that looks like, "http://hostmyPage.aspx" which immediately fails and throw an exception stating that the hostname could not be parsed.
2018-05-02 23:25:52 +02:00
Jay Krell 672a15278d [Tailcall] Add a test for member functions in value types.
This is not trivial to fix -- either a range check
in the backend as to if the parameter is in the frame, or
value tracking in the frontend to see if it came from the frame.
2018-05-02 19:26:47 +02:00
Ankit Jain 34d79079d2 nuget-hash-extractor: Add all option to emit all 3 lists
This is faster than invoking the extractor thrice.
2018-05-02 18:06:32 +02:00
Ankit Jain de7a1ec01b nuget-hash-extractor: Improvements for better, deterministic output
- Ensure the various lists we emit have unique entries, are sorted to be
deterministic
- Ignore ref assemblies
2018-05-02 18:06:32 +02:00
Ankit Jain 7d68b33343 nuget-hash-extractor: Add msbuild extensions nuget version from
.. xplat-master msbuild branch.

	Microsoft.NET.Build.Extensions:         2.1.300-preview3-62804-06

Version from:
https://github.com/dotnet/cli/blob/8c937a0db08e56660aca456ac088f2d0e70735ab/build/DependencyVersions.props

None of the assemblies were newer, so none of the lists have any
changes.
2018-05-02 17:42:40 +02:00
Ankit Jain 376050c2bc nuget-hash-extractor: Sort the lists for easier reviews
mcs/tools/xbuild/data/deniedAssembliesList.txt:
	- sorted by name and assembly version
	- This file had one duplicate line
		System.Text.Encoding.CodePages.dll,FD178CD4-EF4F-44D5-9C3F-812B1E25126B,4,0,2,0

mono/metadata/image.c:
	- sorted by hashcode
	- This had one duplicate line
		IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES, "FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),
2018-05-02 17:42:40 +02:00
Alexander Köplinger ffc227a1fc [dist] Add new mk/ subfolder to SUBDIRS in Makefile.am
It was missed in fe21aad1df and breaks the tarball build.
2018-05-02 16:57:56 +02:00
Egor Bogatov 080e0b4874 [corlib] System.Text.Encoding.* from CoreFX (#7466)
Second part of https://github.com/mono/mono/issues/7247

All tests from corefx were already ported to mono.
2018-05-02 16:34:02 +02:00
Egor Bogatov 6ba593f21a [corlib] StringBuilder from corefx (#7949) 2018-05-02 08:17:16 +02:00
Jay Krell 5eafab5dab Update monollvm to: (#8536)
commit 0b3cb8ac12cd839f8110775d4085e822e8af4d7b (HEAD -> master, origin/master, origin/HEAD)
	Author: Zoltan Varga <[email protected]>
	Date:   Tue May 1 14:52:22 2018 -0400

	Emit an LSDA for methods without landing pads too since we need the information about the 'this' register.

to fix generic-stack-traces2.2 -- so it gets a generic type definition
instead of a generid type instance, consistent with other execution modes.
2018-05-01 18:13:03 -07:00
Aleksey Kliger (λgeek) 50444ec1bc [threads] Don't call backtrace on BLOCKING->RUNNING transitions (#8530)
See https://github.com/mono/mono/issues/8356

Backtrace can deadlock with threads that have been suspended while holding a
dynamic linker lock on Linux.

In checked build mode we collect backtraces on state machine transitions.

When we transition from BLOCKING->RUNNING under hybrid suspend the thread must
not block without polling.  So we must not collect a backtrace on this
transition.
2018-05-01 14:26:13 -04:00
Jay Krell 31fa26ea9d Have automake copy instead of symlink, for more git checkout sharability (#8534)
* Make autogen.sh output accurate -- print actual commands run.

* Have automake copy instead of symlink.
 - This sounds analogous to libtool --copy that we do.
 - It enables sharing a source tree more broadly.
   For real example, Cygwin symlinks are not portable to Windows Subsystem For Linux, and probably vice versa.
   For real example, Homebrew symlinks are not portable to Linux in Docker.

Downside I notice is that ls -l is less informative as to what is from git vs. a symlink to outside.
git clean -xxddff works just as well either way.
Hypothetical downside is that updating automake/autoconf doesn't upgrade the copies.
This has never mattered to me, but it might matter. It might be viewed as an advantage.
2018-05-01 11:46:02 -04:00
Vlad Brezae 73326cbb85 [interp] Fix Assertion at threads.c:326, condition `new_val >= 0' not met (#8527)
* [interp] Don't throw exceptions if we are in the middle of EH

Fixes delegate2.exe failures

* [interp] Don't set parent for invoke frame

This leads to unwinding same frame twice (once when going through the parent frame and, after we have no more parent frames, again through the pushed LMF). We should unwind past invoke only through LMF structures.

Fixes https://github.com/mono/mono/issues/8372
2018-05-01 11:27:31 -04:00
Zoltan Varga 73866f6b16 [jit] Add a MONO_ARCH_LLVM_JIT_SUPPORTED define to enable llvm jit support. (#8525) 2018-04-30 22:50:44 -04:00
Ankit Jain 0b8f0d2f83 [msbuild] Zip test results and log files for surfacing in jenkins (#8523) 2018-04-30 22:30:06 -04:00
Jay Krell becde2feb6 [Coop] Convert Mono.Interop.ComInteropProxy to coop. (#8509)
* [Coop] Introduce mono_gchandle_new_weakref_from_handle.

* Convert some old code to `mono_gchandle_new_weakref_from_handle`.

* [Coop] Convert ves_icall_Mono_Interop_ComInteropProxy_AddProxy to coop.

* [Coop] Convert ves_icall_Mono_Interop_ComInteropProxy_FindProxy to coop.

* Remove whitespace from whitespace-only line.
2018-04-30 18:41:23 -07:00
Jay Krell 5cd54b9641 [Coop] Remove around 140 uncooperative pointers due to calls to mono_set_pending_exception (). (#8483)
* [Coop] Remove 140+ uncooperative pointers due to calls to mono_set_pending_exception ().
Instead typically use:
  ERROR_DECL (error); // sometimes already present
  mono_error_set_xxx (error, ...);
  mono_error_set_exception_pending ();

* Improve error in not supported.

* Allow null in set_error_messagev.

* () and (void) are not the same in C, use (void)

When/if these functions are revisited for further coop conversion, the first and last line might be deleted but the second is likely to survive asis.
2018-04-30 17:00:50 -07:00
Jay Krell 3376ff2d67 [Tailcall PowerPC] OP_TAILCALL_PARAMETER support. (#8500) 2018-04-30 14:25:27 -07:00
Jo Shields 266edc1044 Merge pull request #8524 from directhex/ins_opcode
[ppc] Fix build
2018-04-30 16:35:22 -04:00
Jay Krell 069aa55acf [Coop] Convert Mono.Net.Security.MonoTlsProviderFactory to coop. (#8510) 2018-04-30 12:49:59 -07:00
Jo Shields cf8936fd02 [ppc] Fix build 2018-04-30 14:42:49 -04:00
Jonathan Peppers cf1c51944a [sdks] fix $(mktemp) usage on older versions of macOS (#8498)
Context: https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x

When making the bumps to use the `mono-sdks` upstream in Xamarin.Android,
we were getting build errors such as:

    usage: mktemp [-d] [-q] [-t prefix] [-u] template ... (TaskId:404)

The build bot is running Mavericks (10.9), so it must be an issue with older
versions of macOS.

When reading the Unix StackExchange post, it appears that the `-t` option
without a template should work more reliably on older macOS versions.

Then I tested it locally via `make -C sdks/builds provision-android`.

The command:

    mktemp -d unzip_android_archive_XXXXXXXX

Resulted in paths such as:

    creating: unzip_android_archive_Nt1XzgS5/android-P/

And sure enough, looking into `sdks/builds` it had created a directory in
the working directory, so it isn't using a path inside of `$TMPDIR`.

Changing the command to:

    mktemp -d -t unzip_android_archive_XXXXXXXX

Resulted in paths such as:

    creating: /var/folders/nx/rzr6lcqj6j3_vp7vtp28v2cw0000gn/T/unzip_android_archive_W247QkyW/android-P/

The StackExchange post mentions `-t` is a "prefix" that gets expanded to
`$TMPDIR/{prefix}.XXXXXXXX`, so I think it is better to use this option as
long as it works on all platforms.
2018-04-30 12:47:23 -04:00
Rodrigo Kumpera fe21aad1df [build] Disable make builtin rules for the runtime build. This speeds up a no-changes build by ~25%. (#2280) 2018-04-30 11:39:34 -04:00
Jo Shields 43b1ec5bfa Add @directhex to CODEOWNERS for packaging-related stuff (#8517)
At the very least, this way I get pinged when we bump Gtk# or MSBuild or something, so I can work on the Linux equivalent
2018-04-30 10:54:06 -04:00
Jay Krell 5d7ce8cc0d [Coop] Convert Microsoft.Win32.NativeMethod to coop. (#8508)
[Coop] Convert Microsoft.Win32.NativeMethod to coop.

These are all pretty trivial. There are no pointers or handles.
The only small wrinkle is internal calls -- split the function into w/ and w/o MonoError*.
2018-04-30 16:25:16 +02:00
Jo Shields 31074b1958 Merge pull request #8489 from directhex/mminimal-toc
Doesn't compile with Clang on ppc64el
2018-04-30 10:03:42 -04:00
Vlad Brezae 4a5a668c51 [interp] Fix vtype ldfld from another vtype (#8496)
CEE_LDFLD replaces at the top of the stack the object/valuetype one of its fields. MINT_LDFLD_VT loads a valuetype field from the object/valuetype at the top of the stack. When loading a field from a valuetype, at the end we also did a MINT_VTRESULT to pop the vtspace. If previously we were loading also a valuetype, then, when popping the original valuetype, we discard memory from the loaded field. With this change, we use 2 MINT_VTRESULT, one to pop the loaded field and second to copy it in place of the original valuetype.
2018-04-30 08:44:18 -04:00
Aleksey Kliger (λgeek) 632a929962 [profiler] Do GC state transitions in profiler helper threads. (#8497)
* [threads] (windows,mach) If a thread self-suspended, initiator shouldn't wait

Under hybrid suspend if the suspend initiator raced with
done_blocking/abort_blocking, then the thread self-suspended and is already
waiting for the resume semaphor - there's nothing else for the suspend initiator
to do, so don't add victim to the pending operation set.

* [profiler] Do GC state transitions in profiler helper threads

After the calls to `profiler_thread_check_detach`, the GC doesn't skip
the profiler helper threads anymore (because of the call to
`mono_thread_info_set_flags (MONO_THREAD_INFO_FLAGS_NONE)`.

Under hybrid or full cooperative GC, the helper threads in GC Unsafe
mode should not block without periodically polling.  Otherwise we get
into a deadlock on shutdown when finalizing the root domain:  The profiler
threads have been told to detach and we run a GC in preparation for
running the finalizers.  The GC STW ends up waiting for the dumper and
writer threads which never self-suspend.
2018-04-30 08:24:05 -04:00
Bernhard Urban 89ecd02722 [interp] enable more corlib tests (#8367)
* DecimalTest
* DecimalTestMicrosoft
* ExceptionTest
* PartitionerTests
* TypeBuilderTest
* DynamicMethodTest
* MethodBuilderTest
* ContextTest
* SynchronizationAttributeTest
* RealProxyTest
* DriveInfoTest
* TimeZoneTest
* ConvertTest (except 1)
* DelegateTest (except 3)
* TypedReferenceTest
* TypedReferenceCas
* RegistryKeyTest
* ExceptionDispatchInfoTest
* MarshalTest

https://github.com/mono/mono/issues/7053
2018-04-28 09:13:11 +02:00
Jay Krell 730a50a06d [Coop] Convert thread interrupt, resume, join, cleanup raising ThreadState exceptions. (#8479)
* style - (void) vs. (), favor (void) in C; function names at start of line for grep ^foo

* [Coop] Convert ves_icall_System_Threading_Thread_Resume to coop.
Cleanup three instances of "Thread has not been started, or is dead.".
Move raising exception (on current thread) outside of locking of resuming thread.
  Keep lock hold times shorter.

* [Coop] Convert ves_icall_System_Threading_Thread_Interrupt_internal.
Cleanup uses of ThreadStateException.
2018-04-27 21:02:34 -07:00
Mikhail Filippov 862336c663 Add option to MONO_DEBUG to store thread dumps by SIGQUIT on disk (#8358)
I added an option to allow storing a "thread dump" of the running program into a file in the specified directory. It is useful when you need to understand what is going on in your application and you cannot capture stdout or attach a debugger.
2018-04-28 01:29:19 +02:00
Aleksey Kliger (λgeek) 7c4f7c0684 [metadata] Add mono_assembly_get_assemblyref_checked (#8468)
Replace bounds check assertions of mono_assembly_get_assemblyref (and
everything that it calls) by Bad Image MonoErrors.

Call from System.Reflection.Assembly.InternalGetReferencedAssemblies to cope
with malformed images
2018-04-27 18:18:17 -04:00
Bernhard Urban cee577b36a [interp] clear exception fields only if it is a real exception object (#8491)
Storytime: With https://github.com/mono/mono/pull/8367 we tried to enable more tests to be run on CI regarding our corlib tests. However, this test crashed:

https://github.com/mono/mono/blob/9b702e8052f6d888febe4e74dfea4d8388c1706e/mcs/class/corlib/Test/System/StringTest.cs#L4473-L4477

which was _weird_ because the test was enabled before and worked.

So what is the test doing? It compares `String.Empty` and `""` to be the same object. Empty string is special in two ways:
* It's an interned string. Per domain we have a hash table that manages interned strings: https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mono/metadata/domain.c#L429
* We create an empty string instance per domain on domain creation: https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mono/metadata/appdomain.c#L197-L202

Therefore, I claim this must be true at every point in time after domain creation:
```c
  domain->empty_string == mono_g_hash_table_lookup (domain->ldstr_table, domain->empty_string)
```

I put this condition at a few points in the interpreter main loop, and indeed, at a certain point this condition isn't true anymore. With further debugging I noticed that this violation happens after a rehash of `ldstr_table`. So it means we have suddenly two empty string objects in the table, how can this be? An insertion of a second empty string object wouldn't work.

My initial guess was that some corlib test is doing some dirty unsafe business on interned strings, but it wasn't that obvious unfortunately.  What happened was the following: In this test a string gets loaded and is then thrown as an exception:
https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs#L626-L629

When this IL is executed we hit this code:
https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mono/mini/interp/interp.c#L694-L697

but wait! `ex` is a `MonoString` not a `MonoException`, really. Urgh. In this specific situation the offset of `->trace_ips` points beyond `ex`, that is, into the next object in the heap. Which, "by accident", is a interned string too and exactly nulls out the first few characters of the string. So there we have our second empty string in our hash table.

That is obviously wrong. And we have a test case for this:
https://github.com/mono/mono/blob/f024bb5f595c85388b1495c7a5247486327ecede/mono/mini/iltests.il#L2607-L2620

Alas it's disabled 😁 (as a matter of fact, it's one of the two disabled tests for the interpreter in the mini regression test suite). The reason why this test wasn't enabled is because with the old exception handling we didn't wrap such objects into an exception object. The exception handling implementation has changed and now shares it with the JIT which does the wrapping. We still missed a check which is added by this commit.
2018-04-28 00:10:48 +02:00
Rodrigo Kumpera 5136a60cf4 Improve --compile-all error message and a round of verifier cleanups. (#7048)
* [runtime] If a MonoError was set, display its message.

* [verifier] Cleanup the metadata verifier interface to use MonoError instead of the old GSList hack.
2018-04-27 15:42:40 -04:00
Jay Krell f024bb5f59 Fix Windows STDOUT_FILENO, STDERR_FILENO, that are probably not used. (#8482) 2018-04-27 11:53:01 -04:00
Jay Krell 6e72f54663 Fix Win32 G_GSIZE_FORMAT to be %u consistent with other 32bit platforms instead of %d. (#8481)
Fix Win64 G_GSIZE_FORMAT, assuming Microsoft C runtime, old or new, or
 others compatible with it, i.e. last century I64 instead of newfangled ll.
2018-04-27 11:52:07 -04:00
Jo Shields bec38ae243 Fix building with clang on PowerPC
Clang on PPC doesn't support `-mminimal-toc` and fails with an unknown flag due to our default CFLAGS. Try to detect Clang, and avoid that flag.
2018-04-27 11:03:32 -04:00
Jay Krell 8d1c93e563 Fix ThreadPoolTests.PerformanceCounter_WorkItems fails occasionally. (#8475)
Fix ThreadPoolTests.PerformanceCounter_WorkItems fails occasionally.
https://github.com/mono/mono/issues/8473
At least N work items, not exactly.
2018-04-27 00:33:59 -07:00
Jay Krell 20c06cc0f4 Cleanup instruction sizing and code reallocation. (#8436)
Runs of bumping `code` should be followed by calling set_code_cursor, every so often, or least when done.

Checks for enough room and realloc should be instead realloc_code.

Reads and esp. write of code_len, code_size, native_code should be relatively rare.
2018-04-26 20:05:17 -07:00
Joshua Peterson e11c793663 Expose two public types (#8470)
* Expose two public types

These types are public in the .NET 4.7.1 profile, so they should be
public in Mono as well.

* Bump API snapshot submodule
2018-04-27 03:10:30 +02:00
Alexander Köplinger bb7a6f2b1b [csproj] Fix mixed line endings 2018-04-27 03:01:28 +02:00
Jay Krell 72989f655c [Coop] Convert thread sleep, wait, interrupt. (#6639)
Coop ves_icall_System_Threading_Thread_Sleep_internal
Cleanup mono_join_uninterrupted.
Partial coop mono_thread_execute_interruption
Cleanup ves_icall_System_Threading_WaitHandle_Wait_internal.
2018-04-26 16:24:27 -07:00
Rodrigo Kumpera d4143269f2 [mini] Don't verify types if you store to a pointer byref. (#8411)
* [mini] Don't verify types if you store to a pointer byref. Workarounds #8403.

* [mini] Add regression test for punting a type system check.

* Fix variable names in test to match comments
2018-04-26 18:02:24 -04:00
Bernhard Urban 8479949bd0 [interp] enable mcs tests on armv7 (#8455)
there was a technical limitiation to run it reliably (aka. "the r8
problem"), which was resolved by https://github.com/mono/mono/pull/8056
2018-04-26 20:56:20 +02:00
Egor Bogatov bce083b1dc CoreFX: System.Json, System.ServiceModel.Syndication, System.Threading.Tasks.Dataflow (#8246)
Use corefx sources and tests for:
- System.Json
- System.ServiceModel.Syndication
- System.Threading.Tasks.Dataflow
2018-04-26 19:38:03 +02:00
Jo Shields 1320d75123 Fix typo causing make destdir to fail (#8465) 2018-04-26 16:44:00 +02:00
Daniel Becker 5e6e8682ad [System] Use Interrupt instead of Abort to shut down handler thread for kevent watcher (#2876)
The only place where the handler thread should block is in the
kqueue_notimeout() call; interrupting the thread should cause
that call to exit with EINTR, and allow the thread to exit.
2018-04-26 15:17:17 +02:00
Alexander Köplinger ebbe052ee5 [acceptance-tests] Fix missing file in EXTRA_DIST 2018-04-26 14:03:24 +02:00
Ankit Jain bfff07babc [msbuild] Bump to latest xplat-master (#8426)
.. which is now on the netcore2.x based build. Update build and test
scripts accordingly.
2018-04-26 13:28:22 +02:00
Jay Krell d0acdff625 [Tailcall] Fix patching of generic GOT under FullAOT. (#8445)
* [Tailcall] Fix the patching of GOT sites under FullAOT.
This fixes bug https://github.com/mono/mono/issues/8273 where FullAOT generic-shared (valuetype?) runs hundreds of times slower than regular AOT due to hitting the trampoline for every call.

[Coop] Fork test 8273.il from 3.il and increase iteration count
so it takes a long time previously.

Also possibly fix a JIT path where gshared but not gsharedvt handled.
2018-04-26 03:24:49 -07:00
Marek Safar 90d511c1bd Bump corefx (#8396) 2018-04-26 11:32:30 +02:00
Alexander Köplinger a70c4c25fa [ci] Check CI_TAGS instead of ghprbPullId 2018-04-26 11:12:37 +02:00
Vlad Brezae 3f352e22c4 [arm64] Set correct frame type for trampoline frames 2018-04-26 09:19:39 +02:00
Vlad Brezae 372b562df1 [arm64] Add unwind info for native to interp trampoline 2018-04-26 09:19:39 +02:00
Vlad Brezae 1207d58e3f [interp] Include lmf wrapper in aot image 2018-04-26 09:19:39 +02:00
Vlad Brezae bc225aca72 [interp] Interp entry trampoline for arm64 2018-04-26 09:19:39 +02:00
Jay Krell cc59ca89b6 [Tailcall] Better sizing of tailcalls, allow arm64 r4, copy arm64 stacked parameters (#8437)
Tailcall:
Remove arm32 limit of 64 bytes of stack usage. Limit it to 4K instead (12bit immediate displacement).
Remove arm64 limit of 0 bytes of stack usage. Limit it to 1G instead (32bit limit).
	i.e. copy arm64 stacked parameters
Limit x86 and amd64 stack usage to 1G (32bit limit).
Even as small as 100 is reasonable.

Add OP_TAILCALL_PARAMETER for more accurate earlier tailcall sizing,
	including of unbounded parameter lists.
	i.e. a certain number of bytes per parameter (including enregistered,
	which makes it an overestimate)

Allow arm64 to return r4 -- caller and callee must agree, which means
	caller's caller gets what it expects.

Add test coverage for large parameter list (256+).

Cleanup:
Introduce ins_get_size in place of ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
Use it in a few places. Replace PowerPC's ins_native_length with it.

Cleanup usage of EXTRA_CODE_SPACE vs. 16 -- EXTRA_CODE_SPACE everywhere.
This will get further cleaned up shortly.

Replace if (need to realloc code) with while (need to realloc code.
It is almost the same, but protects against degenerate very small code
where doubling is not enough (except for zero).

Use fsig we already have instead of another call to sig = mono_method_signature.
(for OP_TAILCALL and nearby existing code)
2018-04-25 22:47:26 -07:00
Jay Krell 3414da6f93 Fix warning about unused static table_sizes -- move it near ifdef'ed use. (#8452)
Fix warning about unused static table_sizes -- move it near ifdef'ed use.
2018-04-26 01:25:07 +02:00
Aleksey Kliger (λgeek) 40c13f7b0f [loader] Add loader contexts (#8326)
There are 4 different ways that an assembly can be loaded in .NET:
1. default context - `Assembly.Load(string)` does this.
2. reflection only context - `Assembly.ReflectionOnlyLoad` and `Assembly.ReflectionOnlyLoadFrom` do this.
2. load from context - `Assembly.LoadFrom(string)` does this. The interesting bit is that the assembly at the specified path is probed for its assembly name, and then binding redirects are applied to figure out if we need to load a different version of the assembly (from elsewhere in the search path, presumably).
3. "no context" (.NET Core's [AssemblyLoadContext](https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md) design doc calls it "custom context", and internally they implement it as `IndividualAssemblyLoadContext`) - in Mono I'm going to call it the "individual context".  This is what `Assembly.LoadFile(string)` and `Assembly.Load(byte[])` do: you get exactly the thing you asked for even if something with the same assembly name is already loaded and you get to have problems with type resolution.

So this PR adds:
1. `MonoAssemblyLoadContextKind` enum - default, refonly, loadfrom and individual.
2. Store the `MonoAssemblyLoadContext` in every `MonoAssembly` instead of a boolean `refonly` flag.
3. When loading references from assemblies, consider the load context of the requesting assembly.
4. Do the wacky `LoadFrom` probe and rebind dance.
5. Don't check for duplicated for the individual assembly context.

Not in this PR:

The managed assembly load context stuff in .NET Core.  If we eventually want to add it, it will likely build on this work, but it's not here now.

Details:

* [loader] Replace 'refonly' by an assembly load context (NFC)

   Replace MonoAssembly:ref_only field by a new context field of type MonoAssemblyContext (which right now just contains a single 'ref_only' boolean).

   The .NET Framework documentation describes for contexts for assembly loading:
   1. default context - Load(string) and referened assembly loading use this context.
   2. LoadFrom context - LoadFrom(string) and references from LoadFrom assemblies.
   3. reflection only context - ReflectionOnlyLoad and ReflectionOnlyLoadFrom use this.
   4. individual assembly context[footnote:1] - Used by Load(byte[]) and LoadFile(string)

   This commit only implements default context and reflection only context.  As such, there should be no functional change.

   [footnote:1]: Individual assembly context is called "no context" in the .NET
   Framework docs, but "individual" is what the .NET Core assembly load context
   implementation calls it.
   https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md

* [loader] propagate MonoAssemblyContextKind instead of refonly, loader_from_context flags

   Instead of passing a pair of booleans around, pass a MonoAssemblyContextKind value.

   In System.Reflection.Assembly.LoadFrom, pass MONO_ASMCTX_LOADFROM, instead of default.

   In System.Reflection.Assembly.Load(byte[]), pass MONO_ASMCTX_INDIVIDUAL instead of default.

   In SRE, create new assemblies with MONO_ASMCTX_INDIVIDUAL or refonly

   Finally in mono_assembly_load_reference:

   For a LOADFROM context always include the requesting assembly's basedir when probing for references.

   For INDIVIDUAL context, don't probe for their references - they must be already loaded or else resolved by an AssemblyResolve event.

In a REFONLY context, only look at loaded assemblies or fire the
ReferenceOnlyAssemblyResolve event.

In a DEFAULT context, follow Mono's existing strategy: first probe without
including the basedir (and let the managed AssemblyResolve event fire), then
probe again with the basedir set (potentially firing the event again).

* [reflection] Implement System.Reflection.Assembly.LoadFile as a separate icall

   The difference between LoadFrom and LoadFile is that LoadFile should not look in the loaded assembly's basedir when resolving references.  (It is also not be subject to remapping).

   Also, for LoadFile never return a previously loaded assembly even if one with the same name is already cached by a domain.

   Fixes https://github.com/mono/mono/issues/8149

   The changes to mono_assembly_load_from_predicate (in conjunction with using MONO_ASMCTX_INDIVIDUAL) for the LoadAssemblyRaw icall also fix https://bugzilla.xamarin.com/show_bug.cgi?id=11199 and https://bugzilla.xamarin.com/show_bug.cgi?id=33728

* [loader] Apply binding redirects to LoadFrom assemblies

   Fixes https://github.com/mono/mono/issues/8152

* [loader] Include class failure cause in find_method_in_class TypeLoadException

* [loader] apply binding redirects to LoadFile() and Load(byte[])

   Same as LoadFrom: If the identity of the assembly matches a binding redirection, drop the currently opened image and go probing by name instead.

* [loader] Print assembly load context in debug traces

* [loader] Split up mono_assembly_load_full_nosearch

   There are two phases: first try the preload hook, second look in the gac, the given base directory, and in the default_path.

   Split out the second phase into its own function.

* [loader] Apply remapping and binding when looking for INDIVIDUAL asmctx references

* [loader] Probe the GAC and assemblies path for INDIVIDUAL asmctx

   Checked on .NET Framework 4.7.1

   Despite the documentation insisting that `LoadFile` does not do any probing for referenced assemblies, it seems that actually, assemblies from the GAC (or at least the framework Facade assemblies such as `System.Runtime`) are nonetheless loaded if no context assembly depends on it.

   This commit does the same thing for Mono (except we will additionally look in MONO_PATH).

   This makes the xunit console runner work:

   At startup they call LoadFile() on all the assemblies in the main executable's dir without doing anything to resolve the references.  Those LoadFile assemblies then have broken references to things like System.Runtime that should be in the GAC but that haven't been loaded yet.

* [tests] Add tests for Assembly.Load(byte[]), LoadFile and LoadFrom

   Test that loading two assemblies from two different paths (or byte arrays) with the same AssemblyName will produce different results if using Load(byte[]) or LoadFile() but will reuse the first assembly if using LoadFrom().

   Regression tests for:
   - https://bugzilla.xamarin.com/show_bug.cgi?id=11199
   - https://bugzilla.xamarin.com/show_bug.cgi?id=33728
   - https://github.com/mono/mono/issues/8149

* [tests] Check that binding redirects work for Assembly.Load(byte[]), LoadFile and LoadFrom

   In old version of .NET it was only supposed to work for LoadFrom, but now it should work for all three.

   Regression test for https://github.com/mono/mono/issues/8152

* [tests] Don't run Assembly.Load(byte[]) tests with AOT

* [aot] Make load_image return the aot module assembly for LoadFile

   LoadFile allows loading more than one assembly with the same name. That means that just calling mono_assembly_load is unlikely to find the correct assembly (it'll just return the first one loaded).  But we shouldn't hardcode the full assembly filepath into the AOT image, so it's not obvious that we can call mono_assembly_open_predicate.

   Fortunately, an assembly opened with LoadFile is supposed to only refer to already-loaded assemblies (or to GAC & MONO_PATH) assemblies - so nothing new should be loading.  And for the LoadFile'd assembly itself, we can check if the name and guid of the current AOT module matches the wanted name and guid and just return the AOT module's assembly.

* [mini] Fixup one MonoClass member access to use getter
2018-04-25 17:30:25 -04:00
Jay Krell c50808d259 check_call_signature return gboolean and run second time if break, to step through in debugger (#8434)
* If check_call_signature fails and we break on it, run it again, i.e. so you can
step in a debugger.

* Change check_call_signature to returning a boolean, albeit in the same perhaps backwards way.
2018-04-25 15:19:48 -04:00
Zoltan Varga dd652eee5a Fixed the --with-runtime-preset=bitcode build if no --enable-minimal option is given. (#8444)
Fixes https://github.com/mono/mono/issues/8439.
2018-04-25 14:20:53 -04:00
Alexander Köplinger c993f55dab [System.ServiceMode] Disable test on mobile
The other BugXXX.cs tests are disabled there too.
2018-04-25 19:24:46 +02:00
Alexis Christoforides a16dfeeb75 Disable a flaky test
https://github.com/mono/mono/issues/8450
2018-04-25 13:00:56 -04:00
Egor Bogatov 965f7aef2a [corlib] ConcurrentExclusiveSchedulerPair from corefx (#8040)
These types were not replaced with corefx in #6672
2018-04-25 15:51:00 +02:00
Alexander Kyte 2e94082332 [runtime] Add llvm aot mode with graceful fallback (#8348) 2018-04-25 08:55:41 -04:00
Vlad Brezae 31202f5a38 [interp] Enter in the interp through a single generic trampoline (#8056)
* [arm] Create trampoline for passing fixed arguments

It is the same as static rgctx trampoline, but it clobbers ARMREG_IP

* [arm] Create trampoline for native to interp transition

* [arm] Add interp entry from trampoline

Tweak CallContext methods to work in opposite direction

* [interp] Create wrapper that saves lmf for m2i transitions

If we want to unwind from interpreter directly into managed code we need to have a wrapper whose purpose is to save the lmf, so we can start unwinding frame by frame.

* [arm] Add unwind info for interp entry trampoline

We need to unwind through this trampoline since it sits between jitted code and the interp lmf wrapper.

* [interp] Let the unwinder unwind through trampolines

These frames are still ignored (by EH and stack walking), they are only used for unwiding further to the caller.
2018-04-25 13:56:16 +03:00
Bernhard Urban b4aa69f728 [interp] initialize vtable of static fields 2018-04-25 01:26:23 +02:00
Rodrigo Kumpera 31d1b65092 [wasm] Add bidi binding for Promise/Task. 2018-04-24 16:18:32 -04:00
Ludovic Henry 863e1f13ee Update ISSUE_TEMPLATE.md (#8440) 2018-04-24 21:10:21 +02:00
Jay Krell 8b24f2e537 [Coop] Abort_internal and ResetAbortNative to coop/handle. (#8435)
[Coop] Abort_internal and ResetAbortNative to coop/handle.

* [Coop] Add some comments.

* [Coop] Convert thread abort and interruption to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_ResetAbort to coop/handle.

* Make mono_set_pending_exception_handle static.

* [Coop] mono_join_uninterrupted: Avoid creating handles in loops.
2018-04-24 11:22:54 -07:00
Ankit Jain 963f94474e [runtime] Setup stack trace for use in exception filters too (#8241)
If we have
	`catch (Exception e) when (SomeMethod (e))`

.. then the exception object received in `SomeMethod` has an empty
trace. This is because in `handle_exception_first_pass` we populate the
trace in `MonoException` object only at the "end":

	- filter returns TRUE
	- exception caught
	- unhandled exception

But if we have a filter then the trace at that point needs to be
accessible. And if the filter fails then as we unwind more frames, the
earlier frames (`trace_ips`) need to be retained to get the correct full
trace.

`dynamic_methods` needs to be handled similarly and in
`setup_stack_trace` we need to add to the existing `dynamic_methods` in
the MonoException object.

Fixes https://github.com/mono/mono/issues/7649 .
2018-04-24 14:20:03 -04:00
Alexander Köplinger baef8453a8 [Mono.Profiler.Log] Use AssertExtensions for comparison asserts (#8406)
`Assert.True (actual >= expected)` doesn't log useful information when
the condition is false, making it hard to see what went wrong:

https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/8525/testReport/junit/Test%20collection%20for%20MonoTests.Mono.Profiler.Log/ProfilerTests/MonoTests_Mono_Profiler_Log_ProfilerTests_MonitorEventsAreRecorded/

Unfortunately xUnit doesn't provide a built-in comparison assert but
CoreFX already built one so we can just use that one.
2018-04-24 14:13:16 -04:00
Bernhard Urban 1c4eb6142b [sgen] unbreak build when SGEN_HEAVY_BINARY_PROTOCOL is set (#8418)
ilgen changes messed up the defines.
2018-04-24 13:43:52 -04:00
Jay Krell b7e9c69402 Report more information in debugger for assertion failures etc. (#7932)
And cleanup a little.

32 times:
gdb:
 info registers
 info frame
 info locals
 up

lldb:
 reg red
 frame info
 frame variable
 up
2018-04-24 13:42:00 -04:00
Bernhard Urban 10becf2710 [interp] reduce amount of native frames in debug builds 2018-04-24 18:22:37 +02:00
Alexander Köplinger 3bb0e113fa [Mono.Profiler.Log] Fix log-profiler-test.exe compilation with mcs
mcs raises a warning which is turned into an error by `/warnaserror`.
Only set that option when we're building with csc.
2018-04-24 13:03:17 +02:00
Alexander Köplinger 30282554bd [acceptance-tests] Bump coreclr to fix #8422 (#8427)
Fixes https://github.com/mono/mono/issues/8422
2018-04-24 12:48:50 +02:00
Zoltan Varga 6457e4018f [arm] Fix a regression introduced by: (#8413)
[watch] Align cinfo->stack_usage to 16 on watchos. (#8354)

Fixes https://github.com/mono/mono/issues/8409.
2018-04-24 03:54:35 -04:00
Marek Safar 5edc0db0c6 [corlib] Clean up .sources files (#8389)
* [corlib] Clean up .sources files

* [csproj] Update project files
2018-04-24 00:09:09 +02:00
Marek Habersack e609d3c25e Use g_print to dump threads when SIGQUIT is sent to Mono (#8385)
printf, fprintf don't work on Android, using g_print will redirect the output to
mono-stdout so that it can appear in Android logcat output.
2018-04-23 18:03:04 -04:00
Bernhard Urban 0ccaa5acdd [interp] add System tests to CI (#8370)
https://github.com/mono/mono/issues/7053
2018-04-23 18:02:42 -04:00
Jay Krell 5a58157c51 [tailcall arm64] Add tailcall_reg support for arm64. (#8390)
* [Tailcall] Print more. Clarify printing. Dial back a fix by one line
until a test demonstrates it is required.
Move debug_tail up for easier editing.

* [Tailcall arm64] Add tailcall_reg support.

* Fix new warning about  maybe-used-uninitialized -- moving variables down is incompatible slightly with goto around them.
2018-04-23 20:59:12 +02:00
Jo Shields d4574fcf11 Turn off BTLS assembly optimizations on 32-bit ARM. (#8366)
See https://github.com/mono/mono/issues/8100
2018-04-23 12:57:39 -04:00
Bernhard Urban ffdb072fdf [interp] add System.Core tests to CI (#8371)
https://github.com/mono/mono/issues/7053
2018-04-23 12:52:07 -04:00
Bernhard Urban a5a355b4f0 [interp] box_not_clear_vt_sp must be checked for right element on the stack (#8365)
it was checking always top-of-stack before.

https://github.com/mono/mono/issues/7053
2018-04-23 16:33:54 +02:00
Alexander Köplinger 30c51f88a8 [System] Temporarily disable failing TypeDescriptorTests on FullAOT (#8408)
See https://github.com/mono/mono/issues/8407
2018-04-23 15:55:47 +02:00
Rodrigo Kumpera bf80d5ad2d Add delegate marshaling. 2018-04-21 22:19:02 -04:00
Alexis Christoforides 7ce681a7fe Merge pull request #8346 from mono/macsdk-update-llvm
[MacSDK] Update LLVM to head of mono/llvm's master
2018-04-21 15:23:43 -04:00
monojenkins 2f08c620b7 [msvc] Update csproj files (#8392) 2018-04-21 09:53:54 -07:00
Zoltan Varga 3783e078f9 [runtime] Handle failed classes in mono_type_get_checked (). (#8318)
* [runtime] Handle failed classes in mono_type_get_checked (). Fixes https://github.com/mono/mono/issues/8311.

* [runtime] Use m_class_has_failure ().

* [runtime] Set the error if the class has a failure.
2018-04-21 02:32:20 -04:00
Egor Bogatov 09de0b9e1b [System] ComponentModel and System.Net from corefx (#7948)
* ComponentModel from corefx

* System.Net.Mail from corefx

* update SR.cs

* fix build error

* fix tests

* undo run-test-default.sh change

* update corefx

* fix failing tests

* hide DesignerAttribute on mobile profiles

* Bump API snapshot submodule
2018-04-20 22:04:39 -07:00
Rodrigo Kumpera b8a19e5d02 [wasm] Add JSObject::Invoke. 2018-04-20 21:10:36 -04:00
Alexander Köplinger f93b967327 [corlib] Bump allowed diff time in FileTest.LastWriteTimeSubMs
I've seen it fail with this:

```
1) LastWriteTimeSubMs (MonoTests.System.IO.FileTest.LastWriteTimeSubMs)
     Iteration #22 failed, diff.TotalSeconds: 1.000023, untouched: 20:14:03:0000000, now: 20:14:04:0000230
  Expected: True
  But was:  False
```
2018-04-21 00:51:28 +02:00
Ludovic Henry f9a77468d1 [ci] Add jit_llvm configuration (#8317) 2018-04-20 17:49:13 -04:00
Alexander Kyte 24ef42576f [runtime] Add a signal handler for sigterm (#8240)
* [runtime] Add a signal handler for sigterm

* [runtime] Register sigtramp when merp handler enabled

* [runtime] Limit sigterm handler symbol definition to OSX
2018-04-20 16:14:09 -04:00
Ludovic Henry e78cae2f38 [sdks] Match more closely the pre-SDKs configure flags passed to LLVM (#8379) 2018-04-20 16:03:31 -04:00
Rodrigo Kumpera 41dae93cb6 [wasm] More tests. 2018-04-20 15:35:11 -04:00
Rodrigo Kumpera ac3d73c140 [wasm] Sample binding with bidi comms 2018-04-20 15:07:20 -04:00
Alexis Christoforides 3b700c8e2c [MacSDK] Update LLVM to head of mono/llvm's master 2018-04-20 14:12:46 -04:00
Zoltan Varga 3106c27291 [watch] Align cinfo->stack_usage to 16 on watchos. (#8354)
Fixes https://github.com/mono/mono/issues/7685.
2018-04-20 13:38:04 -04:00
Rodrigo Kumpera 57b2b6960d [wasm] Implement minimal bidirectional object binding. 2018-04-20 12:41:24 -04:00
Rodrigo Kumpera 976cd1b45d [wasm] binding improvements. 2018-04-20 12:41:17 -04:00
Rodrigo Kumpera 9763bd75b7 [wasm] Address reviewer feedback. 2018-04-20 12:40:32 -04:00
Bernhard Urban 8d30d41909 [interp] fix warning introduced with 8e0a12189a (#8359)
```
interp/transform.c:2870:44: warning: cast to 'gpointer' (aka 'void *') from smaller integer type 'guint32' (aka 'unsigned int') [-Wint-to-void-pointer-cast]
                                ADD_CODE (td, get_data_item_index (td, (gpointer) token));
                                                                       ^
```
2018-04-20 12:06:28 -04:00
Bernhard Urban 9b47d566ae [System.Net] do not use Thread for SocketTest.TestSelect1 (#8364)
it makes the test less reliable. Potentially helps with
https://github.com/mono/mono/issues/8360
2018-04-20 11:57:57 -04:00
jaykrell 736683e77d [Tailcall amd64] Use calli/tailcall_reg in method-to-ir for F# FullAOT. (#8265)
* [Tailcall] Use tailcall_reg to tailcall internal `calli` to improve F# FullAOT tests.

Rework printing a bit and add more.

Split mini_emit_calli into mini_emit_calli and mini_emit_calli_full.
mini_emit_calli_full takes an extra tailcall parameter.
This enables fixing some F# tests.

`check_sp` inhibits tailcall -- share logic and assert --  in order
	to only call `is_supported_tailcall` once.

mono_emit_call_args is big and probably shouldn't be inlined; let compiler decide
anyway, which it always does.

Significant reworking of is_supported_tailcall.

	Have it compute "regular" and "calli".

	Replace is_interface with imt_arg which should be a more accurate
	representation of the important part.

Capture complex conditionals `virtual_generic` and `virtual_generic_imt`
into local variables, so they can be evaluated a second time,
so that `is_supported_tailcall()` can be called just once with its
final inputs.

Move `tailcall` and `tailcall_calli` `tailcall` down
to initialization and make them const (with a temporary/internal non-const).

Note that tailcall still gets changed/reevaluated in multiple places,
and the new value is not returned. One such duplication is the form
of shared logic and an assert (check_sp), the other (calli + llvmonly) is not.

The correct value is needed, sometimes, for e.g. remove_ret.
There also remains a path that appears to change it to false but true in `ins`.
2018-04-20 08:18:22 -07:00
Bernhard Urban 384c4a4e2e [mini] fix some warnings with newer GCC (#8308)
* [interp] fix warning

```
interp/interp.c: In function ‘ves_real_abort’:
interp/interp.c:251:17: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=]
   printf ("\t[%ld] 0x%08x %0.5f\n", sp-stack, sp[-1].data.i, sp[-1].data.f);
               ~~^                   ~~~~~~~~
               %d
```

* [mini] ignore GCC warning in trace.c

```
trace.c: In function ‘mono_trace_enter_method’:
trace.c:145:3: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address]
   printf (") ip: %p\n", MONO_RETURN_ADDRESS_N (1));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

* [tramp-x86] remove unused function

```
tramp-x86.c:171:1: warning: ‘get_vcall_slot_addr’ defined but not used [-Wunused-function]
 get_vcall_slot_addr (guint8* code, mgreg_t *regs)
 ^~~~~~~~~~~~~~~~~~~
```

* [mini-x86] remove unused function

```
mini-x86.c:6327:1: warning: ‘emit_load_aotconst’ defined but not used [-Wunused-function]
 emit_load_aotconst (guint8 *start, guint8 *code, MonoCompile *cfg, MonoJumpInfo **ji, int dreg, int tramp_type, gconstpointer target)
 ^~~~~~~~~~~~~~~~~~
```

* [tramp-x86] remove unused function

```
tramp-x86.c:146:1: warning: ‘get_vcall_slot’ defined but not used [-Wunused-function]
 get_vcall_slot (guint8 *code, mgreg_t *regs, int *displacement)
  ^~~~~~~~~~~~~~
```

* [mini-x86] change previous_lmf to pointer type (same as amd64)

```
mini-runtime.c: In function ‘mono_push_lmf’:
mini-runtime.c:806:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  ext->lmf.previous_lmf = *lmf_addr;
                        ^
mini-runtime.c:808:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  ext->lmf.previous_lmf = (gpointer)(((gssize)ext->lmf.previous_lmf) | 2);
                        ^
mini-exceptions.c: In function ‘arch_unwind_frame’:
mini-exceptions.c:420:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    *lmf = (MonoLMF *)(((guint64)(*lmf)->previous_lmf) & ~3);
           ^
mini-exceptions.c: In function ‘unwinder_unwind_frame’:
mini-exceptions.c:715:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      *lmf = (MonoLMF *)(((guint64)(*lmf)->previous_lmf) & ~7);
             ^
```

* [monolmf/x86] make int cast dependend one machine word size

```
In file included from debugger-agent.c:36:0:
debugger-agent.c: In function ‘get_top_method_ji’:
debugger-agent.c:2501:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   g_assert (((guint64)lmf->previous_lmf) & 2);
              ^
../../mono/eglib/glib.h:710:46: note: in definition of macro ‘G_UNLIKELY’
 #define G_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0))
                                              ^~~~
debugger-agent.c:2501:3: note: in expansion of macro ‘g_assert’
   g_assert (((guint64)lmf->previous_lmf) & 2);
   ^~~~~~~~
```

* [interp] remove unnecessary code

* [mini] fix ptr with int cmp

this was wrongly changed.

```
mini-exceptions.c: In function ‘unwinder_unwind_frame’:
mini-exceptions.c:702:33: warning: comparison between pointer and integer
   if (unwinder->last_frame_addr > (gsize)(*lmf)) {
                                 ^
```
2018-04-20 14:27:47 +02:00
Niklas Therning cc3666fa8d Remove unused signal.h include in interp.c (#8334)
This include breaks compiling the interpreter on platforms which don't have a
signal.h. The code in interp.c doesn't seem to need it to be included anyway.
2018-04-20 00:38:07 -04:00
Alexis Christoforides fb3f745e34 Merge pull request #8357 from akoeplinger/fsharp-fixes
[packaging] Apply F# patch that fixes #8310
2018-04-20 00:27:39 -04:00
Bernhard Urban 8127483e8a [interp] remove useless assert in mint_newobj
Fixes https://github.com/mono/mono/issues/8329. That is, make the
interpreter work on Windows.
2018-04-20 04:25:09 +02:00
Alexander Köplinger d0db2e0ab0 [packaging] Apply F# patch that fixes #8310
Upstream patch is at https://github.com/fsharp/fsharp/pull/844
2018-04-20 01:05:07 +02:00
Ludovic Henry a5fc6c9f0f [corlib] Disable failing test on XA (#8351)
This follows https://github.com/mono/mono/commit/64ec2dd3eb1309b84819b34c4279d946acacd082.
2018-04-19 21:34:21 +02:00
Rodrigo Kumpera 81aec9f693 [wasm] Fix CI target and npm install to be local. (#8339)
* [wasm] Fix CI target.

* [wasm] Switch to do a local install of npm packages.

* [wasm] Switch to fine-grained execution steps to avoid VM bugs.

* [wasm] Disable System.Core under Chakra as the JS engine crashes.
2018-04-19 20:51:16 +02:00
jaykrell 967b596735 [Tailcall] Add some tests derived from F# code to be used soon. (#8333)
Includes case for https://github.com/mono/mono/issues/8273 where
FullAOT is hundreds of time slower than AOT or JIT (under a second vs. 9 minutes).
2018-04-19 20:23:46 +02:00
jaykrell cb83034748 [Tailcall] Remove OP_JMP support. Require OP_TAILCALL. (#8327)
* [Tailcall] Remove OP_JMP support. Require OP_TAILCALL.
This only hurts mips and sparc -- it breaks them.
Remove front end support for OP_JMP and conditionalality of OP_TAILCALL.

* And remove MONO_ARCH_HAVE_OP_TAILCALL and require mono_arch_tailcall_supported.

* And tailcall_remove_ret becomes temporarily irrelevant.

* [Tailcall] Keep mips and sparc working, albeit never tailcalling.

* Remove jmp opcode too.
2018-04-19 11:05:45 -07:00
jaykrell 30f431a880 Shrink or eliminate small local arrays. (#8331) 2018-04-19 20:03:43 +02:00
jaykrell ba75323553 [jit] Add tailcall_reg common and amd64 support, to be used soon (#8332)
for F# FullAOT.

Add some FIXMEs about alignbment and possible
improvements (fixed size rep mov to move tailcall parameters).

Grow static unknown sizes to 255.
2018-04-19 12:13:18 -04:00
Rolf Bjarne Kvinge a9eac69ffc [sdks] Wrap configure to provide better output. (#8306)
* [sdks] Wrap configure to provide better output.

Wrap configure in a script that:

* Captures stdout/stderr and only shows it in case of errors.
* If configure fails, and a cache file was used, deletes the cache file and
  tries again.
* If configure really fails, then print config.log in addition to
  stdout/stderr, since a lot of valuable diagnostic output is in that file
  (and it's annoying to track down configure failures on bots when the file
  with the important output has already been deleted).

* Only show config.log when running on bots.
2018-04-19 11:20:25 -04:00
Zoltan Varga cd075b31b1 [aot] Avoid making the plt labels referenced by the llvm generated code temporary, since they need to be accessed from another object file. (#8330) 2018-04-19 11:08:11 -04:00
Alexander Köplinger 9c6d95d9eb [mini] Fix mini-ppc.c build, missing semicolon 2018-04-19 15:41:52 +02:00
Andoni Morales Alastruey 0450dc0785 * [System.ServiceModel.Discovery] Fix messages validation to fix bug #46917 (#3772)
* [System.ServiceMode] Create unit test for #46917

* [System.ServiceModel.Discovery] Fix messages validation

The current validations are not correct and throws an exception calling
GetVideoSources API in an ONVIF media client. This API
is a combination of a first message with an input parameter and
a second message with the reply that is not void.
Removing this checks makes the client work correctly.

Fixes #46917
2018-04-19 13:54:32 +02:00
Aleksey Kliger (λgeek) 006d6ce097 [threads] Check that thread is in a valid suspend state before notifying (#8281)
* [threads] Check that thread is in a valid suspend state before notifying the initiator.

* [threads] Suspend running threads cooperatively in coop or hybrid suspend

Reverts an inadvertant change from 282ee4bfd7

* [checked-build] Add a mutex in collect_backtrace

GNU libc backtrace() calls _Unwind_Backtrace in libgcc which internally may
take a lock.

That allows for a deadlock situation where two threads try to call collect_backtrace and
one of them takes the lock and is async suspended with the lock held, while the
other is supposed to cooperatively suspend but it is blocked waiting for the
backtrace mutex.

The suspend initiator ends up waiting indefinitely for the threads to suspend,
and the runtime hangs.

As a workaround we add a mutex around the call to backtrace() and only collect
a backtrace if we can immediately grab the lock without contention.

* [threads] Drop DoneBlockingNotifyAndWait & AbortBlockingNotifyAndWait

These two actions were causing a race in hybrid suspend.
Suppose thread T is in blocking and thread S (suspend initiator) wants it to
suspend:

S sets T to BLOCKING_SUSPEND_REQUESTED and sends a suspend signal and waits for
pending operations.

T continues running and comes to exit the GC Safe region.

T executes done_blocking and transitions to BLOCKING_SELF_SUSPENDED and returns
  DoneBlockingNotifyAndWait.

T notifies S; T waits for a resume.

S wakes up, does whatever it needs to do and resumes T - T goes from
BLOCKING_SELF_SUSPENDED to RUNNING.

T wakes up and finishes the done blocking transition.

Suspend signal finally arrives in T. T attempts finish_async_transition from
RUNNING.  Assertion. Crash.

What we do in this commit is change done blocking not to notify the initiator.
Instead done blocking immediately waits for a resume.

In that case T is waiting for a resume in BLOCKING_SELF_SUSPENDED, and S is
waiting for pending operations.  So when T's suspend signal handler runs, it
will return FALSE (raced with self suspend), send a notification to the
suspend initator, and then immediately return. T then will continue waiting for
the resume. S will wake up, do what it needs to do and switch T to RUNNING and
post the resume to wake it.
2018-04-19 07:28:14 -04:00
jaykrell d708487b3f [Tailcall] Remove outdated references to OP_JMP that only make the code harder to understand. (#8315) 2018-04-18 23:35:54 -04:00
Ludovic Henry 39c42f577c [sdks] Fix mktemp parameters (#8322) 2018-04-18 19:14:34 -04:00
hharyono 95e69bc032 [WindowsBase] Fix ZipPackage.WriteContentType when extension is empty. (#4943)
When a part without extension was added an empty Extension attribute was written, which is incorrect and didn't match the Windows/.NET implementation:

![xml result](https://cloud.githubusercontent.com/assets/28587808/26567052/52c49378-4522-11e7-8bfc-f3dfa966b9b5.png)
2018-04-19 01:04:54 +02:00
jaykrell e721a73479 Fix warning: function declaration isn’t a prototype () vs. (void). (#8301)
class-inlines.h:13:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
  mono_get_void_type ()

In C: () means accept any parameters -- K&R unprototyped
      (void) is new-standardized-in-1989 form meaning accept no parameters

In C++ this is fixed and they mean the same thing -- accept no parameters.

To accept any parameters in C++, use (...), which is not valid in C, C requires
  at least one fixed-type parameter when you use "...".

() is very rarely what you want in C, or in C++ headers consumable from C.

If you do need () for highly unusual code, for a function that accepts anything,
and has no fixed parameters, then use ifdef __cplusplus and ... for C++.

printf for example does not fit in this bucket because it always has the const char *format.

In fact, it is so rare because a variable-argument ("varargs") function would need *some* way to decide what is in "...".
2018-04-19 00:58:50 +02:00
Rodrigo Kumpera 848d59880e [wasm] Build bcl bits serially to avoid parallel hazzards. (#8313) 2018-04-19 00:33:28 +02:00
Hugh Bellamy 4bd60ea895 Fix Gdi+ WrongState exception type and remove incorrect test for GdiPlus status code (#8276)
* Fix Status.WrongState exception

* Remove invalid test for GdipLockBits

* Fix LinearGradientBrush behaviour to match netfx/netcore
2018-04-18 17:43:14 -04:00
Bernhard Urban 42d425cb62 [corlib] add sanity check to filetest for last access modification time 2018-04-18 20:37:31 +02:00
jaykrell 3815cde68c Fix mono_perfcounter_instance_exists to match prototype when #ifndef DISABLE_PERFCOUNTERS. (#8302) 2018-04-18 09:34:50 -07:00
Alexander Köplinger bd3d33e39f [mini] Fix build for ENABLE_LLVM, missing semicolon 2018-04-18 13:49:54 +02:00
jaykrell e97721555e Teach sn.exe about PE32+, and while there ROM images and MS-DOS-less images. (#8232)
* Teach sn.exe about PE32+, and while there ROM images and MS-DOS-less.
See https://github.com/mono/mono/issues/8218.

* Make Error static.

* Remove .Close () redundant with using.

* Use helper function ReadMore and System.Array.Resize.

* Fix typos in comment.

* Move hash.Hash to fix 'Hash must be finalized before the hash value is retrieved.'.

* Cleanup.
2018-04-18 05:47:38 +02:00
iamphi 96a089ae5e Fix Automatic Proxy Configuration protocol for OSX 10.13 (#8227)
* Fix Automatic Proxy Configuration protocol for OSX 10.13

Reference comparison of kCFProxyTypeAutoConfigurationURL doesn't work in 10.13. Added fallback to do value/string comparison to get proxy type

* Change string comparison from C# string to CFString for possible memory safety and efficiency

* Code style changes
2018-04-17 22:34:00 -04:00
Sebastien Pouliot b8fa6a1519 [mono-api-html] Fix markdown diff which was reversed (#8285)
The previous code would produce

```diff
-public const string Version = "11.11.0";
+public const string Version = "11.9.1";
```

instead of

```diff
-public const string Version = "11.9.1";
+public const string Version = "11.11.0";
```

when diff are inlined. The addition and removal sections are fine.
2018-04-17 22:30:27 -04:00
Alexander Köplinger b6d2fb13cf [corlib] Fix TimeZoneInfo.Local when /usr/share/zoneinfo is a symlink (#8283)
We'd be using the path verbatim to compare with the resolved value of
/etc/localtime but if it's a symlink (like on OSX 10.13+) the comparison failed.

The fix is to resolve any symlinks for /usr/share/zoneinfo too.

Fixes https://github.com/mono/mono/issues/8267 and https://github.com/xamarin/maccore/issues/628
2018-04-17 22:29:51 -04:00
Rodrigo Kumpera 6d4220767d [WASM] Fix OSX & linux build plus a new test failure in mini. (#8289)
* [wasm] Fix build scripts to work on linux.

* [wasm] Force emscripten version to 1.37.36 to fix OSX breakage.

* [wasm] Fix failure in new FloatF test.

* [wasm] Fix detection of test failure.
2018-04-17 22:28:52 -04:00
Jo Shields ed30706c31 Fix building of LOADED_LLVM on Linux, from duplicate eglib linking (#8287) 2018-04-17 22:27:44 -04:00
Bernhard Urban a56d0f87c0 [w32file-unix] fix mistake in 8430155946 (#8293)
commit message said
> [w32file-unix] convert nano seconds to microseconds properly, by using
> TICKS_PER_MILLISECOND (which has L suffix in its definition)

first it talks about microseconds, but then uses constant for _milli_
seconds
2018-04-17 22:27:17 -04:00
Zoltan Varga 356dd453e8 [sdks] Use the same directories for the downloaded and built llvm. (#8295) 2018-04-17 22:25:26 -04:00
Ludovic Henry d6072d7554 [corlib] SynchronizationContext does not work on non-root AppDomain on Android (#8291)
AndroidEnvironment.GetDefaultSyncContext just crashes when called on an AppDomain which is not the root AppDomain. This started appearing with the mono:2018-02 integration during which https://github.com/mono/mono/commit/252d61d0558b0bfa3461f3339ce617e2e4c285bb was introduced.

Fixes https://github.com/xamarin/xamarin-android/issues/1561\#issuecomment-381736716
2018-04-17 22:23:57 -04:00
Zoltan Varga 78f5f3cd3f [runtime] Add a 'generated file' warning to mini/Makefile.am. (#8286) 2018-04-17 19:01:15 -04:00
Rodrigo Kumpera cb08c5d1ac Merge pull request #8270 from kumpera/move_to_jsvu
[wasm] JS engine testing improvements.
2018-04-17 13:28:19 -04:00
jaykrell e8b7eeffe9 [Tailcall] Generally remove underscores and spaces in "tail_call", "TAIL_CALL", "tail call", etc. (#8271)
Also standalone "tail" to "tailcall".
For consistency and ease of search -- "longer words are better".
Leave profiler alone generally.
2018-04-17 08:21:32 -07:00
Rolf Bjarne Kvinge 09bcdbc5a6 [runtime] Add public API to set the pending exception. (#7759)
* [runtime] Add public API to set the pending exception.

Xamarin.iOS and Xamarin.Mac need a public API to set the pending exception
when converting Objective-C exceptions to managed exceptions.

This adds a public API to support this scenario.

Partially fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60065.

* [runtime] Document that pending exceptions should not be overwritten when the runtime is handling a thread abort request.
2018-04-17 16:06:59 +02:00
Rodrigo Kumpera 1e32e5cee3 Fix typo. 2018-04-17 09:43:28 -04:00
Aleksey Kliger (λgeek) 1a525f1193 Hybrid suspend and checked build fixes (async signal safety) (#8269)
* [threads] Have Hybrid Suspend not depend on Coop Suspend

* [threads] Enable CI

* [hybrid suspend] Wait for pending operations when suspending a blocking thread

In hybrid suspend we should wait for the pending suspend to finish when we're
suspending a blocking thread.

In full cooperative suspend, we treat blocking threads as already suspended, so
in that case there is nothing to wait for.

* [checked-build] don't use malloc for thread state history

Use a ring buffer, so we're signal safe.

* [checked-build] checked_build_thread_transition - async signal safe variant

Can't call backtrace on Linux from a signal handler.

Change mono_threads_transition_finish_async_suspend not to collect a
backtrace.
2018-04-17 07:26:08 -04:00
Alexis Christoforides f41f8f2020 Merge pull request #8264 from jaykrell/monotrace
Refactor 3 copies of mono_trace_is_traced into 1.
2018-04-16 21:28:33 -04:00
Ludovic Henry 282ee4bfd7 [threads] Remove configuration dependency of Hybrid Suspend on Coop Suspend (#8261)
* [threads] Have Hybrid Suspend not depend on Coop Suspend

* [threads] Enable CI
2018-04-16 17:54:57 -04:00
Bernhard Urban 8fec8eeeae [ppc] disable aot-tests on CI 2018-04-16 23:10:42 +02:00
Bernhard Urban 89e69bbb62 [ppc] disable failing tests 2018-04-16 23:10:42 +02:00
Bernhard Urban 155a561531 [mono/tests] disable some tests if csharp compiler is not roslyn 2018-04-16 23:10:42 +02:00
Rodrigo Kumpera 0d754e28a1 [wasm] Update our CI/test scripts to use the newer targets and include Mono.Security as System.Core now needs it. 2018-04-16 17:02:45 -04:00
Rodrigo Kumpera 37bd17ec68 [wasm] Switch JS VM provisioning to use jsvu. Add support for testing with all 4 major engines. 2018-04-16 17:02:20 -04:00
Aleksey Kliger (λgeek) 83281c91b9 Rename MonoClass field byval_arg to _byval_arg (#8219)
* [class] Rename MonoClass byval_arg field to _byval_arg

Update all use sites to use the getter method m_class_get_byval_arg instead
when possible.

* [runtime] add mono_get_*_type accessors for common MonoTypes

Just do void, object, int32 and int (aka IntPtr) for now
2018-04-16 14:46:21 -04:00
Katelyn Gadd 7eff6686fd Default platform to net_4_x if none is specified, to fix tools that build without setting a platform (#8223)
* Default platform to net_4_x if none is specified, to fix tools that build without setting a platform

* [csproj] Update project files
2018-04-16 09:54:53 -04:00
Jay Krell e229e049f0 Refactor 3 copies of mono_trace_is_traced into 1.
Refactor g_print on top of new g_printv. g_log / g_logv provided precedent.

The intent is like:
void foo_print (const char *format, ...)
{
 if (debug_foo || MONO_IS_TRACED (foo, log)) {
   va_list args;
   va_args (format, args);
   g_printv (format args)
 }
}

so I can either set the environment variable, or edit the global,
besides removing the two parameters from every mono_trace call.
2018-04-16 02:07:19 -07:00
Zoltan Varga a948ed91e7 [llvm] Fix support for LLVM_API_VERSION==391 which is used by the release_39 branch in mono's llvm fork. (#8259) 2018-04-15 23:35:59 -04:00
jaykrell 8c3555d315 x86/amd64 require a control transfer to notice writes to code (citation needed). (#8257)
Therefore, while mono_arch_flush_icache does not need to do anything,
it cannot be inlined.
2018-04-15 16:30:23 -04:00
Zoltan Varga 006c825990 [jit] Enable float32 by default. (#4731)
* [jit] Enable float32 by default.

* [arm64] Fix some 32 bit float compares so they handle unordered operands correctly.

* [runtime] Disable a coreclr test which fails with float32.
2018-04-15 13:28:59 -04:00
Rodrigo Kumpera 85181dc808 [iolayer] Handle ENEEDAUTH on OSX, map it to ERROR_ACCESS_DENIED as it's the closest error possible. (#8239) 2018-04-15 13:25:47 -04:00
Zoltan Varga a5b0e4203a [arm64] Fix some 32 bit float compares so they handle unordered operands correctly. (#8255) 2018-04-15 13:25:04 -04:00
Zoltan Varga 719a27d2a0 [runtime] Disable a coreclr test which fails with float32. (#8256) 2018-04-15 13:23:45 -04:00
Zoltan Varga c3d574a5a4 [llvm] Update the llvm backend to work with the 2017-12-01-31d7f39423874d52922c06484f2c2af216844b4d branch in the mono llvm repo. The pavg.b/w sse intrinsic were removed since they can now be implemented in llvm IR. (#8253) 2018-04-14 16:40:37 -04:00
jaykrell f958cc5d97 [Tailcall] Enable more tailcall tests on x86/amd64/arm64. (#8103)
* [Tailcall] Enable more tailcall tests on x86/amd64/arm64.

* [Tailcall] Disable tailcall-interface-conservestack.exe for now on x86 and AOT.
2018-04-14 11:21:11 -04:00
Ben Adams a810d53e41 Make stack traces readable (#6675)
* Make stack traces readable

* Updates the logic to work on Mono

* [symbolicate] Add support for prettified async stack traces

* Tests update
2018-04-14 14:38:18 +02:00
Bernhard Urban 8430155946 Fix timestamp for file copy (#8231)
* [FileTest] regression for https://github.com/xamarin/xamarin-macios/issues/3929

* [w32file-unix] fix File.Copy timestamps

4a8d840d6f introduced that the destination
file of a copy operation has the same modification and access timestamps
as the source file.

With e0e185d70a this behaviour regresses,
since getting timestamps provides more precise information. Fixing this
by being more accurate when applying timestamps to destination file.

* [w32file-unix] convert nano seconds to microseconds properly, by using TICKS_PER_MILLISECOND (which has L suffix in its definition)

* [w32file-unix] introduce constant for ns->qs conversion with proper suffix

fixes problem on 32bit.
2018-04-14 10:25:23 +02:00
jaykrell 90a6203996 Teach metadata-verify.c about PE32+. Remove extra string copies. (#8224)
* Remove extra string copies.

* Teach metadata-verify.c about PE32+.
2018-04-13 23:34:09 -04:00
Zoltan Varga 2963f5698f [jit] More float32 fixes. (#8234)
* [jit] Add a r8->r4 conversion in stind.r4 when the item on the stack is a r8 because of stack merging.

* [jit] Disable a SIMD test which can fail with -O=float32 due to precision problems.

* [jit] Use m_class_get_byval_arg ().

* [jit] Fix OP_RCONV_TO_I on amd64.

* [jit] Revert '[jit] Use r8 for r4 stack vars to avoid problems with stack merges when one side is an r4 and the other an r8. Add conversions for compares. (#8196)'. It causes r4-r4 merges to produce an r8 stack value, leading to invalid il errors.
2018-04-13 22:17:24 -04:00
Ludovic Henry 9bb635db6c [sdks] Fix typo + Fix verbosity of unzip-android-archive.sh (#8242) 2018-04-13 19:34:44 -04:00
Jonathan Chambers ec32e2aafa Check for successful return value rather than an incomplete set of non-successful codes (#3974) 2018-04-13 18:16:59 -04:00
Jonathan Pryor 76fd5b6b02 [Mono.Options] Allow CommandSet nesting, spaces in command names. (#7406)
* [Mono.Options] Allow CommandSet nesting, spaces in command names.

`git` (largely) only provides a single level of sub-commands, and
this is the use case that `Mono.Options.CommandSet` originally
supported.

However, this isn't the case for all command-line applications.
Take for example the Azure [`azure`][azure] command, which allows near
arbitrary command name depths:

[azure]: https://docs.microsoft.com/en-us/azure/virtual-machines/azure-cli-arm-commands

	$ azure config mode arm
	$ azure vm create
	$ azure vm list
	$ azure vm disk attach

Try to integrate "arbitrary" command nesting through two new
mechanisms:

 1. `Command` names may now contain spaces, and
 2. `CommandSet`s may be nested within `CommandSet`s.

`Command` names containing spaces allows for the same *style* of
"nested" sub-commands, but means that C# nesting isn't as deep:

	var azure = new CommandSet ("azure") {
	  new Command ("config mode") {...},
	  new Command ("vm create") {...},
	  new Command ("vm list") {...},
	  new Command ("vm disk attach") {...},
	};

When `CommandSet.Run()` is invoked, separate string indexes will be
"merged" while attempting to find a matching command-name, allowing
the "natural" command-line invocation to be used:

	mono example.exe vm disk attach
	# Invokes `vm disk attach` command

Alternatively, a `CommandSet` may be added to a `CommandSet`:

	// C#
	var azure = new CommandSet ("azure") {
	  new CommandSet ("vm") {
	    new Command ("create") {...},
	    new Command ("list") {...},
	  },
	};

When this is done, `CommandSet.Suite` is required on the command-line:

	mono example.exe vm list

If a "`Command` with spaces" has the same command-name as a nested
`CommandSet`, the `Command` "wins" and is invoked.

* [Mono.Options] Fix unsupported MCS compiler feature

* Bump API snapshot submodule
2018-04-13 18:16:01 -04:00
Vlad Brezae 8401610bb0 [interp] Exit from finally abort protected block when EH (#8207)
Fixes https://github.com/mono/mono/issues/7402
2018-04-13 18:14:27 -04:00
Jo Shields 6d4263a3a5 Add PowerPC configure flags for LLVM, and clean up failover linker flags (#8233) 2018-04-13 18:11:37 -04:00
Bernhard Urban 79c33e27eb [ppc] poll interruption checkpoint in generic trampoline (#7431)
* [ppc] poll interruption checkpoint in generic trampoline

* [ppc] remove throw var, it is a keyword in C++
2018-04-13 18:10:09 -04:00
jaykrell ec0406ba13 Remove redundant null checks before g_free(). (#8228) 2018-04-13 10:49:03 -04:00
Miguel de Icaza 52157b625a [PATCH] SemaphoreSlim, fail faster for timeout 0
This brings the patch: https://github.com/dotnet/coreclr/pull/6898

Fail faster for `Wait(0)` when no counts available.

Don't allocate in the `Wait(0)` and `WaitAsync(0)` fail paths.

1M iters Server GC

method | pre (ms) | post (ms) | improvement
-------- |------- |------- |------ |
Wait(0) | 33,788.25 | 12.28 | x 2751.5
WaitAsync(0) | 360.79 | 24.38 | x 14.8

Memory allocations, saves 360MB over the 1M ops
2018-04-13 10:20:47 +02:00
Jay Krell 95dc93543d Verify all 4 bytes of PE signature. 2018-04-13 09:02:55 +02:00
Zoltan Varga 7cc93270a1 [jit] Use r8 for r4 stack vars to avoid problems with stack merges when one side is an r4 and the other an r8. Add conversions for compares. (#8196)
* [jit] Use r8 for r4 stack vars to avoid problems with stack merges when one side is an r4 and the other an r8. Add conversions for compares.

* [jit] Use m_class_get_byval_arg in one place.

* Add a FIXME.
2018-04-13 01:57:11 -04:00
Zoltan Varga 5e9af502c0 [runtime] Get rid of the GLIB_LIBS autoconf define, it prevents automake from detecting the dependency on libeglib.la. (#8184)
* [runtime] Get rid of the GLIB_LIBS autoconf define, it prevents automake from detecting the dependency on libeglib.la. Fixes #8175.

* [runtime] Link eglib against -lm to avoid duplication.

* [runtime] Remove a few extra -lm options.

* [runtime] More GLIB_LIBS fixes.
2018-04-13 00:29:31 -04:00
Zoltan Varga fbd4054609 [jit] Use m_class_get_byval_arg () in more places. (#8211) 2018-04-13 00:26:44 -04:00
Alexis Christoforides f6cc1d0605 Merge pull request #8208 from svick/patch-1
Improved wasm sdk README formatting
2018-04-12 16:40:35 -04:00
Alexis Christoforides 1a8142c7db Merge pull request #8202 from lewurm/system-net-disable-tests
[system.net] disable some tests to unblock XI integration
2018-04-12 15:58:00 -04:00
Petr Onderka 97d8d31c4d Improved README formatting 2018-04-12 19:20:42 +02:00
Vlad Brezae 2fd38a2f4b [interp] Fix resuming from finally block (#8195)
In interp we implement the leave statement by enqueuing finally ips (and the destination ip that we are leaving to) that we call as we exit finally blocks. When throwing an exception from a finally block we need to flush these ips, so we don't jump back into clauses that were already skipped by EH.
2018-04-12 12:54:26 -04:00
Rodrigo Kumpera a14f41ca26 [wasm] Fix the disable sdb check. Fixes #8177. (#8182)
[wasm] Fix the disable sdb check.

Fixes https://github.com/mono/mono/issues/8177
2018-04-12 17:55:08 +02:00
Bernhard Urban e1518f94d0 [system.net] disable some tests to unblock XI integration
regression tracked here: https://github.com/xamarin/xamarin-macios/issues/3827
2018-04-12 17:37:31 +02:00
Alexander Kyte 46b089bd6c [runtime] Make GetFrames consider nested exceptions (#8166)
* [runtime] Make GetFrames consider nested exceptions

Fixes #7260

* [runtime] Add test from repro for #7260

* [runtime] FIx test using absolute line numbers
2018-04-12 17:05:54 +02:00
Rolf Bjarne Kvinge f3890bdb8d [System.Net.Http] Use '*' as the host instead of '+' in the tests. Fixes xamarin/maccore#673.
Use '*' as the host instead of '+' in the tests.

The behavior should be the same, just faster, because '+' will fail to resolve
("Could not resolve host '+'"), and we'll fall back to the same behavior as
'*': https://github.com/mono/mono/blob/5128cce2dcd097aa4e7b86dd3b56e833c15a9ff0/mcs/class/System/System.Net/EndPointManager.cs#L83-L96

The problem arises when failing to resolve '+' takes a long time: on some of
our bots it takes 5-10 seconds. This adds up quickly since the tests try many
times, effectively increasing a test run from 1-2 seconds to 30+ minutes.

Fixes https://github.com/xamarin/maccore/issues/673.
2018-04-12 14:23:57 +02:00
EgorBo d3f6bdef87 remove header 2018-04-12 12:11:58 +02:00
EgorBo f248a4b43a Fix 6306 Disposing RSA objects obtained with GetRSAPublicKey/GetRSAPrivateKey makes keys unusable. 2018-04-12 12:11:58 +02:00
Marek Safar b5ad18926f [System] Fixes build 2018-04-12 11:47:48 +02:00
monojenkins 093df52396 [csproj] Update project files 2018-04-12 11:39:27 +02:00
monojenkins bafb1d21b8 Bump API snapshot submodule 2018-04-12 11:39:27 +02:00
Marek Safar d98db19805 [build] Bumps bootstrap mcs requirement 2018-04-12 11:39:27 +02:00
Marek Safar ce3cd1f03e [WindowsBase] Make tests less verbose 2018-04-12 11:39:27 +02:00
Marek Safar a801621255 [System] Fixes desktop FSW wildcard pattern to match others implementations 2018-04-12 11:39:27 +02:00
Marek Safar bd1a63e4f4 Moves vector to mscorlib 2018-04-12 11:39:27 +02:00
Marek Safar b3881a418f CoreFX update 2018-04-12 11:39:27 +02:00
Marek Safar 0248399b2a Submodule bump 2018-04-12 11:39:27 +02:00
Aleksey Kliger 5a61970597 [eglib] GMarkup: allow all ASCII NameStartChar and NameChar except ':'
Follow https://www.w3.org/TR/xml/#sec-common-syn except don't allow ':' and
non-ASCII.

Element and attribute names must start with a letter or '_'.
Element and attribute names may contain letters, numbers, '.', '-', '_'.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=19436
2018-04-12 09:00:48 +02:00
Ludovic Henry 1fff043868 [sdks] Add ANDROID_BUILD_TOOLS_DIR to differentiate it from ANDROID_BUILD_TOOLS_VERSION (#8191) 2018-04-11 19:04:29 -04:00
Ludovic Henry 42a62db169 [sdks] Fix typo (#8186) 2018-04-11 18:10:40 -04:00
Ludovic Henry 4f2522e6f4 [ci] Add {,hybrid,full}aot_llvm presets to make sure we compile with LLVM (#8053)
* [ci] Add {,hybrid,full}aot_llvm presets to make sure we compile with LLVM

* [configure] Rename runtime_preset to runtime-preset

* [bcl] Make sure we build the testing_aot_{hybrid,full} profiles when building all profiles

* [test-runner] Factor test-runner parameters for picking up and passing arguments to the runtime

* [hybridaot] Fix testing_aot_hybrid build

* [mini-llvm-aot] Fix common race condition in parallel builds due to common defaults.
2018-04-11 17:27:15 -04:00
Zoltan Varga aa729d19cb [jit] Add some implicit r4<->r8 conversions in float32 mode to the JIT front end, the CLR allows them. (#8156)
* [jit] Add some implicit r4<->r8 conversions in float32 mode to the JIT front end, the CLR allows them.

* [jit] Use m_class_get_byval_arg ().
2018-04-11 16:03:38 -04:00
Joshua Peterson 5f66c75557 Report the proper socket error (#8041)
When a connection fails, the socket error was being incorrectly reported
as an address family not supported error, instead of connection refused.

Why did this happen? The order of addresses returned from
`Dns.GetHostAddresses` changed. The newer code returns the IPv6 address
first, and the IPv4 address second. While `GetCheckedIPs` mentioned in a
comment that it skips addresses that don't match the address family, it
did not. The code using the addresses returned by `GetCheckedIPs` will
use the first address in the array. If this address happens to match the
address family of the socket, things will work "properly" (the correct
socket error will occur).

If, however the first entry has the wrong address family, then the
socket error will be an address family not supported error, since the
socket was created with different address family.

This change modifies `GetCheckedIPs` to filter the addresses, removing
those which do not match the address family.
2018-04-11 15:56:34 -04:00
monojenkins 529e486e78 Merge pull request #8068 from lambdageek/coop-hybrid-suspend
[coop] Hybrid suspend

## Summary

This is a new suspend mode where threads that are running managed or native runtime code (what we call "GC Unsafe") are suspended cooperatively using safepoints, but threads running either embedder code or P/Invoke code or blocking syscalls (what we call "GC Safe") are suspended preemptively using signals.

The motivation is to make an embedder-friendly coop suspend mechanism where the runtime will do GC Safe -> GC Unsafe transitions on calls to `MONO_API` functions, but the embedders themselves don't have to have any special knowledge of coop safepoints or state transitions.

To try this out, set **both** `MONO_ENABLE_COOP` and `MONO_ENABLE_HYBRID_COOP` environment variables.

## Implementation

Here's a picture of the new state machine.  There's two new states `Blocking_Suspend_Requested` and `Blocking_Async_Suspended` and one updated transition `req_s` (request suspension).

![coop-state-machine](https://user-images.githubusercontent.com/480437/38572948-9fe879e2-3cc2-11e8-8f27-9493f05f03bf.png)

### State machine states and transitions

The hybrid cooperative suspend mechanism works like this:
 - when a thread is executing in GC Unsafe mode, we use cooperative suspend and expect
   the thread to periodically checkpoint its execution (as in the ordinary full
   coop mode).
 - when a thread is executing in GC Safe mode, we use a preemptive signal-based
   suspend.  This is new - previously in full coop we would allow `BLOCKING`
   threads to continue executing and only suspend them when they wanted to go
   from GC Safe to GC Unsafe (via the `BLOCKING_SELF_SUSPENDED` state).

There are two new states and one updated transition - the transition will
service both running and blocking threads: The idea is that suspend mechanism
is determined by the suspend initiator, and is not embodied in the the state
machine.  The state machine just has to return distinctive enough values from
the transitions for the initiator to select a policy.

Resume mechanism is determined by the state that a thread finds itself in when
it is resumed, and the original suspend policy.

The primary differences between suspend mechanisms are: the preemptive
suspend is two phase - the `finish_async_suspension` does not
apply for cooperative suspend; the cooperative policy uses the `poll` transition when the thread is running.

We renamed `mono_threads_transition_request_async_suspension` to `mono_threads_transition_request_suspension`.

 - It must be called by a suspend initiator on a victim thread that is not
   itself.

 - There can only be one suspend initiator for a victim at a time - if the
   suspend initiator initiates a suspension it must follow through with the
   whole protocol.

 - If a victim is `RUNNING` we transition it to `ASYNC_SUSPEND_REQUSTED` and return
   `ReqSuspendInitSuspendRunning` which signals that the caller must initiate
   suspension for a running thread.  (Same as the old `AsyncSuspendInitSuspend`).

 - If a victim is `BLOCKING` we transition it to `BLOCKING_SUSPEND_REQUESTED`.
   Note that this is different from the old `request_async_suspension` which just
   incremented the suspend count and returned `AsyncSuspendBlocking`.  Now we
   return `ReqSuspendInitSuspendBlocking`.  The return of
   `ReqSuspendInitSuspendBlocking` means the initiator may signal the victim and
   must wait to be notified of the suspension (in preemptive suspend it will be
   notified by the signal handler, in cooperative when the blocking thread
   attempts to exit from blocking mode).

 - In `BLOCKING_SUSPEND_REQUESTED` we
   may increment the suspend count.  This is slightly too lax if we're going to
   be using preemptive suspend on blocking threads: in that case we're in the
   middle of a two-phase suspend and since there is only one suspend initiator,
   we wouldn't expect another suspend to be initiated until we have a chance to
   finish suspending.  We leave it to the suspend initiator to rule out by returning
  `ReqSuspendAlreadySuspendedBlocking` from this state.

 - In all the not executing states (`SELF_SUSPENDED`, `ASYNC_SUSPENDED`,
  `BLOCKING_SELF_SUSPENDED`, `BLOCKING_ASYNC_SUSPENDED`) we just
   increment the suspend count.

 - All other transitions are illegal.

- Note that `BLOCKING` must always have a suspend count of 0 and
   `BLOCKING_SUSPEND_REQUESTED` must have suspend_count > 0.

We add two new states:

 - `STATE_BLOCKING_SUSPEND_REQUESTED` - this is a new state that indicates that a
   suspend initiator wants to suspend this victim thread.
   - The thread is still executing in this state.
   - We only transition into this state with
     `mono_threads_transition_request_suspension`.
   - The only legal transitions out from this state are:
     - `resume` - decrements the `suspend_count`. If the `suspend_count` becomes 0 we
       go back to `BLOCKING`, otherwise we stay in `BLOCKING_SUSPEND_REQUESTED`.
     - `finish_async_suspension` (executed by the suspend signal handler to
       finish the two phase preemptive suspend request and notify the suspend initiator),
     - `done_blocking` and `abort_blocking`.  It means that the a
       suspend initiator requested a suspend but we got to done (or abort)
       blocking before the signal was delivered. We return `NotifyAndWait` and the
       caller is supposed to send a notification to the suspend initiator and
       wait for a resume(with suspend count == 0) which will return to
       `RUNNING` (the victim thread goes to `STATE_BLOCKING_SELF_SUSPENDED`).
 - `STATE_BLOCKING_ASYNC_SUSPENDED`
   - The thread is not executing in this state (it is waiting for a `resume`).
   - a thread transitions into this state from `STATE_BLOCKING_SUSPEND_REQUESTED`
     on a `finish_async_suspension` transition (see above).
   - on a `resume` transition we decrement the suspend count. if it's still
     positive we stay in this state. if it's 0 the thread transitions out of
     this state.  Unlike other resume transitions, in this case the thread goes
     back to `BLOCKING` and resumes executing in GC Safe mode.  The resume caller
     must notify the resume initiator (ie this is a `ResumeInitAsyncResume`).
   - on a `request_suspension` we stay in this state and just increment the
     suspend count.
   - all other transitions from this state are illegal.

We add two new return values for `abort_blocking` and `done_blocking`:
  - `DoneBlockingNotifyAndWait` and `AbortBlockingNotifyAndWait`. Similar to
    `SelfSuspendNotifyAndWait` - there was a race between the second phase of a
    preemptive suspend and another operation (in that case a poll, in this case a
    done or abort blocking) and the other operation won, so its caller should
    notify the suspend initiator. Since the thread is now suspended, the caller
    should wait for the resume signal.

We add new results for `request_initiate_suspension` `MonoRequestSuspendResult`
(formerly `MonoRequestAsyncSuspendResult`):
  - `ReqSuspendAlreadySuspended` means the thread is not executing and we just
    incremented its suspend count and there's nothing else for the suspend
    initiator to do. (The old `AsyncSuspendAlreadySuspended`)
  - `ReqSuspendAlreadySuspendedBlocking` means the thread is in
    `BLOCKING_SUSPEND_REQUESTED` and we initiated another suspend request.  This
    should only happen with full cooperative suspend - with hybrid suspend we
    will use a two phase preemptive suspend on a blocking thread and since only
    a single suspend initiator is active, this state should not be visible to
    another suspend initiator.
  - `ReqSuspendInitSuspendRunning` - Thread is executing in GC Unsafe mode and the
    caller should suspend it.  This is the old `AsyncSuspendInitSuspend`.  In
    full preemptive suspend this is the only suspend initiation action and the caller
    should begin the preemptive suspend procedure.  In full coop we expect the
    victim thread to reach a safepoint and poll to finish suspending.
  - `ReqSuspendInitSuspendBlocking` - Thread is executing in GC Safe mode and
    the caller should initiate a suspend.  In full coop the caller has nothing
    to do - a thread executing in blocking mode is assumed to be suspended.  In
    hybrid suspend, the caller has to initiate a preemptive suspend.

### Suspend initiator, signal handler, self suspender

Basically we call `mono_threads_transition_request_suspension` instead of `mono_threads_transition_request_async_suspension`.
Then if it says to suspend a running thread we call `begin_suspend_for_running_thread`, if it says initiate a suspension of a blocking thread, we call `begin_suspend_for_blocking_thread`, and if it says do nothing we do nothing.

**Questions**
1. We have an assumption in `safe_interrupt_thread` that we can return from a self interrupt if we're using coop suspend.  I'm not sure if that makes sense for hybrid suspend, and not clear what to do about it.
2. In `mono_thread_info_safe_suspend_and_run` we expect that the callback won't return `KeepSuspended` if coop is enabled.  I'm not sure what this means for hybrid.
3. A bunch of tests like `monitor-abort` and `appdomain-threadpool-unload` are failing if I enable hybrid suspend.  Don't know why yet.
2018-04-11 20:10:43 +02:00
Zoltan Varga 254a57f875 [runtime] Fix the build. (#8174) 2018-04-11 12:23:48 -04:00
Marek Safar 3b2dbf337e [corlib] Make more crypto oids work on mobile profiles when not linked out 2018-04-11 17:13:23 +02:00
Miguel de Icaza 920267df91 Allow the LLVM optimizer options to be passed on the command line. (#8025)
* Allow the LLVM opt flags to be provided in the command line

* Avoid leaking small string
2018-04-11 09:42:29 -04:00
Egor Bogatov ff0430bf3b [threadpool] ThreadPool.SetMinThreads fails if ThreadPool.GetMaxThreads was not called before (#8160)
* fix ThreadPool.SetMinThreads fails if ThreadPool.GetMaxThreads was not called before #7988

* check mono_lazy_initialize in ves_icall_System_Threading_ThreadPool_SetMaxThreadsNative first
2018-04-11 09:38:50 -04:00
Vlad Brezae af43001e89 [profiler] Fix heapshot frequency calculation (#8163)
Fixes https://github.com/mono/mono/issues/6173
2018-04-11 09:37:58 -04:00
Bernhard Urban 5128cce2dc [console-unix] retry tcsetattr if it was interrupted by signal (#8138)
[console-unix] retry `tcsetattr` if it was interrupted by signal

if configuring the terminal failed, we still try to continue (see
a3ce2f008b ) and therefore succedings
`read`s can fail.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=26983
2018-04-11 13:55:24 +02:00
Tom Dowdell 18d38900ff Updated Readme.md 2018-04-11 11:20:26 +02:00
Tom Dowdell abc4573beb Updated Readme.md for clarity, and added Windows instructions. 2018-04-11 11:20:26 +02:00
Marek Safar 0d2609c11c [mcs] Fixes parameter check for interface types used with default parameters 2018-04-11 11:03:49 +02:00
Zoltan Varga e3d8bdbf47 [llvm] Increase the inline limit when using llvm in jit mode. (#8141) 2018-04-10 22:06:49 -04:00
Alexis Christoforides 528b0d4b03 Merge pull request #8145 from lewurm/interp-stelem-r4
[interp] support r4 (single) in stelem instruction
2018-04-10 20:01:33 -04:00
Aleksey Kliger aaece70f79 [coop] Enter GC Safe around mono_os_event_ calls in threads.c 2018-04-10 19:18:00 -04:00
Aleksey Kliger d1895b67d4 [threads] Make mono_thread_info_get_suspend_state suspend policy aware
Move it from mono-threads-state-machine.c to mono-threads.c and make it
check how blocking threads are suspended before returning the saved state.
2018-04-10 17:38:11 -04:00
Alexander Köplinger 48eded43b9 [ci] Fix wrong label when csprojdiff is skipped 2018-04-10 23:23:52 +02:00
Aleksey Kliger 7e728dcdbd [threads] Return suspend sort from begin_suspend_for_running_thread
Change begin_cooperative_suspend and begin_preemptive_suspend to return one of
three results: suspend fail, suspend succeeded using cooperative suspend,
suspend succeeded using preemptive suspend.

This is used by check_async_suspend to decide whether to check the
MonoThreadInfo for the result of a suspend.  (If a thread is suspended
cooperatively, it doesn't make sense to check).

Fixes sporadic failures in mono/tests/monitor-abort.exe
2018-04-10 17:14:52 -04:00
Alexander Köplinger a8c96f026e [csproj] Another project file update 2018-04-10 20:36:49 +02:00
Aleksey Kliger f214256be3 [configure] Add --with-hybrid-suspend option
Defaults to 'no'.

To use `--with-hybrid-suspend=yes`, require `--with-cooperative-gc=yes`.
2018-04-10 13:23:40 -04:00
Aleksey Kliger b9be955509 [threads] Implement hybrid cooperative suspend
If a thread in blocking mode needs to be suspended, suspend it using preemptive suspend.
2018-04-10 13:23:35 -04:00
Aleksey Kliger 37613bce94 [coop] Add MONO_ENABLE_HYBRID_SUSPEND environment variable
When the environment variable is set, Mono will use cooperative safepoint
suspend for threads running in GC Unsafe mode (running managed code or native
runtime code), and preemptive suspend for threads running in GC Safe
mode (running native embedder or P/Invoke code, or blocking system calls)

The environment variable is visible through
mono_threads_is_hybrid_suspension_enabled ().

This commit just adds the env var, it doesn't turn on hybrid coop suspend.
2018-04-10 13:23:34 -04:00
Aleksey Kliger f2f6a7df51 [coop] Add new states and transitions for hybrid coop suspend
The hybrid cooperative suspend mechanism works like this:
 - when a thread is executing in GC Unsafe mode, we use cooperative suspend and expect
   the thread to periodically checkpoint its execution (as in the ordinary full
   coop mode).
 - when a thread is executing in GC Safe mode, we use a preemptive signal-based
   suspend.  This is new - previously in full coop we would allow BLOCKING
   threads to continue executing and only suspend them when they wanted to go
   from GC Safe to GC Unsafe (via the BLOCKING_SELF_SUSPENDED state).

There are two new states and one updated transition - the transition will
service both running and blocking threads: The idea is that suspend mechanism
is determined by the suspend initiator, and is not embodied in the the state
machine.  The state machine just has to return distinctive enough values from
the transitions for the initiator to select a policy.

Resume mechanism is determined by the state that a thread finds itself in when
it is resumed, and the original suspend policy.

The primary differences between suspend mechanisms are: the preemptive
suspend is two phase - the finish_async_suspension transition only does not
apply for cooperative suspend; the cooperative policy uses the poll transition
when the thread is running.

We renamed mono_threads_transition_request_async_suspension to mono_threads_transition_request_suspension.

 - It must be called by a suspend initiator on a victim thread that is not
   itself.

 - There can only be one suspend initiator for a victim at a time - if the
   suspend initiator initiates a suspension it must follow through with the
   whole protocol.

 - If a victim is RUNNING we transition it to ASYNC_SUSPEND_REQUSTED and return
   ReqSuspendInitSuspendRunning which signals that the caller must initiate
   suspension for a running thread.  (Same as the old AsyncSuspendInitSuspend).

 - If a victim is BLOCKING we transition it to BLOCKING_SUSPEND_REQUESTED.
   Note that this is different from the old request_async_suspension which just
   incremented the suspend count and returned AsyncSuspendBlocking.  Now we
   return ReqSuspendInitSuspendBlocking.  The return of
   ReqSuspendInitSuspendBlocking means the initiator may signal the victim and
   must wait to be notified of the suspension (in preemptive suspend it will be
   notified by the signal handler, in cooperative when the blocking thread
   attempts to exit from blocking mode).

 - In BLOCKING_SUSPEND_REQUESTED we may increment the suspend count.  This is
   slightly too lax if we're going to be using preemptive suspend on blocking
   threads: in that case we're in the middle of a two-phase suspend and since
   there is only one suspend initiator, we wouldn't expect another suspend to
   be initiated until we have a chance to finish suspending.  We leave it to
   the suspend initiator to rule out by returning
   ReqSuspendAlreadySuspendedBlocking from this state.

 - In all the not executing states (SELF_SUSPENDED, ASYNC_SUSPENDED,
   BLOCKING_SELF_SUSPENDED, BLOCKING_ASYNC_SUSPENDED) we just increment the
   suspend count.

 - All other transitions are illegal.

 - Note that BLOCKING must always have a suspend count of 0 and
   BLOCKING_SUSPEND_REQUESTED must have suspend_count > 0.

We add two new states:
 - STATE_BLOCKING_SUSPEND_REQUESTED - this is a new state that indicates that a
   suspend initiator wants to suspend this victim thread.
   - The thread is still executing in this state.
   - We only transition into this state with
     mono_threads_transition_request_suspension.
   - The only legal transitions out from this state are:
     - resume - decrements the suspend_count. If the suspend_count becomes 0 we
       go back to BLOCKING, otherwise we stay in BLOCKING_SUSPEND_REQUESTED.
     - finish_async_suspension (executed by the suspend signal handler to
       finish the two phase preemptive suspend request and notify the suspend initiator),
     - done_blocking and abort_blocking.  It means that the a
       suspend initiator requested a suspend but we got to done (or abort)
       blocking before the signal was delivered. We return NotifyAndWait and the
       caller is supposed to send a notification to the suspend initiator and
       wait for a resume(with suspend count == 0) which will return to
       RUNNING (the victim thread goes to STATE_BLOCKING_SELF_SUSPENDED).
 - STATE_BLOCKING_ASYNC_SUSPENDED
   - The thread is not executing in this state (it is waiting for a resume).
   - a thread transitions into this state from STATE_BLOCKING_SUSPEND_REQUESTED
     on a finish_async_suspension transition (see above).
   - on a resume transition we decrement the suspend count. if it's still
     positive we stay in this state. if it's 0 the thread transitions out of
     this state.  Unlike other resume transitions, in this case the thread goes
     back to BLOCKING and resumes executing in GC Safe mode.  The resume caller
     must notify the resume initiator (ie this is a ResumeInitAsyncResume).
   - on a request_suspension we stay in this state and just increment the
     suspend count.
   - all other transitions from this state are illegal.

We add two new return values for abort_blocking and done_blocking:
  - DoneBlockingNotifyAndWait and AbortBlockingNotifyAndWait. Similar to
    SelfSuspendNotifyAndWait - there was a race between the second phase of a
    preemptive suspend and another operation (in that case a poll, in this case a
    done or abort blocking) and the other operation won, so its caller should
    notify the suspend initiator. Since the thread is now suspended, the caller
    should wait for the resume signal.

We add new results for request_suspension MonoRequestSuspendResult
(formerly MonoRequestAsyncSuspendResult):
  - ReqSuspendAlreadySuspended means the thread is not executing and we just
    incremented its suspend count and there's nothing else for the suspend
    initiator to do. (The old AsyncSuspendAlreadySuspended)
  - ReqSuspendAlreadySuspendedBlocking means the thread is in
    BLOCKING_SUSPEND_REQUESTED and we initiated another suspend request.  This
    should only happen with full cooperative suspend - with hybrid suspend we
    will use a two phase preemptive suspend on a blocking thread and since only
    a single suspend initiator is active, this state should not be visible to
    another suspend initiator.
  - ReqSuspendInitSuspendRunning - Thread is executing in GC Unsafe mode and the
    caller should suspend it.  This is the old AsyncSuspendInitSuspend.  In
    full preemptive suspend this is the only suspend initiation action and the caller
    should begin the preemptive suspend procedure.  In full coop we expect the
    victim thread to reach a safepoint and poll to finish suspending.
  - ReqSuspendInitSuspendBlocking - Thread is executing in GC Safe mode and
    the caller should initiate a suspend.  In full coop the caller has nothing
    to do - a thread executing in blocking mode is assumed to be suspended.  In
    hybrid suspend, the caller has to initiate a preemptive suspend.
2018-04-10 13:23:01 -04:00
Mike Voorhees a56f9de9e2 Clean up mscorlib link xml (#8055)
Removes some duplication of preservations

Consolidations some preservations under a single <type> element
2018-04-10 18:56:00 +02:00
Alexander Köplinger 1546a1a7c2 [csproj] Update project files 2018-04-10 18:38:11 +02:00
Alexander Kyte 2a19106b94 [runtime] Enable mono_runtime_set_execution_mode to handle MONO_AOT_MODE_NORMAL (#8091) 2018-04-10 11:39:08 -04:00
Alexander Kyte 7b545988f2 [sdks] Add managed debugger tests to sdks (#6309)
* [sdks] New SDK target: soft debugger + non-nunit exe

This adds support for building an arbitrary .exe (dtest-app is hardcoded
now, but changing that and setting the arguments is another line or two,
to bu customized to the app being bound)

When an environment variable is set, the runtime will wait for the
managed debugger. This enables the desktop to debug the deployed .exe.

This will be used for the Mono.Debugger.Soft tests, but is useful for
isolated reproductions with android bugs.

An unmanaged debugger versions of the managed debugger is coming in
another PR.

* [runtime] Provide argument to dtest-app when running remotely

* [runtime] Fix case of VMDisconnectionException when getting Process of remote host that has disconnected

* [runtime] Script monodroid desktop debugger agent

* [runtime] Use g_warning in debugger agent

* [sdks] Ship PDBs on android

* [sdks] Add Android target to run debugger tests

* [sdks] Add desktop profile target for debugger tests

* [sdks] Disable debugger tests on mobile that use unsupported apis

* [sdks] Add monodroid test profile to android sdks

* [runtime] Allow dtest-app to be built on non-debugger-client profiles

* [runtime] Allow dtest-app building on mobile profiles
2018-04-10 11:36:08 -04:00
Zoltan Varga eda870e6d6 [llvm] Fix the name of the llvm.fabs intrinsic. (#8140) 2018-04-10 09:40:57 -04:00
Zoltan Varga 8b5d582855 [bcl] Mark some some code with DISABLE_COM which depends on icalls which are disabled in the runtime when --enable-minimal=com is used. (#8111)
* [bcl] Mark some some code with DISABLE_COM which depends on icalls which are disabled in the runtime when --enable-minimal=com is used.

* [bcl] Fix compilation of System.Runtime.InteropServices.WindowsRuntime.dll.

* .
2018-04-10 09:39:31 -04:00
Alexander Köplinger d30da4d588 Bump cecil and linker (#8137)
* Bump cecil and linker

* Bump API snapshot submodule
2018-04-10 15:20:12 +02:00
Alexander Köplinger a748bad303 [System] Don't use http://www.mono-project.com for test (#8147)
When we tried switching mono-project.com to enforce HTTPS these tests
started failing on systems without working SSL configuration.

Use a different domain which is guaranteed to be available over HTTP instead.
2018-04-10 14:48:52 +02:00
Marek Safar 5f8024c4b2 [corlib] Implements CryptoConfig::AddAlgorithm on all profiles 2018-04-10 11:16:40 +02:00
Bernhard Urban f8026125cd [interp] support r4 (single) in stelem instruction
Fixes https://github.com/mono/mono/issues/8143
2018-04-10 11:14:00 +02:00
Marek Safar 316bda7eb9 [build] Exclude platform specific xunit tests (#8120) 2018-04-10 09:44:54 +02:00
Alex Rønne Petersen e90dee3d0c [Mono.Profiler.Log] Add a new profiler test suite. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 756c85103c [mini] Add missing jit_code_buffer profiler events to all backends. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen eee1f0b0d4 [profiler] Mark some code buffer types that are no longer produced as deprecated.
Also remove them from the log format.
2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 197745501c [ci] Run the regular profiler tests on the stress test jobs as well. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 9a34740d94 [profiler] Flush log buffers of internal threads after attaching.
Otherwise some events would arrive too late, e.g. heap root register events
would arrive after heapshots that reference them.
2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 9acadffc2c [profiler] Fix the gc_finalized_object callback not being set. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 307e697b82 [profiler] Add separate counters for root (un)register events. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen dea7f4fe4a [mprof-report] Report stats about finalization events. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 9ce9cafc29 Clean up some .gitignore files and add *.mlpd to the root file. 2018-04-10 02:34:56 +02:00
Aleksey Kliger 2891521ef7 [tests] Disable newobj-abstract.il in FullAOT
The MemberAccessException happens at AOT-time preventing the test from running.
2018-04-09 20:25:34 -04:00
Bernhard Urban f4cc8cccaa [interp] throw MemberAccessException when abstract class is used with newobj instruction 2018-04-09 20:25:34 -04:00
Jonathan Chambers c0b9c4151c Throw MemberAccessException when abstract class is used with newobj instruction 2018-04-09 20:25:34 -04:00
jaykrell 9d4f120dd3 [Tailcall] Grow static tailcall_membase len. (#8134)
Note that eventually, the length will depend on stack_usage
difference between caller and callee, though for arm64 it does not currently.
This should fix https://github.com/mono/mono/issues/8112.
2018-04-09 17:09:55 -07:00
Alexander Köplinger 63e72f29b2 [Facades] Add System.Drawing.Common on mobile only (#8126)
* [Facades] Add System.Drawing.Common on mobile only

Fixes https://github.com/mono/mono/issues/8089

* Bump API snapshot submodule
2018-04-10 02:08:50 +02:00
Marek Safar d460942cff [mono] Update documentation pages links (#8118)
Fixes #7785
2018-04-09 20:03:46 -04:00
Miguel de Icaza f003518cca [mkbundle] Probe for a .exe on the target runtime directory - fixes GitHub #7731 (#8105) 2018-04-09 20:02:28 -04:00
Zoltan Varga 6144c2bf1f [jit] Various float32 fixes. (#8133)
* [jit] Add a MONO_ARCH_FLOAT32_SUPPORTED arch-specific define, use it to disable float32 on platforms which don't support it.

* [amd64] Fix r4fp support for the ATOMIC_LOAD/STORE_R4 opcodes.

* [jit] Disable a unused test method with invalid IL.

* [jit] Handle r4->u conversion correctly in float32 mode.

* [amd64] Fix some OP_R<cmp> opcodes.
2018-04-09 19:11:01 -04:00
Zoltan Varga 41e928c9ae [runtime] Extract the debugger code into a separate library. (#7673)
If the runtime is configured using --enable-minimal=soft_debug, the debugger code will be compiled into a separate
libmono-dbg.a library which needs to be linked into the app. The debugger needs to be registered with the runtime by
calling mono_debugger_agent_init () before runtime initialization.
2018-04-09 18:48:51 -04:00
Zoltan Varga 8012cf9283 [llvm] Add intrinsics support for some of the new MathF icalls when using llvm+float32. (#8096)
* [llvm] Add intrinsics support for some of the new MathF icalls when using llvm+float32.

* [jit] Use m_class_get_name ().

* [llvm] Fix the signature of the llvm instrinsic used by OP_ABSF.

* [llvm] Use llvm.fabs only on amd64, it doesn't seem to be supported on some platforms.
2018-04-09 18:46:32 -04:00
Alexander Köplinger b5bcec428e [ci] Update csproj files during PRs (#8052)
* [ci] Update csproj files during PRs

Similar to how API diff is done.

Replace EXTERNAL_DRAWING_FACADE in csproj in genproj
It'd embed the absolute path in the csproj, but we want the variable instead.

* [csproj] Update project files
2018-04-10 00:32:08 +02:00
Alexander Kyte 8eb6dae513 [runtime] Add CustomModifiers support to sre 2018-04-09 16:46:55 -04:00
Alexander Kyte 1ce6156dc9 [runtime] Add sre-based modreq tests 2018-04-09 16:46:55 -04:00
Alexander Kyte 9dc6c344ac [runtime] Compare custom modifiers in type equality
Custom modifiers are an odd feature of .net which allow types to
be tagged. These tags are semantically relevant. A method with a
modifier should not override a method without a modifier, for
instance (github bug #6936).

We don't put enough information into the modifier to uniquely find the
Image associated with the token we have in the type. Modifiers from
different referring assemblies will have different tokens to refer to
the same modifier class, making it important to resolve the tokens to
MonoClass pointers at runtime. Pointer equality of these classes is the
way to determine two custom modifiers the same, or unique.

We cannot resolve the image just from the MonoType because it is
possible to put modifiers on primitive, builtin types. These builtin
types lack any filled-out pointers in the data block, meaning we have
zero metadata associated with our floating token.

Other places in the codebase fixed this by passing around MonoImages,
but adding a MonoImage argument to our type comparison function for
this single bug would be a very poor decision with much code churn all
throughout the runtime.

The bug above resolves to two I4 types, one of which has a modifier, one
of which does not.

In order to pass this MonoImage around, we need to put a reference to it
into something reachable from the MonoType. We can't put it in the
custom module type because that is exported. It is part of the public
API.

MonoTypes do not adhere to pointer equality, and custom modules are structs
baked directly into the MonoType. We need therefore to make MonoType
point to a MonoCustomModInternal, a new type. This type embeds the
public type as a struct and carries around the image as another element
in the struct.

All public interfaces still see the same metadata endpoints for parsing the
modules, including the icalls. It is only our type comparison code that
accesses our new field.
2018-04-09 16:46:55 -04:00
Bernhard Urban c78ae5d6fd [interp] fix regression for virtual delegates
Regression introduced in 77b4cd11d1. We
need to distinguish this case.

Fixes #7944
2018-04-09 22:09:33 +02:00
Marek Safar 07ae1445b8 [mcs] Adds private protected modifier to the parser only 2018-04-09 19:37:23 +02:00
jaykrell 2f3de80410 Fix generic-stack-traces2.2.cs under FullAOT+LLVM. (#8102)
It relies on poorly defined behavior that mono cannot likely well define.

https://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace(v=vs.110).aspx

"StackTrace might not report as many method calls as expected, due to code transformations
that occur during optimization."
2018-04-09 09:18:18 -04:00
Ludovic Henry 6ce881f081 [sdks] Fix arguments passed to llvm on Linux (#8107) 2018-04-09 08:46:27 -04:00
Jay Krell 48424f0d92 Symlink the 4.5 machine.config unconditionally.
This fixes https://github.com/mono/mono/issues/8074.

I see this 100%. Why others do not? I usually skip aot so usually I don't see it. Linux Ubuntu 1604 and
1710 tested. mono-devel package is installed, which is probably not relevant.

git clean -xddf (or new git clone)
./configure --with-runtime_preset=fullaot   likely also with others (hybridaot)
make

Many errors like:

MONO_PATH="./../../class/lib/build:$MONO_PATH" /s/mono/runtime/mono-wrapper ./../../class/lib/build/sn.exe
-q -R ../../class/lib/testing_aot_full/mscorlib.dll ./../../class/mono.snk Couldn't sign the assembly
../../class/lib/testing_aot_full/mscorlib.dll with this key pair. Public key of assembly did not match
signing public key. ../../build/library.make:342: recipe for target
'../../class/lib/testing_aot_full/mscorlib.dll' failed

If you run make V=1 you see the sn command.
 You can see the installed sn works ok. Remove the -Q for quiet and you see a warning about missing
machine.config. Run with ptrace and you see it looking for 4.5/machine.config. Look in the tree and you
see 1.1 and 2.0. Copy the 2.0 to 4.5 and problem goes away. And can be edited down a bunch. Actual fix is
to move symlink of the file to outside a conditional.

Maybe people aren't using fullaot or git clean? Repro is 100% for me.
I was going to bisect, but it was occuring as far back as September 2017 so I did not.
.
2018-04-09 10:36:37 +02:00
jaykrell 71cb807e0d Fix mono/tests/test-inline-call-stack.cs under FullAOT+LLVM (#8097)
by not inlining callers to GetCallingAssembly.

Attempts to do this only for cross-assembly failed.
Other codegen models might need more work here.
2018-04-08 00:56:51 -07:00
Zoltan Varga 28e216fe43 [sdks] Add support for building llvm unless the USE_PREBUILT_LLVM Make.config var is set. (#8017)
* [sdks] Add support for building llvm unless the USE_PREBUILT_LLVM Make.config var is set.

* [sdks] Use prebuilt llvm binaries on ios CI.

* [sdks] Use the IGNORE_PACKAGE_LLVM variable to enable the building of llvm.
2018-04-08 01:35:59 -04:00
Alex Rønne Petersen d16ca8d037 [profiler] Fix exception clause reporting. (#7940)
* [runtime] Handle interpreter-related frames in async stack walks.

* [profiler] Fix exception clause reporting.

This fixes three separate issues:

* Finally clauses in the non-exceptional case were not reported because we
  implement these by simply calling them from managed code, as opposed to the
  exceptional case where we call them from runtime C code.
* The catch portion of a try-filter-catch clause was being incorrectly reported
  as a filter.
* Actual exception filters were not being reported at all.

Because we have to instrument JIT'd code to report non-exceptional finally
clauses, a new mono_profiler_enable_clauses () function has been introduced
which profiler API users must call in order to get exception clause events, in
a similar fashion to mono_profiler_enable_allocations (). Since this is a
breaking change, the profiler API version has been bumped.

Fixes #7525.

* [profiler] Remove the iomap_report event and associated code.

The IOMap profiler no longer exists, so we no longer need to expose this
somewhat hacky event.

* [profiler] Replace the old gc_event with gc_event2.
2018-04-08 00:05:42 -04:00
jaykrell f8c8724f74 Fix new warnings. (#8066) 2018-04-07 23:59:41 -04:00
Aleksey Kliger (λgeek) 2495e5800d [coop] Thread state machine state cleanups (#8069)
* [coop] Squash the thread state machine state numbering

In
https://github.com/mono/mono/commit/9767b8a55ec8be3fc46055d7a1e21b6894fd0fc5
we removed STATE_SELF_SUSPEND_REQUESTED
but left a hole in the state numbering, as a result, `state_name()` was off by
one (and falling off the end of the array).

* [coop] Renamed STATE_BLOCKING_AND_SUSPENDED -> STATE_BLOCKING_SELF_SUSPENDED
2018-04-07 22:20:08 -04:00
Zoltan Varga ed8a1a4acc [arm64] Fix llvm jit support. (#8092) 2018-04-07 22:16:51 -04:00
Zoltan Varga 0b182760f3 [jit] Make mini-ops.h a dependency of the cpu-<ARCH>.h files. (#8094) 2018-04-07 22:15:44 -04:00
Zoltan Varga 717e4c1280 [jit] Don't emulate conv.r8.un when running with llvm. (#8095) 2018-04-07 22:15:18 -04:00
Ludovic Henry 078d514783 [w32file] Fix memory leak (#8090)
Fixes https://github.com/mono/mono/issues/7655
2018-04-07 16:23:41 -04:00
jaykrell 6898cd20a6 [mini-llvm] Remove unused struct field. (#8093) 2018-04-07 13:13:37 -07:00
monojenkins 889b54d240 [msvc] Update csproj files 2018-04-07 19:06:33 +02:00
Marek Safar 124b6765d6 [mcs] Implements C# 7 digits separators 2018-04-07 13:34:37 +02:00
Neale Ferguson 986f1fe7bd [s390x] Float32 (#8084)
* Enable float32 support and correct FP register saving

* Fix float register saving; Complete float32 support; Add tailcall_membase
2018-04-07 00:13:48 -04:00
Alexander Köplinger d59246bb7e [metadata] Fix wrong icall signature for ModF (#8080)
Noticed this while looking at Jenkins logs today:

```
15:00:56 /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/lib/net_4_x/mscorlib.dll
15:00:56 cant resolve internal call to "System.MathF::ModF(single,single*)" (tested without signature also)
```

We need to use `single` in the icall def instead of `float`.

It was introduced by https://github.com/mono/mono/pull/7941
2018-04-07 01:59:20 +02:00
Bernhard Urban ba9208be0a [interp] use same domain as transform phase to register debug data for a method 2018-04-06 19:58:40 -04:00
Marek Safar 544297ed7e [System] Disables compiled regex
Fixes #7828
2018-04-06 21:02:13 +02:00
Martin Baulig 762af4e5b0 [System]: Fix memory leak in the web stack related to Task.Delay (partial fix of #7356).
Using `Task.Delay (timeout)` has the potential of possibly allocating and holding large
chunks of memory throughout the timeout period.  While this is not strictly speaking a
memory leak because those objects will eventually be disposed and garbage collected, it
can cause memory usage of apps to grow quite significantly in the short run.

The default timeout values are as follows:

* `HttpWebRequest.ReadWriteTimeout`: 5 minutes.

* `HttpWebRequest.Timeout`: 100 seconds.

* `ServicePointManager.MaxServicePointIdleTime`: 100 seconds.

And these values can be increased by the user.  This means that we're potentially holding
hundreds, maybe even thousands of timeout objects in memory for 5+ minutes.

This has now been fixed by using the `Task.Delay(int,CancellationToken)` constructor.

Note that disposing a `CancellationTokenSource` will not cancel it, so the following code
will still leak:

	using (var cts = new CancellationTokenSource ()) {
		Task.Delay (TimeSpan.FromDays (3), cts.Token);
		// Work
	}

To actually make the `Task.Delay` instance go away when we're done with it, we need to
use this pattern:

	var cts = new CancellationTokenSource ();
	try {
		Task.Delay (TimeSpan.FromDays (3), cts.Token);
		// Work
	} finally {
		cts.Cancel ();
		cts.Dispose ();
	}

We also cannot use `CancellationToken.CancelAfter()` for timeouts because unfortunately
some of the underlying framework code that we're using does not honor cancellation
requests - like for instance `NetworkStream`.

This is a partial fix for #7356.  While this commit significantly improves the problem,
there may be other unrelated issues left that needs to be investigated.
2018-04-06 20:46:24 +02:00
Marek Safar 0bc4732b72 [mcs] Fixes codegen when probing reference type expression is known to pass and pattern variable has to be created 2018-04-06 20:03:11 +02:00
Sebastien Pouliot ca9cbdc889 [mono-api-html] Update tool to optionally output markdown
Output formatting is now delegate to a `Formatter` subclass. The default
one remains HTML with `HtmlFormatter` so any script should not see any
difference.

The output file is largely identical, except a few whitespace changes
that could not easily be avoided and how modified base types were
reported, since that was different from the rest.

The big change is the `--md` option which can output markdown, which
is the format to use from docs.microsoft.com. There are less options
available, e.g. colors, so additions are rendered using the `csharp`
blocks, while modification are rendered as a `diff` block.

Each assembly output is made to be easy to re-assemble into a single
document if needed, e.g. https://github.com/xamarin/xamarin-macios/pull/3814
2018-04-06 20:02:52 +02:00
Aleksey Kliger a49aa771c1 [coop] We never return AsyncSuspendWait 2018-04-06 07:15:16 -04:00
Aleksey Kliger e1638e555a [coop] We never return SelfSuspendWait 2018-04-06 07:15:16 -04:00
Marek Safar d7bb7151a8 [mcs] Implements C# 7.2 stackalloc span conversion in conditional expression 2018-04-06 08:28:31 +02:00
jaykrell 774f43c0f9 [coop] Include function names in coop state change assertions (#7923)
* [coop] Include function names in coop state change assertions

i.e. better reporting here:

https://jenkins.mono-project.com/job/test-mono-pull-request-coop/2298/parsed_console/log.html

***** MonoTests.System.Runtime.Remoting.RemotingServicesTest
***** MonoTests.System.Runtime.Remoting.RemotingServicesTest.Bug46473
Assertion failure in thread 0x7f21a504b740 due to: Cannot transition thread 0x7f21a504b740 from STATE_BLOCKING with DO_BLOCKING
Last 3 state transitions: (most recent first)
[DO_BLOCKING] RUNNING -> STATE_BLOCKING (0) 0 at:
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2ef31a) [0x560336a6f31a]
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2eb477) [0x560336a6b477]
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2ec7a2) [0x560336a6c7a2]
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2ec7e6) [0x560336a6c7e6]

This will provide one function instead of 0 or n, and could be expanded to include more.

This bloats shipping binary some (under condfigure only) which can be addressed with
an #if that conditionally turns the strings to null or empty. And slight code bloat.

Note that JIT and products and test use all this stuff and are left compatible and unchanged.

Previously:
foo(gpointer *stackdata)
{ ...
}

stackdata pointing to uninitialized, and not even size-specified

is now:

foo_internal(MonoStackData *stackdata)
{
...
}

foo(gpointer* stackpointer)
{
 MonoStackData stackData = { &stackdata, __func__ }; // define MONO_STACKDATA
 stackdata.stackpointer = stackpointer; // replacing &stackdata
 foo_internal(&stackdata);
}

with __func__ being a known-inaccurate standin for the caller.

If products/JIT/test evolve, flags to indicate which fields are present are likely in order.

Currently only the top function is printed, but we can likely store them longer.

As well running the debugger will help.

backtrace library could also be expanded. Currently it finds symbols on Mac but not Linux.
2018-04-05 21:18:53 -07:00
monojenkins 585954cbb9 [msvc] Update csproj files (#8067) 2018-04-06 02:17:12 +02:00
Alexander Köplinger e1eaedb6e8 [genproj] Sort embedded resources by name 2018-04-05 23:01:47 +02:00
Ludovic Henry babf07532b [sdks] Use wget in place of curl, it's installed by default on Linux (#8047) 2018-04-05 16:29:44 -04:00
jaykrell a1436838bf [Tailcall] virtual call support for arm64, x86; more return types supported for arm64 (#7966)
* [Tailcall] Disable tailcall-virt.exe tailcall/fsharp.exe per-arch instead of !AMD64
so we can whittle away at it.

* [Tailcall, arm64, jit] Make mono_arm_emit_destroy_frame flexible
as to if ip0 or ip1 (or both) is temporary. This isn't strictly necessary as caller
can carefully chose the correct one, i.e. ip0.

* [Tailcall jit arm64] Add virtual tailcall support to ARM64 (OP_TAILCALL_MEMBASE).
It could be either "interleaved" with regular tailcall support as done here,
or split up into a separate case. The level of code sharing with interleaving
is not huge.

* [Tailcall] Spell out 'membase' as 'tailcall_membase' for clarity.

Remove extra "shadowed local" MonoCallInst *call and use
 the other one. It achieves the same thing in this case
 and helps debugging experience. Alternative would be
 to rename the second one to "tailcall".

* [Tailcall] x86 tailcall_membase support (i.e. for virtual now, interface later)

* [Tailcall] Be sure not to tailcall interface calls on ARM.

* [Tailcall] More debugprinting.

* [Tailcall] arm64: allow floating point through (but only full registers)
arm, x86, amd64: require caller and callee return storage to match (arm64 already did)
Cleanup and debugprint.

* [Tailcall test] Always get hugeint (recursion depth) via function call,
so we can edit it one place.)

* [Tailcall] Add a FIXME for returning structs that can be made to work.

* [Tailcall test] Turn the F# test into three variations:
 deeptail same as original -- failure mode is stack overflow
 shallowtail which tailcalls but not to great depth -- it won't stack overflow
   and so it should have no other failure, but make sure -- for example
   this might still struggle on arm and we might split it up further
 shallownotail which is really should be nothing special

In this commit, all three are the same -- copy w/o edit.

* [Tailcall test] Make shallow in two tests and remove tail in one.

* [Tailcall test] Disable deeptail TailCallLoopGenericClass<DateTime> for all architectures.
It fails on x86 and arm64. It passes on amd64. arm tbd.

* [Tailcall test] Enable F# tests for x86 and arm64 (three internally are disabled for all architectures, one of which passes for amd64).

* [Tailcall test] Every configuration should be able to run the shallow/notail F#/tailcall tests.
They don't depend on tailcall, but either correctness w/ or w/o tailcall,
and if they do fail, it is not due to stack overflow.

* [Tailcall test] Fix .assembly directive to make some tailcall tests AOT compatible.

* [Tailcall] Dial back debugprint bloat after merge.
2018-04-05 11:50:21 -07:00
Alexander Köplinger 53de047335 [ci] Simplify run-jenkins.sh 2018-04-05 19:44:42 +02:00
Alexander Köplinger df33c092de [apidiff] Ignore CompilerGeneratedAttribute (#8042)
This attribute just adds noise to the apidiff.

Fixes https://github.com/mono/mono/issues/8036
2018-04-05 19:35:53 +02:00
Marek Safar c583d4e1fa [build] Rename VS managed solution (#8050) 2018-04-05 18:58:06 +02:00
monojenkins 59e7d12462 [msvc] Update csproj files (#8049) 2018-04-05 18:38:24 +02:00
Marek Safar 190e32ee8c [mcs] Implements C# 7.2 conditional ref expression 2018-04-05 17:56:02 +02:00
Bernhard Urban 8e0a12189a [interp] do not bake object reference into code stream (#8021)
it won't be scanned by the GC, defer string allocation to execution-time instead.


this fixes a GC crash when running mini regression suite on iOS/arm64.
2018-04-05 17:36:29 +02:00
Marek Habersack 92b741fa09 [SDKS] fix Linux (and possibly other OSes) build for Android (#8038)
OS: Ubuntu 18.03
CMake: 3.10

For some reason cmake fails to detect any make program (be it ninja or make)
when cross-compiling for Android in XA. It happens despite the programs being in
$PATH and working correctly. The effect is that CMAKE_MAKE_PROGRAM is set to
"not found" in CMakeCache.txt and configuration fails as follows:

 Call Stack (most recent call first):
   external/mono/external/boringssl/util/android-cmake/android.toolchain.cmake:1140 (CMAKE_FORCE_CXX_COMPILER)
   external/mono/sdks/builds/android-armeabi-v7a-debug/mono/btls/build-shared/CMakeFiles/3.10.2/CMakeSystem.cmake:6 (include)
      CMakeLists.txt:3 (project)
   CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      -- Configuring incomplete, errors occurred!

This commit does not fix the issue, per se, but it works around it by finding
the first ninja/make (as configured) executable in $PATH and setting the
CMAKE_MAKE_PROGRAM to full path of the executable. I haven't spent too much time
investigating *why* cmake fails to find the executable (I merely ran it with
--trace-expand --debug-output which revealed nothing of consequence) but this
workaround should be safe for any version of CMake and any OS we use makefiles
on.
2018-04-05 11:19:05 -04:00
jaykrell 9f499db187 Silently ignore mono_gchandle_free(0) so callers do not have to check. (#8020)
* [gc] Silently ignore mono_gchandle_free(0) so callers do not have to check.

* [threads] Take advantage of mono_gchandle_free(0) being nop (a few extra instructions
in dynamic path for when it is 0, same path length if it is not 0).

* [threads] Restore one if, it isn't clearly correct otherwise.
2018-04-05 07:27:40 -07:00
Alexander Köplinger a5d0ab59ed Fix tarball build
It got broken by https://github.com/mono/mono/pull/8026
2018-04-05 15:10:15 +02:00
Zoltan Varga c52cbd017f [sdks] Run device tests with the llvm builds as well. (#8027) 2018-04-05 15:03:38 +02:00
Miguel de Icaza 52df0f2b00 [System.MathF] Bring support for the single-precission Math operations to Mono (#7941)
This pull request brings support to Mono's class libraries for the new `System.MathF` type which includes operations for single-floating point.   

This is needed to run some new applications like:

https://github.com/aras-p/ToyPathTracer

With this change, it is possible to run this unmodified.  With this support, and the `-O=float32` option, it is possible to improve the performance from 6.3Mrays/sec to 7.8Mrays/sec on a Mac.

Oddly, this seems to be faster than .NET Core 2.1.4, which is at 4.2Mrays/sec.

* Bump API snapshot submodule
2018-04-05 14:37:46 +02:00
Rodrigo Kumpera 0b0d5de9e1 [wasm] Fix the CI build and disable some corlib tests that require multiple threads (#8005)
* [wasm][corlib] Disable some tests that don't work with WASM.

* [wasm][corlib] Disable IO test that requires threading.

* [wasm] Disable parallelism when building the wasm runtimes. Fixes CI build.

* [wasm] The incremental test runner can now skip tests in bulk.

* [wasm] Address reviewer feedback.
2018-04-05 10:06:35 +02:00
miguel d33f357ac6 Move Makefile documentation to markdown, and document how to run xunit tests 2018-04-05 10:01:00 +02:00
Marek Habersack 5c8c18046c [SDKS] Fix Android SDK build on Linux (#8015)
Current build uses `tar` to extract ZIP archives. This works with BSD
tar but not with GNU tar, alas. Tar was used in order to strip the root
directory of Android archive while moving files into place. This commit
replaces `tar` with a call to a shell script (because doing what it does
using Make defines is an exercise in pain) which works both on macOS/BSD
and on Linux.
2018-04-04 22:38:35 -04:00
Zoltan Varga 61b984beab [sdks] Set MinimumOSVersion to 10.1 on ios. (#8019) 2018-04-04 21:35:50 -04:00
jaykrell 9984e16797 [Tailcall] Dial back single -v output, and enable under MONO_LOG_LEVEL=debug MONO_LOG_MASK=tailcall. (#7985)
* [Tailcall] Dial back single -v output, and enable under MONO_DEBUG=tailcall, and -v -v.

* [Tailcall] MONO_LOG_LEVEL=debug MONO_LOG_MASK=tailcall and mono_trace instead of mono -v -v and g_print
2018-04-04 17:36:21 -07:00
Bernhard Urban fb91fce5d3 [interp] workaround undefined behaviour in r8 to u1 cast
This fixes `test_0_simple_double_casts` on iOS/arm64.
According to the C standard (section [conv.fpint]), the behaviour of
such a cast is undefined if the truncated value doesn't fit into the
destination type.

```c
unsigned char __attribute__ ((noinline)) convr8u1 (double i)
{
        return (unsigned char) i;
}
```

for arm64, `clang -O0` produces:

```
_convr8u1:
100006848:  ff 43 00 d1     sub sp, sp, #16
10000684c:  e0 07 00 fd     str d0, [sp, #8]
100006850:  e0 07 40 fd     ldr d0, [sp, #8]
100006854:  08 00 78 1e     fcvtzs  w8, d0
100006858:  00 1d 00 53     uxtb    w0, w8
10000685c:  ff 43 00 91     add sp, sp, #16
100006860:  c0 03 5f d6     ret
```

while `clang -O2` produces:

```
_convr8u1:
100006ae8:  00 00 78 1e     fcvtzs  w0, d0
100006aec:  c0 03 5f d6     ret
```

which is fine according the standard: Any value < 256 gets casted just
fine, but for example `convr8u1 ((double) 0xffff)` would end up with
`0xffff` in `w0`.

We workaround this behaviour by casting to a 32bit int first, the
resulting code looks like this then:

```
_convr8u1:
100006ae4:  08 00 78 1e     fcvtzs  w8, d0
100006ae8:  00 1d 00 12     and w0, w8, #0xff
100006aec:  c0 03 5f d6     ret
```
2018-04-04 20:16:26 +02:00
jaykrell 0b52b173f5 [threads] mono_join_uninterrupted waits longer than intended. (#7996) 2018-04-04 11:13:26 -07:00
Ludovic Henry d28767279a [sdks] Fix MXE_PREFIX for XA (#8006)
It should take 7 characters from the hash, not 6.
2018-04-04 13:37:34 -04:00
Zoltan Varga 04a446eb07 [sdks] More fixes for running device tests (#7994)
* [sdks] Update Info.plist.in so it works with older ios versions and tvos.

* [sdks] Add support for embedding a provisioning profile inside the app.
2018-04-04 09:10:54 -04:00
Zoltan Varga dd4613bc42 [runtime] Fix --disable-btls. (#7999) 2018-04-04 09:08:22 -04:00
jaykrell 1e2e6989ee [Coop] Remove bug-producing double evaluation in checked builds. (#7993) 2018-04-04 14:00:11 +02:00
Marek Safar 15f768fd04 [mcs] Clean up mcs project files 2018-04-04 11:23:37 +02:00
Rodrigo Kumpera cd219a91d1 [interp] Introduce MonoEEFeatures::force_use_interpreter as a way to make the wasm interp work. (#7989)
This flag tells the EE to skip searching compiled code and use the interp exclusively.
2018-04-03 22:39:12 -04:00
jaykrell d90a65a21c [jit] Add some missing bounds checks when reading ahead IL. (#7970) 2018-04-03 19:38:03 -07:00
monojenkins 6dd8df6845 [msvc] Update csproj files (#7998) 2018-04-04 02:25:32 +02:00
monojenkins 0b67219e6d [msvc] Update csproj files (#7995) 2018-04-04 00:55:54 +02:00
Marek Safar e938efc757 [corlib] Enable machine.config dependant version of CryptoConfig for net_4_x profile only (#7871)
Fixes #7716

* [corlib] Update linker descriptor with missing types
2018-04-04 00:26:07 +02:00
Alexis Christoforides e525533942 Disable a flaky test
https://github.com/mono/mono/issues/7992
2018-04-03 18:06:11 -04:00
Alexander Köplinger f9475164d9 [genproj] Add Mono.CSharp.pre and fix genproj postbuild bug (#7991)
We weren't emitting the postbuild script.
2018-04-03 23:52:43 +02:00
Alexis Christoforides 7a22783f25 Merge pull request #7958 from vargaz/ios-sdk-device-tests
[sdks] Add support for running device tests on ios.
2018-04-03 15:54:16 -04:00
Alexander Köplinger 7df16a0d31 [ci] Bump corlib-xunit test timeout
It takes close to the current timeout in a passing run already.
2018-04-03 20:51:34 +02:00
jaykrell 5c8fac189f [jit] Clarify assert, remove copy/pasted extra instruction, remove unused local. (#7965) 2018-04-03 09:22:59 -07:00
monojenkins ae82674b78 [msvc] Update csproj files (#7984) 2018-04-03 18:12:10 +02:00
Alexis Christoforides 04ec7abe31 Merge pull request #7953 from lewurm/interp-fix-native-types
[interp] fix i4<>i8 conversion for builtin types, it was inverted
2018-04-03 11:47:37 -04:00
jaykrell aad6fbaec5 [Tailcall] require exact matching return type (#7962)
* [Tailcall] Require an exact match on return type. Sometimes this makes sense (float<=>double), sometimes
it is a little overly restrictive (integer truncation, I <=> I[48])

* [Tailcall] Disable CoreCLR tests that have mismatched return types.
2018-04-03 08:15:22 -07:00
Rodrigo Kumpera 2f23688af2 [mini] Introduce MonoEEFeatures with a single feature use_aot_trampolines. (#7887)
[mini] Introduce MonoEEFeatures with a single feature use_aot_trampolines.

MonoEEFeatures is meant to replace the mode flag soup with have.
Each feature is supposed to be checked alone and descriptive enough of the underlying behavior.

use_aot_trampolines is a good example because the inter_aot_llvmonly mode could set it to false and
skip all the trampoline engine nonsense as trampolines are C functions.

Contributes to #7885

* [wasm] Switch wasm interp to not set use_aot_trampolines.

This allows the regular "JIT" tramp path be used instead of hacking our way around the AOT runtime.

* [mini] Introduce MonoEEMode to let us enumerate non-aot execution modes.

This lets us have all code setting up mono_ee_features in a single place.
2018-04-03 17:11:46 +02:00
jaykrell b2c02c81a3 [Coop] Remove a few raw pointers opportunistically. (#7964)
* [Coop] Opportunistically remove some raw pointers.
Replace some uses of mono_thread_interruption_checkpoint with
mono_thread_interruption_checkpoint_void or mono_thread_interruption_checkpoint_bool.

* [Coop] Remove some more raw pointers opportunistically -- mono_thread_execute_interruption to mono_thread_execute_interruption_void.

* Fix warnings from old bad merge.

* Add another static.

* [coop] Remove more raw pointers.
2018-04-03 10:11:43 -04:00
Tony Di Nucci 40df8e384f Fix for #7305 - stack overflow when ServiceHost is initialised with a ServiceContract which implements an interface 2018-04-03 15:02:05 +02:00
Ludovic Henry cf36124bb9 [sdks] Add provisioning for Android SDK and NDK (#7928)
* [sdks] Add provisioning for Android SDK and NDK

This will also be used by XA

* Add missing backslash to mxe.mk

* Only grab bin/autopoint

* [sdks] Use provisioning for MXE

We want to treat MXE the same way we do Android SDK and NDK because it only rarely changes, and it's very long to build it.
2018-04-03 08:52:00 -04:00
hgy59 abebff426a [WCF] fix ChannelDispatcher by accepting InstanceProvider (#7909)
* WCF: ChannelDispatcher/ListenerLoopManager.Setup validate InstanceProvider, not InstanceContextProvider
- the creation of endpoints requires an instance provider or a default constructor
- InstanceProvider vs InstanceContextProvider was obviously a typo

* include InstanceContextProvider for validation as before
- two unittests failed due InstanceProvider is null and ed.DispatchRuntime has not type set
- comment for the validation is not useful anyway (It is tested at Open(), but strangely it is not instantiated at this point.)
2018-04-03 14:31:14 +02:00
Alexander Köplinger ddcb792c01 [Facades] Add System.Memory facade to mobile profiles (#7939)
* [Facades] Add System.Memory facade to mobile profiles

Contains only the types we have right now.

Fixes https://github.com/mono/mono/issues/7610

* Bump API snapshot submodule
2018-04-03 13:34:42 +02:00
jaykrell f1dd2417ef [Tailcall] Fix .assembly directive to make some tailcall tests AOT compatible. (#7956) 2018-04-03 01:02:47 -07:00
Zoltan Varga e92c0da3f7 [ci] Run a subset of ios tests on device if the 'run-device-tests' ci tag is set. 2018-04-02 21:40:59 -04:00
Zoltan Varga f3e18ec093 [sdks] Add support for running device tests on ios. 2018-04-02 21:40:20 -04:00
Ludovic Henry ce6316e59d Bump version to 5.15 (#7955) 2018-04-02 21:29:07 -04:00
Zoltan Varga a7da5ba6aa [sdb] Add reference counting for single step requests, they can be accessed concurrently by the single step processing code and the event request clearing code. (#7876)
Fixes https://github.com/mono/mono/issues/7137
2018-04-02 21:10:47 -04:00
Alexis Christoforides 9767b8a55e Merge pull request #7951 from lambdageek/no-self-suspend-req-state
[coop] Remove STATE_SELF_SUSPEND_REQUESTED
2018-04-02 20:57:45 -04:00
Bernhard Urban 9cd9e3b0a1 [ppc] use ucontext_t
`struct ucontext` has been removed from glibc and `ucontext_t` has been
around for a while now.

Fixes a build failure on Ubuntu 18.04

Related glibc change
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=251287734e89a52da3db682a8241eb6bccc050c9;hp=c86ed71d633c22d6f638576f7660c52a5f783d66
2018-04-02 18:05:12 -04:00
Bernhard Urban 9b93d73699 [interp] fix i4<>i8 conversion for builtin types, it was inverted 2018-04-02 23:23:17 +02:00
Aleksey Kliger fd68b55687 [coop] Remove STATE_SELF_SUSPEND_REQUESTED
In 38a348c991 we got rid of
mono_threads_transition_reqest_self_suspension.  So there is now no way to
enter into STATE_SELF_SUSPEND_REQUESTED, so we no longer need to have cases for
transitioning out of it.
2018-04-02 16:54:50 -04:00
Rodrigo Kumpera 90b49aa3ae Merge pull request #7946 from kumpera/wasm_fix_a_few_issues
[wasm] Multiple fixes for the WASM target extracted for other PRs.
2018-04-02 15:26:39 -04:00
Zoltan Varga 21a9412a67 [sdb] Fix --enable-minimal=soft_debug build. Fixes #7920. (#7945) 2018-04-02 13:46:32 -04:00
Alexis Christoforides 95276e9ddb Merge pull request #7943 from filipnavara/corefx-sd-tests-1
[System.Drawing] Include CoreFX GraphicsPath and Region tests.
2018-04-02 12:01:12 -04:00
Rodrigo Kumpera cdea795c0e [wasm] Make RuntimeInformation properly detect WebAssembly.
It's done by ifdef'ing WASM because I don't see a way to change Environment.Platform / Environment.OSVersion without touching the public API.

Right now OSDescription is being used to return the execution environment. Once we properly support node and other non-web embeddings, it will be adjusted to do so.
2018-04-02 11:32:54 -04:00
Rodrigo Kumpera d8648776cc [wasm] Bump corert to pick fix for TaskCreationOptions.LongRunning. Fixes #7864.
Update the test runner to pick it up.
2018-04-02 11:31:28 -04:00
Rodrigo Kumpera 106ef365e3 [wasm] Disable the degraded alloc warning under wasm. Fixes #7661 2018-04-02 11:29:25 -04:00
Rodrigo Kumpera 2bf9a42fd3 [wasm] Fix the build. 2018-04-02 11:29:19 -04:00
Rodrigo Kumpera 5bdb87b6a6 [wasm] emcc has a broken clock_getime. Disable its usage. 2018-04-02 11:29:16 -04:00
Filip Navara a810739246 Include CoreFX GraphicsPath and Region tests. 2018-04-02 15:22:26 +02:00
Alexis Christoforides 4723e6603e Merge pull request #7915 from alexischr/fix-gh-7568
[System.IO] Don't throw exception when FileSystemWatcher is disposed while the backend is still trying to use it
2018-04-01 19:26:24 -04:00
Alexander Köplinger 2b4208feda [System.Windows.Forms] Set NotifyIcon.Icon in test to prevent warning 2018-04-01 18:12:15 +02:00
Alexander Köplinger a914dbf173 [System.Windows.Forms] Dispose forms opened during two tests 2018-04-01 15:13:33 +02:00
Hugh Bellamy fcd52894d9 [System.Drawing] Remove failing jpeg flags tests (#7931) 2018-04-01 00:41:17 +02:00
Rodrigo Kumpera 254013b0fd [runtime] Fix class visibility check for protected nested classes. (#7907)
* [runtime] Fix class visibility check for protected nested classes. Fixes #7657.

A nested class that has protected access must be checked using the same inheritance based rules as members.
The existing code ignores that and does a plain visibility check that is only amendable for public/internal nested types.

* [runtime] Add regression test for nested famility visibility.
2018-03-31 11:04:00 -04:00
monojenkins ebef3ec4b1 [msvc] Update csproj files (#7929) 2018-03-31 02:15:25 +02:00
Alexander Köplinger 2cbd1706dc [System.Drawing] Enable corefx xunit tests (#7924) 2018-03-31 01:13:03 +02:00
Katelyn Gadd 4d78aaf7b4 [genproj] When using fallback profile selection don't build the projects that were missing a profile (#7926)
Fixes #7903.
2018-03-31 01:06:07 +02:00
jaykrell 1931cb1dcb [Tests] Disable hijacking.exe and Jittailcall2.exe tailcall tests. (#7922) 2018-03-30 19:54:39 +02:00
Alexander Köplinger 938415c6d3 [test-runner] Don't output test result xml when no tests are run
A result xml that contains 0 tests confuses some tools.
2018-03-30 18:18:23 +02:00
Zoltan Varga a5a496695a Disable building btls/ and support/ on the bcl build, they are not needed. (#7921)
* [runtime] Add a --disable-btl-lib configure option to disable the building of the btls lib, but compile the managed code with btls support.

* Disable building btls/ and support/ on the bcl build, they are not needed.
2018-03-30 10:05:44 -04:00
Katelyn Gadd 2e0182b5c0 Implement Field SetValueDirect on non-struct targets. Add test case from roslyn issue 19038. (#7866)
* Implement Field SetValueDirect on non-struct targets. This allows the test case for roslyn bug 19038 to pass. Add roslyn bug 19038 test case.
2018-03-30 10:04:46 -04:00
Bernhard Urban 88cab36c20 [sdks] add Make.config to ignore file (#7901) 2018-03-30 09:27:16 -04:00
Ankit Jain 5c839fc109 Bump msbuild to track xplat-master (#7900) 2018-03-30 14:53:40 +02:00
Ludovic Henry f83fbbd9b8 [sdks] Fix LLVM build for XA (#7917) 2018-03-29 20:45:30 -04:00
Bernhard Urban a36d08a55a [perfcounters] fix alignment issue on 32bit
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related https://github.com/xamarin/xamarin-macios/issues/3826
2018-03-30 01:03:06 +02:00
Alexis Christoforides 1e1893d683 [System.IO] Don't throw exception when FileSystemWatcher is disposed while the backend is still trying to use it 2018-03-29 18:25:45 -04:00
Alexis Christoforides a1751d91c8 Revert "Disable some flaky tests."
This reverts commit bc25029b58.
2018-03-29 18:23:24 -04:00
Alexis Christoforides 2c14b1f82c Revert "Disable a flaky test."
This reverts commit 6822a57663.
2018-03-29 18:23:22 -04:00
Alexis Christoforides 86df754848 Revert "Disable bug-80307.exe"
This reverts commit 3015caeffad089e654116027c51b6746d0f43d37.
2018-03-29 18:23:20 -04:00
Zoltan Varga 60707875d5 Revert "[sdks] Disable btls and support/ on the bcl build, they are not needed. (#7892)" (#7904)
This reverts commit 792196320f.
2018-03-29 17:46:29 -04:00
jaykrell 6f0fba8961 [Tailcall] Bring coreclr tests for tail calls to Mono source tree (#7204)
* [Tailcall] Copy some tests from CoreCLR.

* [Tailcall] Copy and build some tests from CoreCLR.

* [Tailcall] Add mono --test-tailcall-require switch
 that asserts that every tail. is honored.
 Add some tailcall output under -v.

* [Tailcall] Switch tests/coreclr/tailcall to tests/tailcall/coreclr
on the theory that this is where additioanl tailcall tests will go,
not that is the coreclr test area.
Also remove leading "./" which did afford easier search/replace
but will likely be seen as noise, and might break out of tree builds.

* [Tailcall] update readme

* [Tailcall] Tweak logging and first working Makefile, w/o disabled tests.
Next step is try to restore parallelism.

* [Tailcall] Add indent and fix check-tailcall to be parallel and incremental.

* [Tailcall] Out of tree builds just need mkdir.

* [Tailcall] Remove accidental content.

* [Tailcall] Undo fix for out of tree builds.

* [Tailcall] Use environment variable MONO_DEBUG in place of command line parameter despite
environment variables having problems and being banned in other contexts.

Accept and ignore empty MONO_DEBUG option so that ",foo" can be appended without
first checking for empty -- without having to learn how in another language.

Use g_print instead of printf in new code, i.e. for Android debugger.

Remove newlines to restore unreadability/unmergability.

Make running tailcall tests not incremental by default but leave I= to make it incremental.

Add comments indicating "tailcalllog" is a public interface, not to be changed
without changing its users.

* [Tailcall] Resolve a recent "FIXME".

* [Tailcall] Compile but do not run the C# tests.

* [Tailcall] Split disabled compile from disabled run, and compile the last of the tests.
Disable compile remains, because one of the tests contains 3 files, and putting
the three sources in the sources variable (for distribution) implies building them each separately.
Disable compile is used to remove two of them from compiling independently
and then another dependency rule makes them compile together.

* [Tailcall] Follow convention without incrementality and less verification.

* [Tailcall] Disable new failing tests on x86/arm/arm64 and Linux/amd64.

* [Tailcall] Disable more tests for x86 and sort the lists.

* [Tailcall] Move from .NET Standard to mscorlib see if that works better.

* [Tailcall] Add missing build dependency.

* [Tailcall] Do not compile tailcall/coreclr/JIT/opt/Tailcall/TailcallVerifyWithPrefix.exe for
FullAOT. Compiling it fails an assert where it is supposed to raise an exception. Fix later.

* [Tailcall] For now, do not run any CoreCLR tailcall tests with FullAOT.
--compile-all fails an assert there. Instead we have to find what can run, and don't use --compile-all.

* [Tailcall] Disable all CoreCLR tests under FullAOT. Some fail to tailcall.
Many work, w/o assertion failure and printing success, but none exit with 0 exit code.

* [Tailcall] Add clarifying comment.

* [Tailcall] Add two opportunistic tail. prefixes.
2018-03-29 10:54:10 -07:00
Ludovic Henry 765ea25772 [sdks] Fix LLVM build on Linux for XA + Fix MXE usage on non-Darwin platforms (#7910)
* [sdks] Fix LLVM build on Linux for XA

* [sdks] Fix MXE usage on non-Darwin platforms
2018-03-29 13:03:39 -04:00
monojenkins 1d36e15392 [msvc] Update csproj files 2018-03-29 18:51:36 +02:00
thfrwn 81a781bb02 add some OpenBSD patches (#7699)
add some OpenBSD patches

Hi,

A few trivial additions of OpenBSD to ifdefs, plus the change of the abort signal to SIGUSR1 which fixes the SIGABRT problem (other compilation problems remain). SIGTTIN is broadcast to the process group which leads to the SIGABRT (at least on OpenBSD).
2018-03-29 11:25:23 -04:00
Zoltan Varga 792196320f [sdks] Disable btls and support/ on the bcl build, they are not needed. (#7892)
* [sdks] Disable btls and support/ on the bcl build, they are not needed.

* fix indent
2018-03-29 10:09:08 -04:00
Alexander Köplinger 573e460e97 Fix tarball build
iconv.m4 was deleted in https://github.com/mono/mono/commit/ff40ceff387e1b4a726a00a4e4d0e654afe1cd99
2018-03-29 15:29:10 +02:00
Alexander Köplinger 7ec2423535 [packaging] Bundle the msvc compiled monograph.exe on Windows 2018-03-29 15:26:05 +02:00
Alexander Köplinger 3dad276e2d Bump api-snapshot 2018-03-29 14:19:00 +02:00
Austin Wise 77b2db73aa Add BindingFlags.DoNotWrapExceptions (#7863)
The original design review is here: dotnet/corefx#22866 . To summarize, this adds a new flag to `BindingFlags` called `DoNotWrapExceptions`. When this flag is used to invoke a method using reflection, any exceptions thrown are not wrapped with a `TargetInvocationException`.

It has already been implemented in some other version of .NET:
- dotnet/corert#4437
- dotnet/coreclr#13767

I would be delighted if this handy feature was also available in Mono.

I have in part based my changes on the CoreCLR implementation. There all already tests for this feature in corefx, so I have added those to the corlib_xtest.dll.sources file.

I have a couple of concerns about my implementation:
- I notice that `DynamicMethod.Invoke` was ignoring the BindingFlags and other arguments. I changed this method to pass along all the arguments. For what it's worth, it appears that [CoreCLR respects](https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs#L488) these arguments.
2018-03-29 14:18:27 +02:00
Zoltan Varga 9ff460b004 [sdks] Disable wasm on the ios sdk lane. (#7894) 2018-03-29 01:24:30 -04:00
Ludovic Henry e70a872c53 [sdks] Fix usage of MXE for XA (#7897) 2018-03-28 22:03:15 -04:00
PiotrCW 5841ffff03 [System.Windows.Forms] Ignore non-visible controls when computing ScrollableControl canvas size (#4247) 2018-03-29 03:56:44 +02:00
Ludovic Henry 407e254643 [sdks] Pass LLVM_SRC from XA to use xamarin-android/external/llvm + Pass IGNORE_PACKAGE_MXE from XA + Only checkout specific MXE and LLVM commit when cloning (#7893)
* [sdks] Pass LLVM_SRC from XA to use `xamarin-android/external/llvm`

We do not clone to `$(LLVM_SRC)` because this is up to XA.

* [sdks] Pass IGNORE_PACKAGE_MXE from XA

This is to avoid rebuilding MXE while XA already took care of it.

* [sdks] Only checkout specific MXE and LLVM commit when cloning
2018-03-28 21:41:58 -04:00
Ludovic Henry 6c901dbfc5 [sdks] Pass MXE_SRC from XA to use xamarin-android/external/mxe (#7888)
We do not clone to or remove `$(MXE_SRC)` because this is up to XA.
2018-03-28 18:23:34 -04:00
Ludovic Henry ff40ceff38 check for iconv only once (#7873)
It is enough to check for iconv
dependencies once in the eglib/configure
- just use the generated libtool
library file to automatically
add additional dependencies (if any).

While here, make sue libeglib.a
has libraries returned by LTLIBTOOL
as a libtool dependency.
2018-03-28 17:05:55 -04:00
Marek Safar e3e1fe1c16 [corlib] Moves DynamicMethod to mscorlib to work better with wasm (#7875)
* [corlib] Moves DynamicMethod to mscorlib to work better with wasm

* Bump API snapshot submodule
2018-03-28 20:15:27 +02:00
Zoltan Varga ada6edbad8 [bcl] Fix the compilation of System tests in the mobile profile. (#7882) 2018-03-28 19:57:41 +02:00
monojenkins 2f66873ab2 [msvc] Update csproj files (#7811)
* [msvc] Update csproj files

* [msvc] Delete old net_4_x.csproj and xbuild_12.csproj files
2018-03-28 19:29:28 +02:00
Zoltan Varga 753cc874f6 [jit] Add signature checking for CALLI. (#7832)
Fixes #7792.
2018-03-28 13:17:30 -04:00
Alexander Köplinger ab62d30edb [genproj] Move obj to common folder and remove unnecessary properties (#7870)
* [genproj] Move obj to common folder and remove unnecessary properties

We now default to mcs/class/obj instead of writing to the assembly folder.

* [genproj] Fix jay path on Unix

* [genproj] Fix IntermediateOutputPath for Facades
2018-03-28 17:51:47 +02:00
Marek Safar 8c86a805ff [mcs] Updates common array bounds unification to use universal type comparer 2018-03-28 17:25:37 +02:00
Calvin b42086d450 Use __PASE__ for things i needs that AIX doesn't (#7858)
IBM's new toolchain for i defines __PASE__, and if cross-compiling
from AIX, we can pass `CPPFLAGS="-D__PASE__"` to `./configure` as
needed.
2018-03-28 11:01:05 -04:00
Alexander Köplinger f00eba8a7c Whitelist illinkanalyzer in macOS package (#7861)
Fixes #7860
2018-03-28 15:09:26 +02:00
Alexis Christoforides 4a247e7ed9 Merge pull request #7740 from alexischr/corefx-unknownunix-fsw
[System.IO] Use CoreFX FileSystemWatcher stub for mobile profile
2018-03-28 08:40:07 -04:00
monojenkins 03a153c7b3 Bump API snapshot submodule 2018-03-28 12:39:33 +00:00
Martin Baulig e6f90edfcd [System]: Disable the System.Net.ServicePoint tests from corefx.
These tests never passed and are only spewing error message output,
making it much harder to see actual failures.
2018-03-28 12:06:48 +02:00
jaykrell 0f9b7f730f mono_perfcounter_counter_names returns incorrect names, and restructure slightly for clarity (#6355)
* Add some PerformanceCounter test code from reference source and MSDN,
combined and lightly edited per local conventions.

* Restructure PerformanceCounter code for type safety and fix incorrect typing.
2018-03-28 11:52:11 +02:00
hgy59 9b36f1452f wcf: fix index of message body parts. Do not use MessageBodyMemberAttribute.Order as index. 2018-03-28 10:46:43 +02:00
Alexis Christoforides 3c8bf90a40 [System.IO] Use CoreFX FileSystemWatcher stub for mobile profile 2018-03-27 18:05:07 -04:00
Alexis Christoforides 6caa9bd881 Disable a flaky FileSystemWatcher test 2018-03-27 17:01:52 -04:00
Alexis Christoforides 7e31c5d11f Merge pull request #7849 from marek-safar/corefx-fixes
[corlib] Restores ConcurrentDictionary serialization support.
2018-03-27 16:58:46 -04:00
Marek Safar 294707cf88 [build] Fixes bootstrap invocation of cil-stringreplacer 2018-03-27 18:07:22 +02:00
Aleksey Kliger (λgeek) dc1ef2ea3a [runtime] One more MonoClass getter fixup (#7836)
* [monograph] Don't link duplicate copies of metadata and utils

Monograph builds against mono/mini/($LIBMONO_LA) (aka libmonosgen-2.0.la), so
the only pieces it would pick up from staticlly linking the extra libs are
non-API functions (such as the MonoClass getters), but at the cost of linking
errors due to duplicate symbols.

Also replace calls to MonoClass getters by mono API functions.

* [ilgen] Fixup MonoClass getter usage

Followup for e610e443cd

* [boehm] Fix a few direct MonoClass accesses

* [monograph] Statically link against the mono runtime

Dynamically linking but using some symbols (such as mono_read32) on some
platforms that are hidden in the library means that we had to statically link
against the runtime anyway, which then caused build issues.

* [monograph] Fix runtime crash on startup

```
mono_os_mutex_lock: pthread_mutex_lock failed with "Invalid argument" (22)
```

* [msvc] Fix monograph build
2018-03-27 10:57:23 -04:00
Marek Safar dc6700a799 [corlib] Restores ConcurrentDictionary serialization support.
Fixes #7822
2018-03-27 14:38:10 +02:00
Marek Safar 32e6bccc2d [System] Makes TLS providers linker friendly 2018-03-27 14:34:34 +02:00
Marek Safar 554690a64c [build] Update monolite package to support cil-stringreplacer (#7847) 2018-03-27 14:31:05 +02:00
Alexander Köplinger 96e8fa67e2 [bcl] Fix Cscompmgd/I18N.Rare not having any tests (#7842)
This caused a warning in some tools that process the NUnit result xml.
The fix is to make them execute at least one test.
2018-03-27 13:36:31 +02:00
Katelyn Gadd 3157302581 Pull in bug 53272 fix 2018-03-27 10:01:38 +02:00
Alexander Köplinger 16d5c31409 [ci] Bundle nunit xml results in a .tar file (#7843) 2018-03-27 03:15:43 +02:00
Alexander Köplinger 5e1acb47f5 [genproj] Deduplication of project references (#7844) 2018-03-27 02:47:19 +02:00
Zoltan Varga b20d5ce1e5 [runtime] Rework how the native-to-managed eh callback is called. (#5837)
* [runtime] Rework how the native-to-managed eh callback is called.

Instead of catching all exceptions in the native-to-managed wrapper and calling the callback from the catch clause, call it directly from the EH code. The
previous approach caught all exceptions, which messed up debugging, since the debugger wouldn't break on uncaught exceptions raised from native-to-managed
callbacks.

* [coop] Enable tests bug-58782-plain-throw and bug-58782-capture-and-throw for PRs

* [mini] Installed native-to-managed exception handling callback from second pass.

The constraints are:
1. We must allow managed exceptions to be caught and finally blocks must run
2. We must not call the unmanaged exception handler if the first unwinding pass
   detects that there is a native-to-managed wrapper and a callback is
   installed that will handle managed exceptions (by unwinding the native code
   and either re-raising the managed exception or otherwise dealing with it).

So we change the return value of handle_exception_first_pass to be:
- MONO_FIRST_PASS_HANDLED - caught by a managed frame (with a matching filter if one was present).
- MONO_FIRST_PASS_CALLBACK_TO_NATIVE - there's a native-to-managed wrapper and a ftnptr_eh_callback is installed.
- MONO_FIRST_PASS_UNHANDLED - first pass unwound all the way and there was no wrapper or there was no callback installed.

In mono_handle_exception_internal, we treat MONO_FIRST_PASS_CALLBACK_TO_NATIVE
as handled and unwind the managed stack, invoking finally clauses as we go,
until we reach the managed-to-native frame, at which point we invoke the callback.

* [test] Test for mono_install_ftnptr_eh_callback

* [test] AOT-friendly test for mono_install_ftnptr_eh_callback
2018-03-26 15:37:34 -04:00
Ludovic Henry 2b663424a0 [threads] Remove suspicious mono_gchandle_free
Fixes https://github.com/mono/mono/issues/7786
2018-03-26 17:58:29 +02:00
Jason Imison f66032b7c0 Fix F# build. (#7826)
We need to be specific about the type of `switchName` as
String.StartsWith got a new char overload.

Fixes #7805
2018-03-26 15:06:52 +02:00
Michael DeRoy e610e443cd Structure field that cannot be marshalled throws exception instead of aborts\n Alllow structure pointer conversion for blittable multi-dimentional arrays (#7794) 2018-03-25 23:11:44 -04:00
Aleksey Kliger (λgeek) febd5ac535 MonoClass getters mop-up PR (#7806)
* [sre-save] Remove type_token assignment in mono_image_fill_export_table

In 9725d50c87 we added the `g_error`, that should
fire if the MonoClass:type_token and the TypeBuilder token ever disagree. As a
result, this assignment is strictly redundant.

* [pedump] Use MonoClass getters

* [monograph] Use MonoClass getters

* [mini] Use MonoClass getters in a few more places

Catch up with recent commits.
2018-03-24 19:03:43 -04:00
Aleksey Kliger (λgeek) a5099ca2a4 [mini] Use MonoClass getters in method-to-ir.c (#7772) 2018-03-24 11:29:34 -04:00
Aleksey Kliger (λgeek) 2ce121ab7b [sre-save] Remove type_token assignment in mono_image_fill_export_table (#7803)
In 9725d50c87 we added the `g_error`, that should
fire if the MonoClass:type_token and the TypeBuilder token ever disagree. As a
result, this assignment is strictly redundant.
2018-03-24 11:28:44 -04:00
Zoltan Varga 2f5077a1fb [sdks] Fix the ios sdk build. (#7801) 2018-03-24 09:53:38 -04:00
Ludovic Henry dde9ee5e79 [w32handle] Lower minimum memory usage (2nd attempt) (#7508)
Adopts a linked list of MonoW32HandleSlot (based on feedback from Rolf Kvinge). This allows for an unlimited amount of handles to be allocated, as well as for a lower cost to allocate only 1 handle across the process.

Fixes https://github.com/mono/mono/issues/7460
2018-03-23 23:00:50 -04:00
Ludovic Henry 30903764c2 [sdks] Fix Android build for toolchain (#7817) 2018-03-23 21:17:43 -04:00
Aleksey Kliger (λgeek) 2709d2309e [mini] Use MonoClass getters on non-AMD64 platforms (#7799)
Best effort to replace direct MonoClass field access by getters.
2018-03-23 20:50:42 -04:00
Alexander Köplinger 506fc0b522 [genproj] Deduplication of sources (#7810)
This implements a simple deduplication of source files in the .csproj's.

A postprocessing step opens the files and grabs all ItemGroups with sources
and then does an intersection. It then moves files that are common
across all platforms into a separate ItemGroup.
2018-03-23 23:56:02 +01:00
jaykrell 331f3d9f27 Fix warnings and cleanup style. (#7800)
* Fix warning: Add static.

* Fix warning: Remove unused function from a recent incorrect merge/rebase.

* Fix warning(s): Cast away const.

* Add static to avoid global link-namespace pollution.

* Add const on input strings.

* (void) and () are not the same in C, overwhelmingly you want (void)
{0} does not portably zero unions, so favor memset
braces at start of function go on their own line
space before parens on function calls
spaces around binary operators
favor memset (x, 0, sizeof(x)) instead of memset (x, 0, sizeof(type))
favor TRUE/FALSE over true/false unless/until we switch to C++
2018-03-23 15:45:34 -07:00
Katelyn Gadd 954911d3f1 Genproj updates for BCL build in Windows Visual Studio (#7755)
This batch of commits makes further updates to our support for building the BCL using msbuild (Visual Studio, to be specific).

* Generates a single sln and set of csproj files with support for all of our build profiles (orbis, monodroid, net_4_x, etc)
* Project configuration selector (in VS or as parameter to msbuild) can be used to select which profile to build
* Includes partial dependency information so that culevel and jay are compiled before the rest of the sln (this keeps pre/post events from from failing on first build)

As of this rev things are working pretty good, but a lot of the measures I took here are temporary so I'd appreciate thoughts on how to go about them. The hard-coded System.Web -> Culevel dependency feels gross, for example - I kind of want to go through and build an automatic solution for it but I'm not sure it's necessary.

Implements #6858

---

* Checkpoint: Generate single .csproj file with conditional item/property groups

* Checkpoint: Updates to csproj and sln generation to support building specific profiles

* Move targets file in csproj template so that it isn't evaluated before all properties are set

* Checkpoint profile fallback (use net_4_x if project does not have appropriate profile)

* Use in-process cache for project guids to fix bug where many guids were being generated. Fix profile fallback.

* Clean up unnecessary debug writelines

* genproj error fixes

* Remove duplicate gacutil entry from makefile to fix order.xml corruption. Cleaner project names in msbuild sln. Compile genproj before generating inputs.

* Delete genproj.exe at beginning of update-solution-files because otherwise syntax errors will cause an old version to be used silently
Cleaner messages from genproj

* Hard-code the guid for culevel and add it as a dependency for system.web

* Bug fixes

* sln files are sensitive to whitespace format

* Don't generate pointless solution configurations if we have no information for them

* Updates based on PR feedback
2018-03-23 23:35:21 +01:00
Aleksey Kliger (λgeek) 431c67415c [mini] Use MonoClass getters in aot-compiler.c (#7773) 2018-03-23 18:33:39 -04:00
Aleksey Kliger (λgeek) 76f0193388 [ci] For checked builds, pass -k to make (#7802)
I'd like to see more compilations errors in checked build results - so run with `make -k`
2018-03-23 20:53:07 +01:00
Egor Bogatov 43d9c4737b Imports FtpWebRequest from CoreFX (#7644)
Contributes to #7682

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

FtpWebRequest used to work incorrectly with sub directories.
Let's say we have a following FTP structure

```
myserver
├── file1
└── subdir
    └── file2
    └── file3
```
Old behavior:

### 1) For `ftp://myserver/subdir/` printed:
```
file2
file3
```
Expected:
```
file2
file3
```

### 2) For `ftp://myserver/subdir` printed:
```
file1
subdir
```
Expected:
```
subdir/file2
subdir/file3
```
### 3) For `ftp://myserver/subdir/file2` printed:
```
file2
file3
```
Expected:
```
file2
```

With the fix in this PR it works as expected (matches netfx and netcore behaviors).
2018-03-23 20:50:52 +01:00
Alexis Christoforides bc25029b58 Disable some flaky tests.
https://github.com/mono/mono/issues/7568
2018-03-23 15:03:54 -04:00
Zoltan Varga 901ccebb0a [sdks] Disable the interpreter on ios device builds. (#7793) 2018-03-23 14:22:24 -04:00
Marek Safar e3c284c4e3 CodeOwners update (#7798) 2018-03-23 13:13:33 -04:00
Rodrigo Kumpera 74daf13fb2 Harden JIT job control against cctors deadlocking. (#7423)
* [mini] Don't wait for other threads to finish JITing if the current thread is running a cctor.

This eliminates a possible source of deadlocks found during AOT runs of Roslyn.

* [mini] Introduce a 1s timeout to JIT job control to ensure we don't simply deadlock in case of execution dependency bugs.

* [mini] fix spelling5DD
2018-03-23 17:43:30 +01:00
Aleksey Kliger (λgeek) 7bb6e59e38 [runtime] Fix lock tracer compilation error (#7767) 2018-03-23 11:58:38 -04:00
Egor Bogatov 1bdcf19169 [corlib] System.Collections from CoreFX (#7478) 2018-03-23 16:23:27 +01:00
Aleksey Kliger (λgeek) 3aeab61192 [mini] Use MonoClass getters in a few files (#7771)
* [metadata] Use getters in a few ilgen files

* [mini] Use MonoClass getters in several files

* [mini] Use MonoClass getters in mini-generic-sharing.c

* [debugger-agent] Use MonoClass getters

* [monodis] Use MonoClass getters in get.c
2018-03-23 11:01:10 -04:00
Aleksey Kliger (λgeek) 158bb416eb [interp] Use MonoClass getters (#7774)
* [interp] Use MonoClass getters in interp/interp.c

* [interp] Use MonoClass getters in interp/transform.c
2018-03-23 09:35:53 -04:00
Filip Navara b06de64bf8 Fallback to listing drives in My Computer using System.IO.DriveInfo. 2018-03-23 14:22:34 +01:00
jaykrell b8fdce6c05 [Tailcall] Fix virtual generic methods that F# tests uses. (#7524)
* [Tailcall] Add but do not use the F# tailcall test suite.

* [Tailcall] Compute inst_tailcall much earlier, it is cheap, and it will be used more and earlier.

* [Tailcall] Compute supported_tail_call and tail_call earlier.

* [Tailcall] Fix virtual generic methods that F# test TailCallLoopGenericClassAndMethodAbstractClass<byte>.Method3<byte> uses.
There is a general problem of customized code paths missing pieces.
This fixes just part of it.

* [Tailcall] Use common code for removing ret after tailcall, and not handling return value.

* [Tailcall] Cleanup.

* [Tailcall] Short circuit looking at parameters for has_vtargs.

* [Tailcall] Tailcalls presumably do not need sequence points, or anything, after them.

* [Tailcall] Fewer labels, more booleans, move existing label up, with additional booleans
 controlling its behavior -- intent is to tease one altered behavior (tailcall of
 virtual generic) and one existing and one new sharing of common code (remove_ret).
 Longer term might have more tailcall handling.

* [Tailcall] F# tests closer to original.

* [Tailcall] Add the F# tests in blob form.
comment out the two failing tests
fsharpc --standalone --optimize- fsharp.fs
monolinker fsharp.exe to trim a little
change resource-using code to use constant strings

* [Tailcall] CI fails roughly where local passes.

* [Tailcall] Merge fsharp.fs into fshar.il as a comment.

* [Tailcall] Cleanup, remove unused labels, etc.

* [Tailcall] Cleanup test code some.

* [Tailcall] Cleanup.

* [Tailcall] Try harder to disable fsharp for AOT due to CI failures.
2018-03-23 06:11:41 -07:00
Neale Ferguson 066ce33825 Add tailcall support & fix floating point ABI (#7695)
* Add tailcall support and fix floating point ABI

* Remove unneeded function

* Add terminal condition
2018-03-23 08:49:29 -04:00
Bernhard Urban d233bdbf99 [icall] remove DISABLE_PROCESS_HANDLING (#7779)
The only user was Xamarin.iOS in a weird way: The define is only set for
device builds where the icall table is excluded anyway. For the cross
compiler however, the define isn't set, and therefore those icalls can
be resolved by the AOT compiler.

With the interpreter now, this define actually had an effect: The
guarded icalls weren't inclueded in `libmono-icall-table.a`.
2018-03-23 07:51:32 -04:00
Bernhard Urban 7de72fbf3f [interp] support increment and decrement of nint/nuint
update definition to be in sync with XI
2018-03-23 11:27:50 +01:00
Bernhard Urban d424774751 [interp] improve error message and add another interp_in signature 2018-03-23 11:27:26 +01:00
Miguel de Icaza dfabaa5917 Remove incorrect docs (#7784)
* [mkbundle] Automatically bundle config files and machine.config files for the simple/cross compiler scenario, fixes one of the missing issues for #6230

* Remove debug writeline

* Remove outdated information

* Bump API snapshot submodule
2018-03-23 10:54:41 +01:00
Zoltan Varga 67e995c6e2 [interp] Improve mixed mode execution support, using full-aot+interp as the configuration. (#7764)
* [interp] Handle mono_handle_exception () returning a ctx which refers to JITted code by restoring the context.

* [aot] Clear the pinvoke flag from the interp_in wrapper signatures, so they get an lmf in mini_get_interp_in_wrapper (), this is needed for mixed-mode exception handling.

* [aot] Change the semantics of the 'interp' option, use it only to emit additional interp wrappers etc. instead of disabling code generation as well.

* [aot] Emit more interp-in/interp-out wrappers when using --aot=full,interp.

* Add a --interp=interp-only= command line option, used for testing.
In full-aot+interp mode, prefer full-aot code instead of interp code, except for methods in the classes listed
in the interp-only option.
Use normal runtime invokes in full-aot+interp mode.

* [interp] Prefer AOTed code when making calls out of interpreted code in full-aot mode.

* [aot] When running with --aot=interp, preserve the previous behavior of only emitting interp wrappers and trampolines.
2018-03-22 21:17:44 -04:00
Ludovic Henry 9c63d1bf9d [sdks] Fix Android build for mxe (#7781) 2018-03-22 20:42:46 -04:00
Ludovic Henry 8a3b4bf2af [sdks] Fix Android build on Linux (#7775) 2018-03-22 18:20:00 -04:00
Bernhard Urban 95d450660b [interp] move variable decl into ifdef to avoid unused warning (#7763) 2018-03-22 17:49:31 -04:00
jaykrell 392e1c368c [Tailcall] Proper fix for F# regression, at least some architectures. (#7658)
* Revert "[Tailcall] Quick fix for building F#. Do not tailcall any method with a vtable_arg. (#7609)"

This reverts commit 8ceead93e3.

* [Tailcall] Correct fix for regression from change b4ee86154f.
Regression test not yet available.

* extra brace

* [Tailcall] Add FIXME for tail. not followed by ret. Correct behavior is to raise an exception, not fail an assert.

* [Tailcall] Add disabled debug code to break when compile a tailcall and/or execute a tailcall.

* [Tailcall] Add disabled debug code to try to tailcall any call followed by a ret.
This might be reasonable in the future, as well as a little data flow
analysis skipping nops and branches, as csc w/o -optimize outputs.

* [Tailcall] Add more tailcall tests, i.e. that would
have caught recent regression.

* [Tailcall] Replace #if 0 with MONO_DEBUG=tailcall_break_compile,tailcall_break_run,tailcall_try_all,tailcall_log,
tailcall_all. Consider MONO_TAILCALL_DEBUG instead.

* Revert "[Tailcall] Replace #if 0 with MONO_DEBUG=tailcall_break_compile,tailcall_break_run,tailcall_try_all,tailcall_log,"

This reverts commit 796d9490f672625189dfac47ff24b05f3fb65cbe.

* [Tailcall] Replace #if 0 with ifdefs:
define DEBUG_TAILCALL_BREAK_COMPILE   breakpoint in method-to-ir
define DEBUG_TAILCALL_BREAK_RUN 1     codegen outputs breakpoint
define DEBUG_TAILCALL_TRY_ALL 1       consider any call followed by ret, can expand later
define DEBUG_TAILCALL 1               low volume logging under -v instead of -v -v

* [Tailcall] Dial back tailcalls on ARM32, where there is no
volatile non-parameter register in the ABI, in which to pass
an extra parameter. (Why not just pass as a regular first/last parameter?)

* [Tailcall] Dial back untested architectures MIPS S390x PowerPC SPARC.

* [Tailcall] Copy tailcall-generic-cast-il.il to tailcall-generic-cast-nocrash-il.il and tailcall-generic-cast-conservestack-il.il

All platforms should be able to run it without crash,
but only some can run it and conserve stack.

* [Tailcall] Finish splitting tailcall-generic-cast into nocrash and conservestack variations.
All platforms can run nocrash, only some conservestack.

* [Tailcall] Nested if and ifdef in certain order do not render well in some editors, so just use if.

* [Tailcall] Fix typo.

* [Tailcall] Disable tailcall-mrgctx.exe and tailcall-rgctxa.exe on ARM32 MIPS PowerPC due to MONO_ARCH_HAVE_VOLATILE_NON_PARAM_REGISTER=0 SPARC has no disabling.
ARM32 is very difficult to fix, maybe not possible.
The other architectures are not tested, so the progress is not enabled.
2018-03-22 14:10:52 -07:00
Ludovic Henry 45c94b22ab [sdks] Fix Android build (#7768) 2018-03-22 16:52:51 -04:00
Marek Safar d856789ccd Bump corefx to bring a fix for #7696 2018-03-22 19:49:07 +01:00
Zoltan Varga 9bc0a49bc7 [runtime] Fix the cross compiler build. (#7754) 2018-03-22 14:33:49 -04:00
Alexis Christoforides 3d2891097a Merge pull request #7748 from lambdageek/fix-gc-descr-object-c
[metadata] Move mono_class_compute_gc_descriptor back to object.c
2018-03-22 13:59:42 -04:00
monojenkins 3283af3449 [msvc] Update csproj files 2018-03-22 18:00:21 +01:00
jaykrell 3ec9fda371 [System.Core] Guard against embedded NUL in strings for MemoryMappedFiles (#7318) 2018-03-22 17:32:06 +01:00
Alexis Christoforides 6822a57663 Disable a flaky test.
https://github.com/mono/mono/issues/7568
2018-03-22 11:58:01 -04:00
Marek Safar 54e3eccc5d [build] Bump bootstrap mcs dependency for mcs builds to catch up with e6fb82b2c7 2018-03-22 16:37:17 +01:00
Bernhard Urban 99d31278e3 [interp] always set old_frame in interp_entry (#7757)
fixup for https://github.com/mono/mono/pull/7747
2018-03-22 10:34:23 -04:00
Zoltan Varga c2698519b0 [interp] Allocate ThreadContext structures on the heap instead of on the stack, the latter doesn't work in mixed mode if the native frame gets unwound during exception handling, so the set_context (NULL) call is never executed, leaving a dangling ref in the tls variable. (#7747) 2018-03-21 21:25:21 -04:00
Filip Navara 678576f5a8 [System.Windows.Forms] Reset check state of item when removing it. (#7744)
* Reset checked state when removing an item from CheckedListBox.

* Bump API snapshot submodule
2018-03-22 02:11:54 +01:00
Zoltan Varga 87fd071412 Revert "Swap Close/Dispose calls so that the receiver_thread_main loop will be properly interrupted (#7390)" (#7745)
This reverts commit e7ba41d14c.
2018-03-21 17:23:57 -04:00
monojenkins 9b702e8052 Bump API snapshot submodule 2018-03-21 22:17:44 +01:00
Marek Safar e6fb82b2c7 Bump bootstrap dependency 2018-03-21 22:17:44 +01:00
Marek Safar 7a9f8405d4 [corlib] String from CoreFX/CoreRT 2018-03-21 22:17:44 +01:00
Marek Safar 20ba08543e [corlib] Use UTF8 bytes convertor directly 2018-03-21 22:17:44 +01:00
Ludovic Henry d9e3d7c407 Remove dead code (#7738) 2018-03-21 16:29:59 -04:00
brianradunity c732bd4758 This fixes an issue we are seeing with VSTU debgugging in Unity. (#7634)
process_breakpoint() will process breakpoint, stepping, and method
exit/entry events all at the same time when checking a sequence point.
So, if there is is a breakpoint and a stepping event at the same time,
the debugger agent will suspend the current thread twice, which means
you have to click the step button in the debugger client twice on that
line.  Considering only one of these events at a time seems to fix
the issue without breaking any current unit tests or showing any other
noticeable issues in testing.
2018-03-21 16:01:13 -04:00
Katelyn Gadd 7faa462046 Fix bug #60843 and add test (#7640)
* Fix bug #60843 and add test:
If an enum was nested inside a generic class, using it as an argument to a custom attribute would cause a runtime error in the custom attribute decoder. Update the decoder to forward this special case through the normal primitive loading path.

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

* Update based on PR feedback

* Don't use caller info attributes since FullAOT does not have them

* Revert "Don't use caller info attributes since FullAOT does not have them"

This reverts commit 316afb686363ef0e46c15d5858bbc1b85ffd5264.

* Fix embarassing bug in test case

* Update outdated test category name

* Disable bug 60843 test in interpreter
2018-03-21 16:00:17 -04:00
Jonathan Chambers d26fb8a3eb Forward mono_string_new_wrapper to mono_string_new for error handling. (#7718)
In commit 8ba48b5a41
mono_string_new was adjusted to only assert for
out of memory rather than all errors to preserve
previous behavior for invalid strings. This
change preserves behavior for mono_string_new_wrapper.
2018-03-21 15:56:56 -04:00
Alexander Köplinger d5d1fb290d Bump roslyn-binaries to include missing file 2018-03-21 20:45:15 +01:00
Marek Safar dd09fa9982 [mcs] Adds cloning for TupleLiteralElement expressions (#7746)
Fixes #7729
2018-03-21 13:32:00 -04:00
pascalhaakmat 3fa3592376 Uncomment and fix ServiceHost creation via ServiceFactory in SvcHttpHandler.cs (#3465)
This commit allows customization of WCF service creation via the Factory attribute in an .svc file:

`<%@ ServiceHost Language="C#" Service="CustomService" Factory="CustomServiceHostFactory" %>`

All the patch does is uncomment a few lines that were already there and fix a small error. I am not sure why these lines were commented. Possibly the code is not sufficiently robust or it was just never given another look. But this works for me and it seems better than no support at all. For example, a custom ServiceHostFactory appears to be the only way to create a WCF service in a managed host which customizes EndpointDispatcher.AddressFilter and EndpointDispatcher.ContractFilter. This in turn is useful for proxied WCF services.

See also http://mono.1490590.n4.nabble.com/Mono-WCF-ServiceHost-Factory-option-td4251992.html (from 2012; never posted on the mailing list for some reason).
2018-03-21 18:09:45 +01:00
Aleksey Kliger 74dd088d40 [metadata] Add mono_class_publish_gc_descriptor
Setter for MonoClass:gc_descr and MonoClass:gc_descr_inited fields.
2018-03-21 12:53:25 -04:00
Marek Safar f42fdeca61 [mcs] Fixes codegen for null fixed string statement 2018-03-21 17:37:22 +01:00
Aleksey Kliger 8e3be15335 [metadata] Move mono_class_compute_gc_descriptor back to object.c
Partially revert 2713dfc577,
but preserve 523ba159c2
2018-03-21 12:20:22 -04:00
Marek Safar 9e4eb1ca69 Bumps roslyn to 2.7.0 2018-03-21 17:15:37 +01:00
Bernhard Urban dc0cf83b3a [arm] fix stack alignment for structs (#7691)
fixes https://github.com/mono/mono/issues/7449
2018-03-21 11:49:11 -04:00
Vlad Brezae 0dec8fda18 [sgen] Fix scanning of large arrays (#7672)
The previous code was handling only objects residing in 2 32bit card protected address spaces. This means card table scanning for objects larger than 4GB was potentially broken, while card scanning of objects larger than 8GB was completely broken.

Fixes https://github.com/mono/mono/issues/7537
2018-03-21 11:48:25 -04:00
Alexis Christoforides 39c9f9d935 Merge pull request #7724 from lewurm/wildcardconnect-watchos
[HttpClientTest] remove WildcardConnect () on WatchOS
2018-03-21 11:15:31 -04:00
Aleksey Kliger (λgeek) e40c97e771 [interp] Disable pinvoke3.exe test on x64 (#7739) 2018-03-21 10:59:27 -04:00
jaykrell 06463f4ca2 [Tailcall] Add interface tailcall tests, and generics thereof. (#7703)
These all fail on Mono (the conservestack tests).
All but one succeeds on desktop.
2018-03-21 10:49:38 -04:00
Filip Navara 9914517a12 Remove obsolete code for getting TLS values from other threads. (#7714)
* Remove obsolete code for getting TLS values from other threads.

* Remove more unused mono_mach_* functions.
2018-03-21 10:17:22 -04:00
Bernhard Urban 9fe7008d97 [HttpClientTest] remove WildcardConnect () on WatchOS 2018-03-20 23:33:16 +01:00
Alexis Christoforides 7dea71ce64 Touchup for https://github.com/mono/mono/pull/7599/ 2018-03-20 18:27:28 -04:00
monojenkins 3766089898 Merge pull request #7599 from lambdageek/abort-cctor-no-protection
[threads] Delay abort via handler block guard when in abort protected block.

`mono_install_handler_block_guard` is called when we want to signal an async
abort to another thread.  In case the other thread is executing native code
while in a `finally` block, the handler block guard sets a byte in the finally
block that used to trigger a self abort (`mono_thread_self_abort`).

This PR renames `mono_thread_self_abort` to
`ves_icall_thread_finish_async_abort`.  It also changes the code from
immediately executing a synchronous abort, to checking whether we are in an
abort protected block (most commonly - whether we were called from a cctor) and
in that case merely toggling the "async interrupt"
MonoInternalThread:thread_state bit.  If we're not in an abort-protected block,
trigger a self interrupt (which will turn into an abort exception in the
icall wrapper of `ves_icall_thread_finish_async_abort`).

Fixes #7588
2018-03-20 18:16:05 -04:00
Alexis Christoforides f617929e9e [runtime] Don't use clock_gettime on WatchOS and tvOS. 2018-03-20 17:25:17 -04:00
Alexander Köplinger 081c79e687 Add csc-dim script to .gitignore 2018-03-20 21:40:36 +01:00
Alexis Christoforides 7cc78d08b0 Merge pull request #7707 from mono/fix-boottime-osx-10.7
[runtime] Don't use clock_gettime in MacOS.
2018-03-20 16:11:25 -04:00
Filip Navara 9cf2550ba2 Update man page, MONO_DISABLE_AIO is now MONO_ENABLE_AIO. (#7715) 2018-03-20 15:35:19 -04:00
Vlad Brezae 16e6e7df70 [sgen] Finish thread pool work before shutting down threads (#7647) 2018-03-20 15:08:28 -04:00
Martin Baulig e480620040 [System]: Fix a race condition that was exposed by #7358 (see #7668).
The latest `WebCompletionSource<T>` changes (PR #7358) exposed and
intensified the side-effects of a race condition between `WebOperation`
and `ServicePointScheduler`.

* WebCompletionSource<T> now contains new `CurrentResult` and `CurrentStatus`
  properties, which allow completion status to be checked in a non-blocking way.

* WebOperation.CompleteResponseRead() has been renamed into Finish() and
  contains the continuation that was previouly known as FinishReading().
  Calling this new Finish() method will now complete the `finishedTask`
  completion, which has a new accessor called `Finished`.

* The ServicePointScheduler's main-loop is still woken up by completion of
  `WebOperation.Finished.Task`, but we use the new `CurrentResult` property
  to check state in a non-blocking way.  This ensures the the clean-up and
  bookkeeping work that's necessary after `WebCompletion.Finish()` always
  happens prior to starting new connections.
2018-03-20 16:55:25 +01:00
Zoltan Varga 120aa248fa [sdks] Fix building the ios device tests. (#7706) 2018-03-20 11:54:28 -04:00
Bernhard Urban a5c6f5c5ca [w32file] do not discard sub-second resolution for access- and writetime if possible (#7650)
* [w32file] remove unused mono_w32file_get_times ()

* [w32file-unix] replace SECMULT with TICKS_PER_SECOND

* [w32file-unix] use CONVERT_BASE in more places

* [w32file-unix] factor setfiletime

* [w32file-unix] use utimes if available in order to set subsecond information on access and write time

* [FileTest] add regression test for github issue 7646

* [w32file-unix] reduce compiler warnings

* [w32file-unix] 1000ns = 1us and 1us = 10ticks

* [w32file-unix] add LL suffix to constant in order to prevent overflowing on 32bit systems
2018-03-20 11:34:46 -04:00
Alexander Kyte b37166882d [runtime] Fix file handle leak with dedup+aot (#7694) 2018-03-20 11:29:06 -04:00
Alex Rønne Petersen feb8b568ba [mprof-report] Fix reading of TYPE_JITHELPER events in v13 files. (#7677)
This is the same fix as in 76d7ab281d.

Fixes #7613.
2018-03-20 11:27:53 -04:00
Aleksey Kliger (λgeek) b77313855c [loader] Don't load framework Facade assemblies that are older than expected. (#7663)
* [loader] Don't load framework Facade assemblies that are older than expected.

If there is an older framework Facade assembly in the search order before the
one that we want, don't load it.

"older" here means just compare the major components of the version.

Fixes https://github.com/mono/mono/issues/7624
2018-03-20 10:33:44 -04:00
Alexis Christoforides 62921c8a62 [runtime] Don't use clock_gettime in MacOS.
Even though it's found during configure when targetting 10.7, it's not "really" available before versions 10.12 and it would crash with "lazy symbol binding failed".
2018-03-20 10:17:07 -04:00
Ankit Jain 7528656820 [msbuild] Bump msbuild to pick up fix for issue #7184 (#7665)
MSBuild always recompiles project if it has a resx with a windows path.
https://github.com/mono/mono/issues/7184
2018-03-20 13:57:43 +01:00
Zoltan Varga 53a59ccf76 [sdks] Fix building the ios tests. (#7701) 2018-03-20 08:04:05 -04:00
Alexander Köplinger 1c8b460b4c [version.h] Support .git being a submodule (#7689)
When mono is used as a submodule then .git will be a file instead of a
directory. Adjusted the version.h generation code to support that.

Also newer git version started to use `(HEAD detached at <git sha>)`
in `git branch` output instead of `(detached from <git sha>)`,
fixed the regex to support that pattern too.
2018-03-20 11:30:42 +01:00
Marek Safar e99ac890e6 Add csc-dim as a prototype if default interface implementation 2018-03-20 09:13:15 +01:00
Zoltan Varga 7aeaafd281 [runtime] Fix mono_msec_boottime () so it compiles on older ios versions, clock_gettime () is only available from ios 10. (#7671) 2018-03-19 21:05:45 -04:00
Rolf Bjarne Kvinge 8ae317a1e8 [arm64] Add a known TLS offset. (#7530) 2018-03-19 18:15:57 -04:00
jaykrell b6f56a115f [Tailcall] Cleanup, handle varargs, cleanup varargs handling, be sure not to use unsupported tailcall_membase, pass r11 through, align patches. (#7600)
* [Tailcall] Cleanup is_supported_tail_call to only check virtual_, not opcode == CALLVIRT.

* [Tailcall] Generate tailcall address earlier to honor NT ABI.
Let R11 through tailcall.
Assert alignment when patching.

* [Tailcall] Factor out two copies of SysV varargs handling to a helper function and remove for NT.
Tailcall needs a third instance, and it likely gets in the way of NT tailcall, where it is not needed.

* [Tailcall] Teach amd64_patch how to patch jmp rip+32 and jmp [rip + 32]
very similar to call rip+32 and call [rip + 32]. This might be useful.

* [Tailcall] Fix varargs handling of tailcalls.

* Remove new asserts and just leave comments.

* [Tailcall] No need to free RAX on non-reg calls.
2018-03-19 14:13:03 -07:00
Marek Safar 249a02d936 Updates codeowners (#7679) 2018-03-19 12:10:42 -04:00
Alexis Christoforides 5232bef282 Disable a flaky FileSystemWatcher test (#7578) 2018-03-19 15:42:23 +01:00
Brian Raderman 540ef385fa If a bad header is received from the client or the connection is broken,
send an internal VM_DISPOSE command to shut down the debugger thread
properly.  This prevents runtime hangs that occur during profile
events after the debugger shuts down.
2018-03-19 13:39:55 +01:00
davidlsharp1 68a9bbe69f Update Server.py to run on both python 2 and 3
just a small adjustment so users with both python 2 and 3 should be able to use the server.py
2018-03-19 10:25:52 +01:00
Alexis Christoforides 2f21177019 Merge pull request #7584 from alexischr/fix-gh-6940
[System.Net] Replace use of obsolete `SupportsIPv6` property.
2018-03-16 19:14:42 -04:00
Miguel de Icaza fe3c5134bf Implement C#7 binary literals (#7659)
* C# 7.0 binary literal support

* [mcs] Add another negative error test
2018-03-16 23:10:23 +01:00
Filip Navara 421e017479 [System.Windows.Forms] Fix bounds manipulation in Control.DrawToBitmap (#7629)
* Fix bounds manipulation in Control.DrawToBitmap and dispose objects properly.

* Add test for DrawToBitmap and fix one more bug in the implementation.

Fixes #7620
2018-03-16 23:05:27 +01:00
Ludovic Henry d3e2518fb6 [sdks] Fix concurrent building of MonoAotOffsetsDumper.exe + Simplify building of support library (#7652)
* [sdks] Simply building of support library

* [sdks] Fix concurrent building of MonoAotOffsetsDumper.exe

* [sdks] Cleanup of some targets
2018-03-16 14:26:15 -04:00
Vlad Brezae e36148dbd2 [tests] Prevent starvation by thread doing GCs (#7651)
On macOS the stopwatch's elapsed time was regularly getting skewed by 200-800ms. On average, yielding decreases the number of GCs by only 25%, while the elapsed time error is always less than 15ms.

Fixes #6999
2018-03-16 18:41:03 +01:00
Alexis Christoforides ec4c990af3 [System.Net] Replace use of obsolete SupportsIPv6 property.
The obsolete property was always set to false. Fixes https://github.com/mono/mono/issues/6940
2018-03-16 12:23:45 -04:00
Aleksey Kliger 43415f5f2b [threads] Add mono_uninstall_current_handler_block_guard
When a thread has a handler block guard installed (a `finally` block
that checks the exvar to see if it should issue abort the thread because
another thread called Abort on it), ves_icall_thread_finish_async_abort
is called.  It must clear the handler block guard for the current thread
in case the abort landed while we're in an abort protected block (a
cctor, most commonly).  In that case we must resume the interruption
when we leave all the abort protected blocks, not just at the end of an
intermitent catch clause.
2018-03-16 12:05:40 -04:00
Aleksey Kliger 92042c9732 [threads] Delay abort via handler block guard when in abort protected block.
mono_install_handler_block_guard is called when we want to signal an async
abort to another thread.  In case the other thread is executing native code
while in a `finally` block, the handler block guard sets a byte in the finally
block that used to trigger a self abort (`mono_thread_self_abort`).

This PR renames `mono_thread_self_abort` to
`ves_icall_thread_finish_async_abort`.  It also changes the code from
immediately executing a synchronous abort, to checking whether we are in an
abort protected block (most commonly - whether we were called from a cctor) and
in that case merely toggling the "async interrupt"
MonoInternalThread:thread_state bit.  If we're not in an abort-protected block,
trigger a self interrupt (which will turn into an abort exception in the
icall wrapper of `ves_icall_thread_finish_async_abort`).
2018-03-16 11:54:45 -04:00
Aleksey Kliger b0734593de [tests] Run abort-cctor.exe on the coop Jenkins job 2018-03-16 11:54:44 -04:00
Ludovic Henry ea4274f2eb Revert "[Tailcall] Proper fix for F# regression." (#7656)
This breaks ARM, I merged the previous PR too soon.

* Revert "[Tailcall] Proper fix for F# regression. (#7621)"

This reverts commit b2271853c3.
2018-03-16 11:54:05 -04:00
monojenkins fdbf51184a [msvc] Update csproj files (#7654) 2018-03-16 16:47:42 +01:00
jaykrell b2271853c3 [Tailcall] Proper fix for F# regression. (#7621)
* Revert "[Tailcall] Quick fix for building F#. Do not tailcall any method with a vtable_arg. (#7609)"

This reverts commit 8ceead93e3.

* [Tailcall] Correct fix for regression from change b4ee86154f.
Regression test not yet available.

* extra brace

* [jit] Incorrect code under mono --trace.

* [Tailcall] call_opcode == CEE_CALLVIRT does not matter for tailcall_membase, only virtual_ does.

* [Tailcall] Add FIXME for tail. not followed by ret. Correct behavior is to raise an exception, not fail an assert.

* [Tailcall] Add disabled debug code to break when compile a tailcall and/or execute a tailcall.

* [Tailcall] Add disabled debug code to try to tailcall any call followed by a ret.
This might be reasonable in the future, as well as a little data flow
analysis skipping nops and branches, as csc w/o -optimize outputs.

* [Tailcall] Add more tailcall tests, i.e. that would
have caught recent regression.

* [Tailcall] Replace #if 0 with MONO_DEBUG=tailcall_break_compile,tailcall_break_run,tailcall_try_all,tailcall_log,
tailcall_all. Consider MONO_TAILCALL_DEBUG instead.

* Revert "[Tailcall] Replace #if 0 with MONO_DEBUG=tailcall_break_compile,tailcall_break_run,tailcall_try_all,tailcall_log,"

This reverts commit 796d9490f672625189dfac47ff24b05f3fb65cbe.

* [Tailcall] Replace #if 0 with ifdefs:
define DEBUG_TAILCALL_BREAK_COMPILE   breakpoint in method-to-ir
define DEBUG_TAILCALL_BREAK_RUN 1     codegen outputs breakpoint
define DEBUG_TAILCALL_TRY_ALL 1       consider any call followed by ret, can expand later
define DEBUG_TAILCALL 1               low volume logging under -v instead of -v -v

* [Tailcall] Dial back tailcalls on ARM32, where there is no
volatile non-parameter register in the ABI, in which to pass
an extra parameter. (Why not just pass as a regular first/last parameter?)

* [Tailcall] Dial back untested architectures MIPS S390x PowerPC SPARC.

* [Tailcall] Copy tailcall-generic-cast-il.il to tailcall-generic-cast-nocrash-il.il and tailcall-generic-cast-conservestack-il.il

All platforms should be able to run it without crash,
but only some can run it and conserve stack.

* [Tailcall] Finish splitting tailcall-generic-cast into nocrash and conservestack variations.
All platforms can run nocrash, only some conservestack.
2018-03-16 11:27:57 -04:00
Aleksey Kliger 9b3893f84a [tests] Class should be viable even if cctor is aborted in in nested finally clause 2018-03-16 11:27:10 -04:00
Filip Navara 247a13b081 [System.Windows.Forms] Improve logic for closing complex ToolStripDropDown layouts. (#7630)
* Change the logic for closing ToolStrip drop-downs to work for more complex nesting.
* Implement SetOwner/GetParent(with_owner=true) behavior for X11 and Carbon backends.

Fixes the logic for closing ToolStripDropDowns for the following cases:

* ComboBox embedded in ToolStripDropDown as seen in KeePass when the window is resized to be small enough for the toolbar to overflow.
* ToolStripDropDown containing controls that open other ToolStripDropDowns and the user clicks on the top-level ToolStripDropDown. The child ToolStripDropDown, and only that child, should be closed in that case.
2018-03-16 15:32:52 +01:00
Filip Navara 5d23a12446 [System.Windows.Forms] Unify layout engines for Controls and ToolStripItems (#7612)
* Update AnchorLayoutEvents to match Windows behavior, make Bug82762 test platform independent.

* Cache affected layout control and property across SuspendLayout/ResumeLayout.

* Extend AnchorLayoutEvents test.

* Update for little nuances in the layout code.

* Unify flow layout for ToolStrips and FlowLayoutPanel by using the IArrangedContainer and IArrangedElement abstractions.

* Implement basic table layout support for ToolStrips.

* Clean up handling of FlowLayoutSettings.

* Fixes for default values of LayoutSettings in tool strips.

* Remove more of the duct tape holding the ToolStrip layouts together and replace it with calls into the LayoutEngine. Fix other small bugs that prevented ToolStrip overflows from being displayed correctly. Tested with KeePass.

* Fix indentation.

* Address code style issues.

* Remove unnecessary override.

* Fix indentation.

* Bump API snapshot submodule
2018-03-16 12:42:43 +01:00
jaykrell 6bdeea1503 [jit] Incorrect code under mono --trace. (#7627) 2018-03-16 03:06:02 +01:00
Johan Lorensson 395b37c286 Fix issue #7596 on Windows x64. (#7625)
* Fix error in vcxproj filter causing load error in Visual Studio.

* Fixes issue #7596 on Windows x64.

Passing value types in Windows x64 not fitting into register will be passed
by reference (ArgValuetypeAddrInIReg or ArgValuetypeAddrOnStack )
using a local variable allocated in caller’s frame.

Current implementation sized and marshaled the native struct correctly when
using pinvoke, but it sized the final local passed as reference to the native method
using the managed stack size instead of the native. This caused the final copy
into the local to overwrite other locals on stack if managed and native struct stack
sizes differed.

The fix is to flag the local variable used as stack parameter with its pinvoke state.
This makes sure the stack allocation size will be correct when using value types
passed on the stacks in pinvokes.

When running other unit tests with sequence points I hit a similar issue with
empty structs as return parameters (using [StructLayout (LayoutKind.Sequential, Size = 0)].
This commit includes a fix to ignore the return value if it’s an empty struct on Windows x64.
2018-03-15 20:02:06 -04:00
Vlad Brezae 5820d1fc66 [sgen] Use current nursery size when computing allowance (#7601)
* [sgen] Use current nursery size when computing allowance

The allowance is the minimum heap growth that we allow between two majors (which is 4 * nursery_size). We need to use the current nursery size instead of the 4MB default, in order to facilitate low memory uses.

* [sgen] Account for soft heap limit in allowance calculation

This is relevant in cases where the nursery size and soft heap limit are comparable in size.
2018-03-15 19:32:58 -04:00
Alex Rønne Petersen 52429673dc [mini] Don't inline methods if they're going to be instrumented for coverage. (#7554)
* [profiler] Fix wrong docs for mono_profiler_set_call_instrumentation_filter_callback ().

* [mini] Don't inline methods if they're going to be instrumented for coverage.

This handles coverage instrumentation in a similar fashion to call
instrumentation.

Fixes #6186.
2018-03-15 19:30:52 -04:00
Rodrigo Kumpera 851b36ecb2 [mini] Improve error reporting by using MonoError around more places. (#7607)
* [mini] Add MonoError to mini_get_shared_method_full and replace bucket of booleans with a flags enum.

* [mini] Eliminate mini_get_shared_method in favor of the variant that takes a MonoError.

* [mini] Rename GetSharedMethodFlags members to follow our coding conventions.

* [mini] Remove reduntant arguments in get_shared_inst.

* [mini] Inline partial in mini_get_shared_method_full.

* [mini] In mini_get_shared_method_full, rename gsharedvt to use_gsharedvt_inst and move it's value to depend on all_vt.

* [mini] Eliminate SHARE_MODE_ALL_VALUETYPES as its semantically equivalent to SHARE_MODE_GSHAREDVT.
2018-03-15 19:30:04 -04:00
Vlad Brezae 6906c9dc40 [interp] Don't crash when freeing delegate ftnptr (#7586)
* [interp] Don't crash when freeing delegate ftnptr

Leak it for now instead.

* [interp] Enable a few pinvoke tests
2018-03-15 19:13:22 -04:00
Joshua Peterson 2883e562e2 Fix platform-specific build issues (#7342)
* Fix platform-specific build issues

These changes allow some of the Mono code used by the debugger to build
on a few additional platforms. Specifically, this includes platforms:

* That don't have access to the full Win32 API
* That don't have access to the full Posix API
* That don't support IPv6

* Wrap `access` and `_access` in `g_access`

* Convert indentation to tabs

* Wrap `mktemp` and `_mktemp` in `g_mktemp`

* Wrap `open` and `_open` in `g_open`

* Wrap `write` and `_write` in `g_write`

* Fix indentation

* Use proper asserts

* Add a configure check for `access`

* Remove the use of HAVE_XBOXONE_WINAPI_SUPPORT

* Replace the previous definition of `g_open`

I missed that it was here in my earlier commit, and ended up redefining
it.

* Use `g_error` instead of `g_assert(0)`
2018-03-15 19:01:30 -04:00
Zoltan Varga 2d0eee9ae3 [jit] Fix partially shared constrained calls in llvmonly mode. (#7561)
* [tests] Avoid aot-ing the bcl libs twice in make fullaotcheck/llvmonlycheck.

* [jit] Fix partially shared constrained calls in llvmonly mode.

Fixes https://github.com/mono/mono/issues/7535.
2018-03-15 18:47:29 -04:00
Zoltan Varga ec319e6de7 [aot] Increase the buffer size in emit_exception_debug_info (). (#7638)
Fixes https://github.com/mono/mono/issues/7637.
2018-03-15 18:30:51 -04:00
Marek Safar ff61c7751a [build] Fixes mcs only dist build 2018-03-15 22:02:29 +01:00
Martin Baulig 4b88e2a0e2 [System]: Introduce WebCompletionSource<T> and use it in WebOperation. (#7358) 2018-03-15 21:50:32 +01:00
Alexis Christoforides 29c2ba9387 Merge pull request #7520 from alexischr/use-coreclr-GetTickCount
[mono-time] Replace mono_msec_boottime() with CoreCLR implementation.
2018-03-15 08:37:18 -04:00
Marek Safar 7e3a1ddaa0 [mcs] Fixes parsing ref-struct with partial keyword 2018-03-15 13:17:55 +01:00
Zoltan Varga 8728280550 [sdks] IOS fixes. (#7617)
* [sdks] Fix ios build.

* [sdks] Pass -DMONOTOUCH to the ios cross compiler builds. Compile monotouch/tvos/watchos profiles for the bcl build.
2018-03-15 09:07:29 +01:00
Rodrigo Kumpera 40b53bd2e0 [corlib] Handle multiple segments in IsolatedStored::GetFileNames. Fixes bxc #11771 2018-03-15 09:03:01 +01:00
jaykrell 8ceead93e3 [Tailcall] Quick fix for building F#. Do not tailcall any method with a vtable_arg. (#7609)
* [Tailcall] Quick fix for building F#.
Do not tailcall any thing with a vtable_arg.
This does often work, but not in F#, along with unbox in the call target.
The problem is being further reduced and debugged, but this will serve for now.

Regression is from change b4ee86154f.

* [Tailcall] Temporarily disable tests that depend on tailcall.
2018-03-14 19:22:03 -07:00
jaykrell 1c88a11545 [Coop thread threadpool mmap] Convert more functions to coop/handle. (#7097)
* [Coop] ves_icall_System_Threading_Thread_GetDomainID convert to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_ConstructInternalThread to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_Thread_internal to coop/handle.

* [Coop] Convert mono_threads_get_max_stack_size ves_icall_System_Threading_Thread_SystemMaxStackSize/typo SystemMaxStackStize to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_Suspend to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_Sleep_internal to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_SpinWait_nop to coop/handle.

* [Coop] Convert threadpool.c to handles -- no pointers, just MonoError.

* [Coop] Convert ves_icall_System_Threading_InternalThread_Thread_free_internal to coop/handle.

* [Coop] Convert mmap to coop/handle -- where there aren't pointers, just unused errors.

* [Coop] Rename some error to ioerror or win32error.

* [Coop] Convert ves_icall_System_Threading_Thread_current_lcid to coop/handle -- no pointers.

* [Coop] Convert mono_mmap_open_file, mono_mmap_open_handle to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_Yield to coop/handle (no pointers).

* [Coop] Layer ves_icall_System_Threading_Thread_ConstructInternalThread over new mono_thread_construct_internal.

* Ignore out of memory.

* Favor mono_error_set_generic_error over small factories (loss of breakpoint?).

* Restore accidentally lost barrier.

* [Coop] Mostly undo commit d7bdbcc9a2e76913861b69ff106f0bf9573e7ea6
Convert ves_icall_System_Threading_Thread_Sleep_internal to coop/handle.
for now.
It duplicates mono_thread_execute_interruption to mono_thread_execute_interruption_handle
which we want to ensure does not last long.
This should be achieved better by pull
  https://github.com/mono/mono/pull/6639
which removes all but one pointer user and leaves
that pointer user layered over handle instead of duplicating.

* [Coop] Fix Windows build.

* [Tailcall][Windows] Add missing error parameter.
2018-03-14 13:50:10 -07:00
monojenkins 239aad5265 [msvc] Update csproj files 2018-03-14 21:47:30 +01:00
Alex Rønne Petersen 34b4d35fb7 [runtime] Clean up symbol names to not pollute the global namespace.
Offending symbols found with:

    nm -D --defined-only libmonosgen-2.0.so | cut -d ' ' -f 3 | grep -v '^eg_\|mono_\|monoeg_\|wapi_\|ves_icall_\|sgen_\|mini_\|__jit_debug.*$' | sort

Fixes #7565.
2018-03-14 18:50:36 +01:00
Alex Rønne Petersen 1d70b62770 [profiler] Increment ref count of an image's method while we're keeping around pointers to it.
Fixes #6211.
2018-03-14 18:34:50 +01:00
Bernhard Urban 6b116cca18 [merp] only target macOS, HOST_DARWIN includes iOS etc. as well 2018-03-14 09:13:53 +01:00
Marek Safar 40924c47ba [Mono.Data.Sqlite] Throw better exception for missing mobile support 2018-03-14 07:44:47 +01:00
jaykrell a856f8d8e4 [Tailcall] Cleanup is_supported_tail_call, put more logic in it, and be sure not to tailcall_mem_base if not supported (i.e. virtual_ not just CALLVIRT) (#7608)
* [Tailcall] Cleanup is_supported_tail_call to use language-base short circuit.

* [Tailcall] Move more of the logic into is_supported_tail_call.

* [Tailcall] Be sure not to use TAILCALL_MEM_BASE if not supported.
i.e. not if virtual_, besides CALLVIRT -- they are not quite the same.
2018-03-13 22:19:20 -07:00
Alexander Köplinger 7e7d8a3b4f [Facades] Make System.Net.Http.Rtc.dll a net_4_x only facade (#7590)
* [Facades] Make System.Net.Http.Rtc.dll a net_4_x only facade

It doesn't make sense on mobile (see https://github.com/mono/mono/pull/7541#issuecomment-372434424) but we'd like to keep it in net_4_x to match Desktop .NET

* Bump API snapshot submodule
2018-03-13 18:30:09 +01:00
monojenkins 5f572ff7a6 [msvc] Update csproj files 2018-03-13 17:36:22 +01:00
Alexander Köplinger 6e246cf613 [Facades] Move types from Facades into class libraries (#7574)
We implemented them in the facades until now but in .NET 4.7.1
they were promoted into the regular class libraries.

Use PLATFORM_DEBUG_FLAGS for IL-less assemblies

Also replace some files with corefx that were identical.
2018-03-13 12:28:43 +01:00
Marek Safar 4e3389667f [System.Xml] Update source file location from commit d4816ef1ab 2018-03-13 08:49:00 +01:00
Filip Navara 8c3d7c81af [System.Windows.Forms] Fix custom test targets in makefile. (#7571)
* Fix test builds to include mscorlib.

* Disable PrintPreviewControlTest on machines without an installed printer.

* Fix test ignore condition.
2018-03-12 20:33:47 +01:00
Filip Navara 9dbd080c29 [System.Windows.Forms] Update code for top-level windows (#7570)
* Fix the test for OnCreateControl.

* Do not create child controls until the parent is created.

* Fix showing menus after CreateControl behavior change.

* Make all top-level controls call SetTopLevel.

* Fix TopLevelControl property to actually return top-level controls, not just Forms.
2018-03-12 17:18:36 +01:00
Alexis Christoforides e85dbca0f2 Disable TestBug8592BasicOperations test
https://github.com/mono/mono/issues/7343
2018-03-12 11:57:39 -04:00
Filip Navara b1d2b85825 Make Form scaling tests platform independent. 2018-03-12 16:09:18 +01:00
Yauheni Pakala cdb9b90baa Correcting typos for ISSUE_TEMPLATE.md (#7575) 2018-03-12 15:52:53 +01:00
monojenkins 99198da52b [msvc] Update csproj files (#7559) 2018-03-12 13:23:03 +01:00
Alexis Christoforides 16b3884854 Disable bug-80307.exe
https://github.com/mono/mono/issues/7568
2018-03-12 01:28:01 -04:00
Zoltan Varga a601516ca1 [tests] Disable delegate-15.exe in the full-aot profile. (#7529)
* [jit] Avoid calling mono_class_vtable () for open constructed types.

* [tests] Disable delegate-15.exe in the full-aot profile.
2018-03-11 11:05:04 -04:00
Zoltan Varga 8f926ed464 [ppdb] Set the column number in mono_ppdb_lookup_location ().
Fixes https://github.com/mono/mono/issues/6812.
2018-03-11 09:47:14 +01:00
Jonathan Chambers 78de671964 Swap bytes for port number as Win32 API returns in network order. 2018-03-11 09:44:32 +01:00
Calvin 3b0c0bd1cf Build system tweaks for AIX (#7542)
* use this version of libintl because that's what GNU uses

	* tweak BTLS CFLAGs to make it work and be coonsistent
2018-03-10 14:47:48 +01:00
jaykrell 486036b696 Revert "[Tailcall] Do not create never-executed trampoline for tail.call self. (#7331)" (#7550)
This reverts commit 8e4f0d8ff4.
2018-03-10 13:03:22 +01:00
Alexis Christoforides 06a4273d73 [mono-time] Replace mono_msec_boottime() with CoreCLR implementation. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58413 2018-03-10 00:30:42 -05:00
Alexander Köplinger e456f91053 Bump api-snapshot 2018-03-10 04:16:18 +01:00
Alexander Köplinger 9a2b5324ee [Facades] Add missing Facades that exist in .NET 4.7.1 (#7541)
Some of them we had on mobile only, others were missing completely.

Fixes https://github.com/mono/mono/issues/7536
2018-03-10 04:08:53 +01:00
Aleksey Kliger (λgeek) b6be2e11a7 [threads] Fix race between abort socket syscall and thread shutdown (#7507)
* [threads] Fix race between abort socket syscall and thread shutdown

The race happens when we call mono_thread_info_abort_socket_sycall_for_close on
a thread that's about to shut down.

We lookup the MonoThreadInfo for that thread outside the
mono_thread_info_suspend_lock, and then use it to send the signal once we've
taken the lock.

In between those two actions, the other thread already finished
unregister_thread and pthreads may already have destroyed its TLS keys and
otherwise started to dismantle the thread.

The fix is to do a second mono_thread_info_lookup once we have the lock and
only signal the other thread if it still around.

Fixes https://github.com/mono/mono/issues/6998

* [threads] Simplify mono_thread_info_abort_socket_syscall_for_close

Call mono_thread_info_lookup while holding the thread info suspend lock.
We no longer need to check for STATE_DETACHED because removing MonoThreadInfo on
detach is done while holding the suspend lock.
2018-03-09 17:53:59 -05:00
Alexis Christoforides 4ae98fb31b Merge pull request #7515 from kumpera/le_debugger_cleanup
[WASM] Initial code drop for debugger
2018-03-09 16:28:02 -05:00
Bernhard Urban 868a402137 [metadata] split IL generation code into seperate compilation units. (#7487)
* [metadata] split IL generation code into seperate compilation units.

* [metadata] move ENABLE_ILGEN definition to configure

* [metadata] split IL generation code into seperate compilation units.

By adding callbacks for IL generating runtime code, we can link in code
later into the runtime that does such for configurations which do not
need IL generation initially. This is the case if you configure the
runtime with `--enable-minimal=jit,interpreter`.

In such configuration, the build will produce an additional library,
called `libmono-ilgen`.

An embedded can choose to link this library to the final binary and
initialize IL generation with the following three, newly added, API
calls:

* `void mono_marshal_ilgen_init (void)`
* `void mono_method_builder_ilgen_init (void)`
* `void mono_sgen_mono_ilgen_init (void)`

This change is mostly moving code around, but there are minor changes
like introducing the enum `MarshalTypeCheckPositions`, so we avoid
copy/paste constants accross compilation units.

* [windows] add IL gen files to windows build and set ENABLE_ILGEN

* [fixup!] fix windows build

* [fixup!] resolve merge conflicts with class getter commits

* marshal.c: b8da973620
* sgen-mono.c: 8ba4947f7a

at some point I gave up to resolve merge conflicts and worked through
errors/warnings by compiling with
> `CFLAGS=-DENABLE_CHECKED_BUILD_PRIVATE_TYPES=1`
so the result is likely a bit different

* redo lost changes from 57f3f34e60

* redo lost changes from 52514effbf

* [fixup!] fix array marshal

* [method-builder] use eglib types

review comment by Ludovic,
https://github.com/mono/mono/pull/7375#discussion_r171876337

* [marshal] remove stelem strings from header

review comment by Rodrigo,
https://github.com/mono/mono/pull/7375#discussion_r171921029
2018-03-09 14:19:04 -05:00
Vlad Brezae 826f15a509 [interp] Fix return of value type from interp to native (#7519)
Fixes test_0_marshal_struct_delegate
2018-03-09 14:13:26 -05:00
jaykrell f24a6d622b gboolean g_is_usermode_native_debugger_present (void). (#7488)
* gboolean g_is_usermode_native_debugger_present (void).
i.e. Win32 IsDebuggerPresent which is just call mov mov ret.
Other slower methods on other systems if possible and unintrusive (OSX).
This is very useful as in:
   if (g_is_usermode_native_debugger_present ()) G_BREAKPOINT
"native" meaning "not managed"
"usermode" meaning "not kernel"
Both other kinds exist and are detected differently.

* Move new debugging utility from glib to mono/utils.

* Redo it with CoreCLR as basis. https://github.com/dotnet/coreclr/blob/master/src/pal/src/init/pal.cpp

* Link to a specific stable revision, not master.
https://raw.githubusercontent.com/dotnet/coreclr/f1c9dac3e2db2397e01cd2da3e8aaa4f81a80013/src/pal/src/init/pal.cpp

* Use a clearer form of boolean normalization.

* Update Visual Studio project files.

* Fix include path, remove unnecessary boolean canonicalization, spell out words, swap int/boolean.

* Header got missed in the move from glib.
2018-03-09 14:12:27 -05:00
Alexander Kyte 03914603a3 [runtime] Add MS telemetry reporter for unmanaged exceptions (#7451)
* [runtime] Add optional Microsoft Telemetry unmanaged dumper

* [runtime] Add icall to configure MERP options / enable it
2018-03-09 11:07:33 -05:00
Alexis Christoforides d3a4e19f3c Merge pull request #7533 from akoeplinger/disable-test
[System] Disable SocketTest.AcceptBlockingStatus
2018-03-09 10:33:55 -05:00
Alexander Köplinger 63e5e80d3a [bcl] Fix test build with mcs (#7512)
It'd fail with the following errors since e6de24c2d1:

```
MCS     [net_4_x-darwin] net_4_x_System.Data.OracleClient_test.dll
Test/System.Data.OracleClient.jvm/MonoTests.System.Data.Utils/ADONetTesterClass.cs(337,71): error CS0012: The type `System.Xml.Serialization.IXmlSerializable' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

...

MCS     [net_4_x-darwin] net_4_x_System.Json.Microsoft_test.dll
Test/System.Json/JsonValueTest.cs(23,12): error CS0012: The type `System.Dynamic.IDynamicMetaObjectProvider' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

...

MCS     [net_4_x-darwin] DummyAssembly.dll
error CS0518: The predefined type `System.Object' is not defined or imported
error CS0518: The predefined type `System.ValueType' is not defined or imported
```

* [ci] Add compiling class lib tests to mcs job
2018-03-09 14:41:24 +01:00
Filip Navara 14485be705 [System.Windows.Forms] Fix lifetime of Graphics objects in TextBox controls (#7491)
* Avoid recalculating Document on TextBox controls without handles. Properly dispose graphic contexts.

* Make sure all CreateGraphics calls are wrapped in using block.

* Avoid a couple more no-op calls in RichTextBox.
2018-03-09 14:24:57 +01:00
Alexander Köplinger b9d52fc4f1 [System] Disable SocketTest.AcceptBlockingStatus
It frequently fails on ARM: https://github.com/mono/mono/issues/6513
2018-03-09 14:12:39 +01:00
Filip Navara 91b64b4560 [System.Windows.Forms] Fix bugs in PrintPreviewControl. (#7493)
* Fix default values and the StartPage property in PrintPreviewControl.

* Do not cache resized bitmaps in PrintPreviewControl if the source data are scalable metafiles.
2018-03-09 14:12:19 +01:00
Jonathan Chambers ee30689c18 Implement native ValueType Equals and GetHashCode support for pointer fields 2018-03-09 14:11:26 +01:00
Vlad Brezae 4532cf5fd5 [interp] Fix stack usage after throw (#7461)
* [interp] Use jit's dead basic block detection

Using generating_code doesn't cover all cases since it doesn't do basic block liveness calculation.

* [interp] Throw instructions clear the stack

* [interp] Add stack check at return
2018-03-09 14:39:58 +02:00
Zoltan Varga 523ba159c2 [sgen] Fix the clearing of bits in the gc descriptor bitmap when using weak fields.
Fixes https://github.com/mono/mono/issues/7378.
2018-03-09 13:30:57 +01:00
Ludovic Henry 660e166c7b [eglib] Fix typo in g_assertf (#7458) 2018-03-08 19:15:00 -05:00
Zoltan Varga c745a9575d [jit] Move the check for open constructed types later in mono_jit_compile_method_with_opt (), this function can receive (#7494)
gshared methods in llvmonly mode.

Fixes https://github.com/mono/mono/issues/7364.
2018-03-08 19:10:12 -05:00
Rodrigo Kumpera 25f4ef2789 [wasm] Make switching between debug/release builds easy. Build pdb files. 2018-03-08 15:12:29 -08:00
Rodrigo Kumpera eba41fd88a [wasm] Update SDK driver to handle debugging. 2018-03-08 15:11:56 -08:00
Rodrigo Kumpera 334ddbd3ef [wasm] Initial support for debugging. 2018-03-08 15:09:09 -08:00
Rodrigo Kumpera 1a56fe6a15 [wasm] Fix unwinding to work with the general unwinder. 2018-03-08 15:03:59 -08:00
Vlad Brezae ccbb873498 [interp] Fix pinvoke from dynamic methods
Fixes test_0_calli_dynamic
2018-03-09 00:36:33 +02:00
Vlad Brezae 4ad92ef05f [interp] Fix detection of pinvoke call 2018-03-09 00:36:33 +02:00
Vlad Brezae 940f2d1a9f [interp] Fix runtime invoke of pinvoke method 2018-03-09 00:36:33 +02:00
monojenkins e0f8597e9c Fix generated file when passing --bundled-header (#6736)
There would be a compilation error in the XA build as follow:

```
obj/Release/bundles/armeabi-v7a/temp.c: In function 'install_aot_modules':
obj/Release/bundles/armeabi-v7a/temp.c:49:25: error: 'MONO_AOT_MODE_NORMAL' undeclared (first use in this function)
  mono_jit_set_aot_mode (MONO_AOT_MODE_NORMAL);
                         ^
obj/Release/bundles/armeabi-v7a/temp.c:49:25: note: each undeclared identifier is reported only once for each function it appears in
```
2018-03-08 17:20:29 -05:00
jaykrell b4ee86154f [Tailcall] tail.callvirt support for AMD64 JIT (#7426)
* [Tailcall] Fix the F# code; let rec functiona ()= printfn "%d" 1; functionb ()
	and functionb ()= functiona ()
	let ()= functiona ()

The test case and the fix are from https://bugzilla.xamarin.com/show_bug.cgi?id=25224.

Just bringing in change ca0dd5c0bb:
	commit ca0dd5c0bb
	Author: Zoltan Varga <[email protected]>
	Date:   Thu Dec 11 15:37:29 2014 -0500
	[jit] Enable tail calls from gshared code. Fixes #25224.

Previously it was reverted due to performance regression, which has been fixed.
The problem was that use vs. patch of jmps was using inflated vs. non-inflated code.
Fixed here: https://github.com/mono/mono/commit/fe95e4b34b00caa8073dfa3b4473a43182abcbbb

The IL is:
  .method public static !!a  functiona<a>() cil managed
  {
.
.
.
    IL_001d:  tail.
    IL_001f:  call       !!0 '1'::functionb<!!0>()
    IL_0024:  ret
  }

  .method public static !!a  functionb<a>() cil managed
  {
    IL_0000:  tail.
    IL_0002:  call       !!0 '1'::functiona<!!0>()
    IL_0007:  ret
  }

* [Tailcall] Add tail.callvirt support to AMD64 JIT. Not yet
any other architecture (arm, x86, etc.) or scenario (AOT, LLVM,
interpreter, etc.)

This is based on F# that stack overflows to report failure:
    type A() =
        member this.f2 (a) = if a > 0 then this.f1(a - 1)
                             else 1
        member this.f1 (a) = if a > 0 then this.f2(a - 1)
                             else 2

    let a = A()
    printfn "%d" (a.f1(1000 * 1000 * 10))

and in turn C#, self checking instead of stack overflowing:

    using System;
    using System.Runtime.CompilerServices;
    using static System.Runtime.CompilerServices.MethodImplOptions;

    unsafe class A
    {
        static int check (long stack1, long stack2)
        {
            return (stack1 == stack2) ? 0 : 1;
        }

        [MethodImpl (NoInlining)]
        public virtual int f1 (int counter, long initial_stack, long current_stack)
        {
            int local;
            if (counter > 0)
                return f2 (counter - 1, initial_stack, (long)&local);
            return check ((long)&local, current_stack);
        }

        [MethodImpl (NoInlining)]
        public virtual int f2 (int counter, long initial_stack, long current_stack)
        {
            int local;
            if (counter > 0)
                return f1 (counter - 1, initial_stack, (long)&local);
            return check ((long)&local, current_stack);
        }

        [MethodImpl (NoInlining)]
        public static void Main ()
        {
            int stack;
            Environment.Exit (new A().f1 (100, (long)&stack, 0));
        }
    }

And then IL, inserting tail prefixes and cleaning up a little:

    .assembly extern mscorlib { }

    .assembly b { }

    .class A
    {
    .method static int32 check(int64 stack1, int64 stack2)
    {
            ldarg.0
            ldarg.1
            beq.s IL_0006
            ldc.i4.1
            ret

    IL_0006:
            ldc.i4.0
            ret
    }

    .method newslot virtual instance int32 f1 (int32 counter, int64 initial_stack, int64 current_stack) noinlining
    {
	    .locals init (int32 V_0)
	    ldarg.1
	    ldc.i4.0
	    ble.s IL_0013

	    ldarg.0
	    ldarg.1
	    ldc.i4.1
	    sub
	    ldarg.2
	    ldloca.s V_0
	    conv.u
	    conv.u8
	    tail. callvirt instance int32 A::f2 (int32, int64, int64)
	    ret

    IL_0013:
	    ldloca.s V_0
	    conv.u
	    conv.u8
	    ldarg.3
	    tail. call int32 A::check (int64, int64)
	    ret
    }

    .method newslot virtual instance int32 f2 (int32 counter, int64 initial_stack, int64 current_stack) noinlining
    {
	    .locals init (int32 V_0)
	    ldarg.1
	    ldc.i4.0
	    ble.s IL_0013

	    ldarg.0
	    ldarg.1
	    ldc.i4.1
	    sub
	    ldarg.2
	    ldloca.s V_0
	    conv.u
	    conv.u8
	    tail. callvirt instance int32 A::f1 (int32, int64, int64)
	    ret

    IL_0013:
	    ldloca.s V_0
	    conv.u
	    conv.u8
	    ldarg.3
	    tail. call int32 A::check (int64, int64)
	    ret
    }

    .method static int32 Main () noinlining
    {
	    .entrypoint
	    .locals init (int32 V_0)
	    newobj instance void A::.ctor()
	    ldc.i4 0x100
	    ldloca.s V_0
	    conv.u
	    conv.u8
	    ldc.i4.0
	    conv.i8
	    tail. callvirt instance int32 A::f1 (int32, int64, int64)
	    ret
    }

    .method instance void .ctor ()
    {
	    ldarg.0
	    tail. call instance void [mscorlib]System.Object::.ctor ()
	    ret
    }

    }

* Allow comments anywhere in .md line, not just the start.

* [Tailcall] Avoid changing ins->sreg1 in OP_TAILCALL_MEMBASE.
This was likely based on OP_CALL_REG which has more reason to do
it but still not a good example.

* [Tailcall] Rollback x86/arm/ppc/llvm until changes are actually
complete/working.

* [Tailcall] Fix code formating: default at end, open brace at right on
previous line.

* [Tailcall] Consolidate comments out of tailcall-virt.cs and tailcall-virt.fs and into tailcall-virt.il.
Make IL less unreadable with whitespace.
Disable instead of enable tailcall-virt test.

* [Tailcall] Combine assert and default that it made unreachable and make assert more informative.

* [Tailcall] Remove a newline.

* [Tailcall] Add additional verbose output.
Add 3 tests that would seem focused on this change and would
seem to be fixed -- all three pass on desktop, all three fail
on previous mono, two are fixed now -- one needs more debugging --
generic value types.

Problem is probably:
is_supported_tail_call:
	if (fsig->hasthis && cmethod->klass->valuetype)
		/* this might point to the current method's stack */
		supported_tail_call = FALSE;

* [Tailcall] Allow tail.callvirt on AMD64 AOT now, having tested it.

* [Tailcall] LLVM support for tail.callvirt/OP_TAILCALL_MEMBASE, now having tested it.

* [Tailcall] Disable new tests for interpreter as I had intended.

* [Tailcall] Consolide interpreter disabling of tailcall tests.
2018-03-08 16:39:12 -05:00
Martin Baulig c2bf82fb98 [System]: WebRequestStream now throws correct exception on cancellation (#7074). 2018-03-08 20:03:22 +01:00
jaykrell 8e4f0d8ff4 [Tailcall] Do not create never-executed trampoline for tail.call self. (#7331)
https://github.com/mono/mono/issues/7328

test case:
```
.assembly extern mscorlib { }

.assembly a { }

.class b
{

.method static void f3<f3>() noinlining
{
tail. call void b::f3<!!0>()
ret
}

.method static void main()
{
.entrypoint
call void b::f3<int32>()
ret
}

}
```

ends up on NT/amd64 as:

```
0:000> uf .
0000016c`3c951420 55              push    rbp
0000016c`3c951421 488bec          mov     rbp,rsp
0000016c`3c951424 4883ec20        sub     rsp,20h
0000016c`3c951428 488b0424        mov     rax,qword ptr [rsp]
0000016c`3c95142c 48894510        mov     qword ptr [rbp+10h],rax
0000016c`3c951430 488b442408      mov     rax,qword ptr [rsp+8]
0000016c`3c951435 48894518        mov     qword ptr [rbp+18h],rax
0000016c`3c951439 488b442410      mov     rax,qword ptr [rsp+10h]
0000016c`3c95143e 48894520        mov     qword ptr [rbp+20h],rax
0000016c`3c951442 488b442418      mov     rax,qword ptr [rsp+18h]
0000016c`3c951447 48894528        mov     qword ptr [rbp+28h],rax
0000016c`3c95144b 488d6500        lea     rsp,[rbp]
0000016c`3c95144f 5d              pop     rbp
0000016c`3c951450 49bb2014953c6c010000 mov r11,16C3C951420h
0000016c`3c95145a 41ffe3          jmp     r11
```

w/ or w/o change, but skipping some steps w/ change.
The move to r11 is initially to a trampoline w/o change, but gets
patched out before it is executed, as compiling the function finishes.

Notice that the next case is similar, method vs. jmp.
2018-03-08 13:40:14 -05:00
jaykrell ab67bcfd0b Provide compile-tests-parallel that honors the command line so e.g. (#7479)
make -j9 compile-tests-parallel is faster than make compile-tests.
2018-03-08 13:38:06 -05:00
monojenkins 3e8f4f7db8 [msvc] Update csproj files (#7497) 2018-03-08 17:14:32 +01:00
Vlad Brezae a5f980dc00 [interp] Let the backend deal with thiscall cconv
This cconv is special only on x86 anyway.
2018-03-08 16:59:45 +02:00
Vlad Brezae 8b2ca1344f [interp] Fix EH with exception thrown from icall 2018-03-08 16:59:45 +02:00
monojenkins da7650d3d9 Bump API snapshot submodule 2018-03-08 11:12:53 +01:00
EgorBo 03b030d921 TaskAwaiter from CoreFX 2018-03-08 11:12:53 +01:00
Aleksey Kliger 12557bec39 [metadata] An array is not an IEnumerator`1
Address https://github.com/mono/mono/issues/7093 in kind of an adhoc way.

The correct fix is to make
```
    ((IEnumerable<U>) (new T[] {...})).GetEnumerator()
```
return an `IEnumerator<U>` (like .NET does) instead of `IEnumerator<T>`
and to stop marking IEnumerator as an array special interface.
2018-03-08 10:50:53 +01:00
Aleksey Kliger 1140ec5394 [test] An array is not an IEnumerator`1
regression test for Regression test for https://github.com/mono/mono/issues/7093
2018-03-08 10:50:53 +01:00
Aleksey Kliger c0a5753b02 [metadata] Add IEnumerator`1 to MonoDefaults struct 2018-03-08 10:50:53 +01:00
Marek Safar 36a471f14e [System] Remove compiler config sections for types which cannot be instantiated
Fixes #7389
2018-03-08 10:20:47 +01:00
Konstantin Khitrykh 32d06fd803 [corlib] Fix Type.GetInterface() to find implemented interface when "ignoreCase: true" is used (#7464)
Fixes #6579
2018-03-07 23:58:59 +01:00
Ludovic Henry 1181815eed [w32handle] Lower minimum memory usage (#7465)
Fixes https://github.com/mono/mono/issues/7460
2018-03-07 16:48:32 -05:00
Marek Safar e6de24c2d1 [build] Unify DEFAULT_REFERENCE handling so I can override it with TARGET_NET_REFERENCE for individual tools 2018-03-07 22:48:05 +01:00
monojenkins 73859e3df2 [msvc] Update csproj files 2018-03-07 17:04:06 +01:00
Aleksey Kliger e64cd8cc8d [profiler] Use accessor functions for MonoClass fields 2018-03-07 10:49:53 -05:00
Ankit Jain 4e6f5f10fd nuget-hash-extractor: Add msbuild extensions nuget version from vs15.6 msbuild branch
Version `2.1.100-preview-62617-01` from:

https://github.com/dotnet/cli/blob/b9e74c65201ef39c74b6d75cedbb605a88cd26ec/build/DependencyVersions.props

Also, update the list in the runtime and deniedAssembliesList.txt
installed for use by msbuild.
2018-03-07 16:38:18 +01:00
Ankit Jain 45f30c307b nuget-hash-extractor: Change the nuget repo name to use for
fetching Microsoft.NET.Build.Extensions nuget from `cli-deps` to
`dotnet-core`. Both of these should have the same nugets but sometimes
seem to be off by one.
2018-03-07 16:38:18 +01:00
Egor Bogatov 695acd0a0b System.Text.RegularExpressions from CoreFX (#7363)
* Regex from corefx.
2018-03-07 14:47:57 +01:00
Alexander Köplinger 85b605042b [acceptance-tests] Actually disable gcsuppressfinalize.exe test
d1ed53624b wasn't enough, it needs to be removed from the CORECLR_COREMANGLIB_TEST_CS_SRC list.
2018-03-07 11:20:09 +01:00
Alex Rønne Petersen c89abe5467 Bump boringssl submodule.
To pick up:

commit 345755cb49ee1979df280399f03178aae0b4029a
Author: Alex Rønne Petersen <[email protected]>
Date:   Tue Mar 6 13:40:16 2018 +0100

    Add build support for RISC-V. (#6)
2018-03-07 07:08:08 +01:00
Bernhard Urban 47df243579 [mini] unpack function pointers for jump patching 2018-03-06 22:15:11 -05:00
Bernhard Urban 095519c899 [ppc] update define usages for creating/unpacking function descriptors 2018-03-06 22:15:11 -05:00
Bernhard Urban 4fea7fb745 [ppc] use new patching machinery 2018-03-06 22:15:11 -05:00
Bernhard Urban ffaf5ffe0f [mini-runtime] unbreak platforms where MONO_ARCH_HAVE_PATCH_CODE_NEW isn't defined 2018-03-06 22:15:11 -05:00
Aleksey Kliger (λgeek) 8ba4947f7a [metadata] Use MonoClass getters in the rest of metadata/ (#7354)
Use `MonoClass` getters in the rest of the code in `mono/metadata/`
1. Add `mono_class_contextbound_bit_offset()` which returns the bit offset of `MonoClass:contextbound` which is needed by `remoting.c`
2. Add `mono_class_create_array_fill_type` which is used by sgen to write over unused nursery fragments.
3. Alllow `metadata-cross-helpers.c` to access `MonoClass` fields directly. Rationale: it needs to compute field offsets.
4. Everything else shouldn't have any functional changes.

https://github.com/mono/mono/issues/6925

---

* [metadata] Fix warnings in class-accessors.c

Fix warnings about missing prototypes for class-abi-details.h functions.

* [cominterop] Use MonoClass getters in cominterop.c

* [loader] Use MonoClass getters in loader.c

* [runtime] Use MonoClass getters in icall.c

* [metadata] Add mono_class_contextbound_bit_offset() accessor

Compute the bit offset of MonoClass:countextbound

* [remoting] Use MonoClass getters for remoting.c

* [boehm] Use MonoClass getters in boehm-gc.c

* [callspec] Use MonoClass getters in callspec.c

* [sre] Use MonoClass getters in dynamic-image.c

* [w32] Use MonoClass getters in w32process.c

* [debug] Use MonoClass getters in mono-debug.c

* [runtime] Use MonoClass getters in method-builder.c

* [runtime] Use MonoClass getters in security-manager.c

* [coop] Use MonoClass getters in handle.c

* [reflection] Use MonoClass getters in reflection.c

* [sgen] Add mono_class_create_array_fill_type

Used by sgen to fill nursery fragments before a collection

* [sgen] Use MonoClass getters in sgen-mono.c and the GC bridges

* [verify] Use MonoClass getters in the verifier

* [sre] Use MonoClass getters in SRE

* [custom_attr] Use MonoClass getters in custom-attrs.c

* [metadata] Use MonoClass getters in gc.c

* [security-core-clr] Use MonoClass getters in security-core-clr.c

* [metadata] Use MonoClass getters in metadata.c

* [metadata] Allow metadata-cross-helpers to access MonoClass fields

* [coop handle] Use MonoClass getter in mono_handle_unbox_unsafe
2018-03-07 01:27:03 +01:00
Filip Navara 6f225e6176 [System.Windows.Forms] Fix inconsistent state of Document object (#7422)
* Update Document selection before resuming layout operations that can access it, such as recalculation of scrollbars.

* Add test case for bug #6357.
2018-03-06 17:52:16 +01:00
jaykrell 9e1ba501ff Fix for gcc 4.4; nominal support for older. (#7419)
attribute(deprecated(message)) was introduced in gcc 4.5.
attribute(deprecated) was introduced in gcc 4.0?
pragma GCC diagnostic 4.2?
https://github.com/mono/mono/issues/7408
2018-03-06 10:13:38 -05:00
jaykrell 56263d4a75 [mini] Virtual call target is never known, remove dead code. (#7424) 2018-03-06 09:56:48 -05:00
Marek Safar 62c8557a7a [System.Security] Fixes decoding of CMS/PKCS #7 messages with an explicit cryptographic object identifier 2018-03-06 15:45:59 +01:00
Rolf Bjarne Kvinge 02abf28216 [corlib] Ignore TimeZoneTest.TestCtors on iOS under certain conditions due to an Apple bug. (#7429)
Fixes https://github.com/xamarin/maccore/issues/629.
2018-03-06 14:31:53 +01:00
Alexander Köplinger d1ed53624b [acceptance-tests] Disable gcsuppressfinalize.exe test that started failing
See https://github.com/mono/mono/issues/7432
2018-03-06 13:55:21 +01:00
Filip Navara b664dfe79f [System.Windows.Forms] Updated unit tests (#7405)
* Update many of the unit tests to pass on Windows.

* Update the TextBox default colors.

* Update ToolStripManager.RevertMerge error handling.

* Update menu item cloning to pass unit tests.

* Update PreviewKeyDownEventArgs.KeyValue behavior.

* Update return value of AccessibleObject.State.

* Update TextBoxBase.IsInputKey to treat backspace as input key.

* Update constructors of BindingCompleteEventArgs to properly set the Cancel property.

* Fix and cache ToolStrip[Item] default font.

* Run fixed layout unit tests.

* Silence the warnings and debug prints in unit tests.

* Update the default colors for ComboBox to match the TextBox.

* Remove superfluous debug prints that are already checked by Assert anyway.

* Make sure HandleCreated event is called for MDI children.

* Do not return zombie handles from CreateWindow, it causes invalid window handles to be sent to X11 functions and lot of noise in the unit test output.

* Do not return zombie handles from CreateWindow, it causes invalid window handles to be sent to X11 functions.
2018-03-06 09:08:14 +01:00
Bernhard Urban 30ad219533 [mixed mode] skip gsharedvt_out_sig_wrapper frames and improve regression test 2018-03-05 18:15:34 -05:00
Bernhard Urban dab1ffc081 [interp] use mini infrastructure for stack walking
this was left over code from times where mini didn't understand
interpreter frames.
2018-03-05 18:15:34 -05:00
Alexander Köplinger a785bd16e9 Merge pull request #7401 from filipnavara/swf-layout
[System.Windows.Forms] Layout fixes

This is accumulation of layout related fixes from https://github.com/filipnavara/mac-playground. Some of the patches were rewritten, small bugs were fixed and it passes the unit tests now.

All the changes are listed in the commits, but the main ones are listed here:
- Rewritten TableLayout, which handles many quirks and unifies the code for GetPreferredSize and the actual layout.
- Fixed FlowLayoutPanel.GetPreferredSize to respect flow breaks.
- Many of the GetPreferredSize implementations fixed to return sensible values. For container controls with default layout the implementation is moved to DefaultLayout and shared.
- Implemented cache for GetPreferredSize that greatly improves the performance for complex layouts.
- Cleaned up implementations of SetBounds, SetBoundsCore and UpdateBounds that improve the performance by reducing the number of re-computations of the same values.
- Moved the calculation of dist_right and dist_bottom for anchor layouts to DefaultLayout.InitLayout.
2018-03-05 23:43:41 +01:00
Calvin Buckley d2bf59dd3f PPC support for BoringTLS
Doesn't seem to be completely working: AIX triggers the trampoline
bug in the ctor for contexts, and Linux inits fine but seems to be
using SSLv3?
2018-03-05 22:22:11 +01:00
Alex Rønne Petersen ee4ed72695 [acceptance-tests] Add an env var to turn on some Mono debugging options. (#7386) 2018-03-05 15:23:08 -05:00
jaykrell 4af9e3a511 [Coop] Convert System.Enum to coop/handle. (#7131)
* [Coop] Add mono_exception_new_argument.

* [Coop] Add mono_set_pending_exception_handle.

* [Coop] Convert System.Enum.InternalBoxEnum / ves_icall_System_Enum_ToObject to coop/handle.

* [Coop] Add mono_handle_unbox_unsafe.

* [Coop] Convert System.Enum.InternalCompareTo / ves_icall_System_Enum_compare_value_to to coop/handle.

* [Coop] Convert System.Enum.get_hashcode / ves_icall_System_Enum_get_hashcode to coop/handle.

* [Coop] Convert System.Enum.InternalGetUnderlyingType / ves_icall_System_Enum_get_underlying_type to coop/handle.

* [Coop] Convert System.Enum.InternalHasFlag / ves_icall_System_Enum_InternalHasFlag to coop/handle.

* [Coop] Convert System.Enum.get_value / ves_icall_System_Enum_get_value to coop/handle.
2018-03-05 12:13:13 -08:00
Alexander Köplinger 7c34f0c746 [packaging] Support setting the FULL_VERSION number via env vars (#7414)
The Linux build currently just displays "tarball" since we don't
have the .git directory when building the Linux packages.

This allows us to pass environment variables that contain the
branch+commit to the build for generating version.h so we can
show the more detailed info like on OSX.
2018-03-05 20:16:51 +01:00
Alexander Köplinger f546b95edf [runtime] Increase the BCL trampoline count (#7409)
Same as in https://github.com/mono/mono/pull/6033 to fix the following error on the FullAOT armel/armhf builds:

```
Ran out of trampolines of type 0 in '/home/builder/jenkins/workspace/test-mono-mainline-fullaot/label/debian-9-armhf/mcs/class/lib/testing_aot_full/mscorlib.dll' (limit 9000)
```
2018-03-05 19:19:31 +01:00
Zoltan Varga fe95e4b34b [jit] Fix the patching of tail calls for gshared methods, the caller and the caller were using different instantiations to search the jump_target_hash. 2018-03-05 19:17:32 +01:00
monojenkins 56bf6d3a73 Bump API snapshot submodule 2018-03-05 19:10:11 +01:00
Filip Navara ff60734df4 Add unit test for TextBox.PreferredSize property and fix updating the preferred size cache on Text change. 2018-03-05 19:10:10 +01:00
Filip Navara 58f25ff1f0 Add makefile rule to build and run the notepad sample. 2018-03-05 19:10:10 +01:00
Filip Navara 7b6b607567 Remove obsolete code from FlowLayoutPanel that is no longer necessary with the corrected nested layouts. 2018-03-05 19:10:10 +01:00
Filip Navara ae972579de When Form is set to AutoSize enforce it also as the minimum size for the window manager. 2018-03-05 19:10:09 +01:00
Filip Navara f1de56d31c Update XplatUI backends to properly send WM_WINDOWPOSCHANGED for zero-sized windows. 2018-03-05 19:10:09 +01:00
Filip Navara e563776f62 Avoid couple of size recalculations by streamlining the SetBounds, SetBoundsInternal and SetBoundsCore methods.
Now explicit bounds are only updated in SetBoundsCore, no more all the updating and restoring with UpdateBounds calls.
Rely on the WM_WINDOWSPOSCHANGED message to be sent from XplatUI.SetWindowPos to call UpdateBounds. This avoids an explicit call to XplatUI.GetWindowPos and UpdateBounds in SetBoundsCore.
2018-03-05 19:10:09 +01:00
Filip Navara ff38080cc0 Fix for bug_82326 unit test. 2018-03-05 19:10:09 +01:00
Filip Navara af26d754ae Fix couple of relayouts causing incorrectly cached control preferred size.
Fix events triggered in incorrect order when Control.Controls.Remove is called.
Update Dispose behavior with events and exceptions to match the reference implementation more closely.
2018-03-05 19:10:09 +01:00
Filip Navara 5feb428acd Update DisposeTest to work on latest version of .NET Framework. 2018-03-05 19:10:08 +01:00
Filip Navara 4f3adb750d Add test for label self-sizing behavior. 2018-03-05 19:10:08 +01:00
Filip NavaraandJiri Volejnik 376002afb4 Call LayoutEngine.InitLayout when appropriate and move the dist_right and dist_bottom calculation there.
Co-authored-by: Jiri Volejnik <[email protected]>
2018-03-05 19:10:08 +01:00
Filip Navara a859588486 Add cache for PreferredSize value. 2018-03-05 19:10:08 +01:00
Filip Navara 016a5a8679 Fix propagating layout to parents and then back to children when PreferredSize changes. 2018-03-05 19:10:08 +01:00
Filip Navara 71931189fa Remove obsolete code for layout of AutoSize forms. 2018-03-05 19:10:07 +01:00
Filip Navara 622ad5480d Unify the code for layout of anchored controls to avoid setting the bounds twice for controls with AutoSize set to true. 2018-03-05 19:10:07 +01:00
Filip Navara 78ad684762 Fix the default layout engine and its quirks enough to pass all unit tests again. 2018-03-05 19:10:07 +01:00
Filip NavaraandJiri Volejnik cbb07605df Move GetPreferredSize implementations from container classes to respective LayoutEngine implementations.
Rework the layout engines to use AutoSizeInternal property since TextBoxBase has its own AutoSize that should not be respected by layout engines.
Rework automatic sizing behavior of TextBoxBase to return correct values.
Rework TableLayout completely to use same code for layout and calculation of preferred size.

Co-authored-by: Jiri Volejnik <[email protected]>
2018-03-05 19:10:07 +01:00
Filip Navara d758a6d65f Fix updating panel references when assigning TableLayoutSettings to TableLayoutPanel. 2018-03-05 19:10:06 +01:00
Jiri Volejnik 71989c037e Ignore invisible controls in FlowLayout. 2018-03-05 19:10:06 +01:00
Filip Navara ca957c45b4 Apply size constrains to control sizes when calculating flow layout. 2018-03-05 19:10:06 +01:00
Filip Navara 4b093a9d2d Apply size constrains to control sizes when calculating flow layout preferred size. 2018-03-05 19:10:06 +01:00
Jiri Volejnik 6943077ab9 Added missing support for flow breaks in FlowLayoutPanel's preferred size calculation. 2018-03-05 19:10:06 +01:00
Filip Navara eed14424e5 Add tests for FlowLayoutPanel.PreferredSize. 2018-03-05 19:10:05 +01:00
Filip Navara a369011555 Apply the constraints when setting MinimumSize/MaximumSize and update the unit test to demonstrate it. 2018-03-05 19:10:05 +01:00
Filip Navara 78f4b60e6c Reduce memory pressure by reusing the LayoutEngine objects. 2018-03-05 19:10:05 +01:00
Jiri Volejnik f56b710942 Added missing PerformLayout() calls to Control.MinimumSize and MaximumSize setters. 2018-03-05 19:10:05 +01:00
Filip Navara 18001b61a3 Apply Maximum/MinimumSize constraints when calculating the preferred size. 2018-03-05 19:10:05 +01:00
Filip Navara 1417a68137 Update Label.InternalGetPreferredSize to take the proposed size into account. 2018-03-05 19:10:04 +01:00
Filip Navara 73c8e1f615 Fix Label automatic sizing code.
The Label control has special sizing behaviour that predates the introduction of layout engines in .NET Framework 2.0. In earlier versions of the framework it used to auto-size itself. Now it does it only if it's contained in the default layout engine, otherwise it lets the layout engine do its magic.
2018-03-05 19:10:04 +01:00
Aleksey Kliger baf431b393 [metadata] Use mono_atomic_store_release to initialize gparam cache
Fixup for
https://github.com/mono/mono/commit/dabdacd99b40d144d93e46fb89e0bb27b7e82931

Use a fence to ensure another thread won't see a partially initialized hash table.
2018-03-05 10:16:44 -05:00
Alexander Köplinger 486be78f8a Update README.md with current directory structure 2018-03-05 15:56:31 +01:00
monojenkins 965a813f51 [msvc] Update csproj files (#7404) 2018-03-05 15:28:10 +01:00
Bernhard Urban 0c6f7fa7c5 [mcs tests] fix runtime arguments passing to test harness (#7400)
* [mcs tests] fix runtime arguments passing to test harness

This fixes a regression introduced by
https://github.com/mono/mono/pull/5484/files#diff-d4a99dd2b7df29f027dae0b3eec6c8e6R193

The change it subtle: Variables are moved into another one, but one
variable got changed from `TEST_RUNTIME_FLAGS` to `RUNTIME_FLAGS`, which
causes the harness not picking up `--interpreter` if set.

* [interp] disable System.Threading.ThreadTest.Test_Interrupt
2018-03-04 12:27:38 -05:00
Aleksey Kliger (λgeek) 9725d50c87 [sre] Use MonoClass getters in sre-save.c (#7352)
* [sre-save] Emit a warning if overwriting a MonoClass token with unequal value

It's not clear to me how we could ever have a class without a type_token set
even with a TypeBuilder.

* [sre-save] Use MonoClass getters in sre-save.c

* [sre-save] Change g_warning to g_error in mono_image_fill_export_table

We think this case should not happen.
2018-03-04 12:23:50 -05:00
Marek Safar 15578eab17 Bump corert 2018-03-04 10:29:11 +01:00
Ludovic Henry 43ac34b36e [sdks] Unify targets to build runtimes (#7394)
* [sdks] Move common targets

* [sdks] Have RELEASE be empty when CONFIGURATION != 'release'

* [sdks] Create common runtime compilation template

* [sdks] Use runtime template for Android

* [sdks] Use runtime template for iOS
2018-03-03 10:21:38 -05:00
Sebastien Lebreton e7ba41d14c Swap Close/Dispose calls so that the receiver_thread_main loop will be properly interrupted (#7390) 2018-03-02 19:03:03 -05:00
Johan Lorensson 24c52e28c0 Use VSCMD_ARG_TGT_ARCH env in mkbundle on Windows when trying to autoetect target architecture. (#7281)
* Use VSCMD_ARG_TGT_ARCH env in mkbundle on Windows when trying to autodetect target architecture.

Using mkbundle on Windows with VS toolchain, mkbundle will detect target
architecture (x86/x64) by looking at the architecture of executing .NET runtime.
This could lead to some surprises when run from a VS development command propmt setup
to target x86 or x64 but running a mono binary using opposite architecture.

To mitigate this issue mkbundle will look now at the VSCMD_ARG_TGT_ARCH
set in VS development command prompts and use target architecture based
on this env variable. If not defined, current behavior will be used, picking the target
architecture based on executed .NET runtime architecture.

* Updated mkbundle documentation.
2018-03-02 23:32:26 +01:00
Alexander Köplinger 4874e18fd2 [corlib] Remove IVT for S.R.I.RuntimeInformation facade (#7385)
* [corlib] Remove IVT for S.R.I.RuntimeInformation facade

The types live in corlib now so we don't need the IVT anymore.

Also removed leftover SR.cs file.

* Bump API snapshot submodule
2018-03-02 16:44:16 +01:00
Zoltan Varga a9c37afaa4 [sdks] Fix the ios build. 2018-03-02 16:03:13 +01:00
Bernhard Urban 16e5f04960 [interp] remove method field from InterpFrame
`MonoMethod *` can be accessed via `imethod->method` instead.
2018-03-02 03:45:05 -05:00
Aleksey Kliger 182a748586 [runtime] Use MonoClass getters in object.c 2018-03-01 18:39:09 -05:00
Aleksey Kliger 2713dfc577 [metadata] Move MonoClass:gc_descr and runtime_info initialization to class-init.c
- Move mono_class_compute_gc_descriptor to class-init.c
- Extract mono_class_setup_runtime_info from mono_class_create_runtime_vtable
2018-03-01 18:39:09 -05:00
Aleksey Kliger 9abe6ebf59 [appdomain] Fix path clobbering when trying to shadow copy siblings
The original version of this code overwrote the same string over and over
again.  Because of the order of operations, when looking for siblings of
Test.dll, we would probe for Test.dll.mdb, then Test.pdb, then Test.pdb.config
(note the last one - should be Test.dll.config).

New version of the code uses fresh strings for each sibling.

Fixes https://github.com/mono/mono/issues/7262
2018-03-02 00:01:35 +01:00
Manuel de la Pena 76d5a16447 [Test] Reenable HttpRequestIgnoreBadCookies in monotouch. (#7330)
The test was ran in the current xamarin-macions and works as expected.
2018-03-01 19:28:50 +01:00
Zoltan Varga bbb882b018 [sdks] Add watch device build. 2018-03-01 19:25:56 +01:00
Zoltan Varga b4d53f4d7c [sdks] Add watch simulator build. 2018-03-01 19:25:56 +01:00
Zoltan Varga dd5e5c8239 [sdks] Add tv simulator build. 2018-03-01 19:25:56 +01:00
Zoltan Varga 6cc113a4b3 Ios sdk changes (#7258)
* [sdks] Add armv7s device build.

* [sdks] Disable dtrace on the cross compiler builds.

* [sdks] Avoid building mono-dtrace.h for the cross compilers, its not needed anymore.

* [sdks] Add a configure-mono target.

* [sdks] Put back the call to CheckXcodeDir.

* [sdks] Enable ccache if possible.

* [sdks] Generalize iosDeviceTemplate so it can build the tvos runtime as well. Add tvos device build.
2018-03-01 19:25:56 +01:00
Jo Shields d8e49b1c27 Fix build from tarballs due to missing corefx.unix.sources 2018-03-01 12:26:13 -05:00
jaykrell 076557c37f Use attribute(deprecated) instead of attribute(error). (#7362)
- This is independent of optimization, which is seemingly what we want.
- This does not have bug under optimization that `error` has, that
 currently breaks FullAOT builds.

This is an alternative to https://github.com/mono/mono/pull/7353.

Use ifdef GNUC || clang to indicate we know clang is compatible,
and not just depend on clang defining GNUC and being very compatible.

See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84628.
2018-03-01 17:18:15 +01:00
monojenkins 68376f1f9b [msvc] Update csproj files (#7367) 2018-03-01 16:51:20 +01:00
Martin Baulig 319749c314 Make it build.
(cherry picked from commit 5f3fd819a0b450febbe1754f1e5d368e1dcfebd8)
2018-03-01 15:29:21 +01:00
Martin Baulig d51e55d4a3 Bump linker to its latest master. 2018-03-01 15:29:21 +01:00
Ludovic Henry a838b6fb39 [interp] Enable more tests (#7315)
* [interp] Enable more runtime tests

* [interp] Enable more mcs tests
2018-03-01 09:08:57 -05:00
Alex Rønne Petersen 8ddcea2956 [profiler] A few low-hanging enhancements. (#7314)
* [runtime] Export mono_runtime_get_aotid () for use in the profiler.

* [profiler] Add nanoseconds startup time to file header.

Fixes #6178.

* [profiler] Add a TYPE_AOT_ID event containing the current runtime's AOT ID, if available.

Fixes #6181.

* [profiler] Add Mvid to image load events.

Fixes #6180.

* [profiler] Add generation field to heap object events.

Fixes #6174.

* [profiler] Remove TYPE_SAMPLE_UBIN and some more dead ELF code.
2018-03-01 07:22:18 -05:00
Alexander Köplinger ddf4e7be31 Update ppc badge to correct URL in README 2018-02-28 22:49:18 +01:00
Alexis Christoforides db63561143 Merge pull request #7341 from akoeplinger/dont-throw-in-dispose
Don't throw NotImplementedException in Dispose()
2018-02-28 14:35:44 -05:00
Alexander Köplinger fa21013d7f Don't throw NotImplementedException in Dispose()
We had a few stubs that threw not implemented exceptions in Dispose()
which causes the finalizer thread to abort.

Since those classes throw in the constructor already there's no way
to create a valid object and we can remove the throw in Dispose().

Fixes https://github.com/mono/mono/issues/7338
2018-02-28 17:28:51 +01:00
monojenkins 2c2fac29eb [msvc] Update csproj files (#7337) 2018-02-28 17:06:30 +01:00
Egor Bogatov 4f9b89adc1 CoreFX System.Runtime.CompilerServices (#7118)
* Initial System.Runtime.CompilerServices port to corefx

* Bump API snapshot submodule
2018-02-28 16:27:03 +01:00
Alexander Köplinger cb956b58a6 Revert "Revert "[System.IO] Integrate FileSystemWatchers from CoreFX The FSEvent CoreFX watcher becomes the new default for MacOS.""
This reverts commit 2174a521a3.
2018-02-28 13:42:15 +01:00
Alexander Köplinger fdefcf1f25 Fix build 2018-02-28 13:30:35 +01:00
Marek Safar 2174a521a3 Revert "[System.IO] Integrate FileSystemWatchers from CoreFX The FSEvent CoreFX watcher becomes the new default for MacOS."
This reverts commit f5b10f34a9.
2018-02-28 12:46:53 +01:00
Alexis Christoforides f5b10f34a9 [System.IO] Integrate FileSystemWatchers from CoreFX
The FSEvent CoreFX watcher becomes the new default for MacOS.
2018-02-28 10:47:01 +01:00
Rodrigo Kumpera 872c048830 [wasm] Add a missing dependency in wasm. 2018-02-28 10:05:16 +01:00
Martin Baulig 8facc4afb2 [System]: Use new WebCompletionSource instead of TaskCompletionSource. (#7293)
This new helper class uses `TaskCompletionSource<>` internally, but instead
of using TrySetException(), it sets a result containing an `ExceptionDispatchInfo`.

The problem with using TrySetException() is that it wraps the exception
object in an `AggregateException`, that would be unobserved if the caller
throws the original exception.
2018-02-28 09:37:24 +01:00
Alexis Christoforides dfe6e2d4a2 Merge pull request #7321 from mono/fix-linuxarm-native-stacktrace
Fix gdb not being used for native stacktraces in some cases
2018-02-28 00:08:16 -05:00
Martin Baulig 9648645fb3 [System]: Enable some System.Net.Requests tests from CoreFX. (#7080)
* [System]: Enable some System.Net.Requests tests from CoreFX.

* tests.make: add `$(XTEST_HARNESS_PATH)` to `TEST_MONO_PATH`,
  so we can find xunit.assert.

* corefx/SR.cs: add `System.Net.Requests` resources from corefx.

* HttpWebRequest: See below for detailed summary.

* Match parameter names of overridden base class members.

* Fixed order of some argument / state checks to match the
  tested behavior.

* Most async methods now throw exceptions instead of returning
  faulted tasks when called with incorrect arguments.

* HttpWebResponse.ContentType: use `string.empty` as default.

* WebConnectionStream.FlushAsync: override to return a finished task.

* HttpWebRequestTest.AllowReadStreamBuffering: removed this test.

* test-helpers/RemoteExecutorConsoleApp: silently ignore compiler-
  generated helper methods.

Enabled tests from CoreFX:
--------------------------

Added the following tests from external/corefx/src/System.Net.Requests/tests:

* AuthorizationTest, FileWebRequestTest, GlobalProxySelectionTest,
  HttpRequestCachePolicyTest, HttpWebRequestTest, HttpWebResponseHeaderTest,
  HttpWebResponseTest, LoggingTest, RequestStreamTest, WebRequestTest

Not working yet:

* AuthenticationManagerTest, FtpWebRequestTest

We are currently using
../../../external/corefx/src/System.Net.Requests/tests/*.cs:AuthenticationManagerTest.cs,FtpWebRequestTest.cs

Summary of HttpWebRequest changes:
----------------------------------

* Host - we are now using the implementation from corefx.

* DefaultMaxResponseHeadersLength (unused) - fix default value.

* AllowReadStreamBuffering (unused) - allow this property to
  be read/written.

* ContinueTimeout - likewise.

* DefaultCachePolicy (unused) - allow this property to be
  read/written and set default value.

* DefaultMaximumErrorResponseLength (unused) - likewise.

* Connection - use implementation from corefx.

* Method - use implementation from corefx, which has additional
  error checks.

* MaximumResponseHeadersLength - use implementation from corefx,
  adding error checks.

* ReadWriteTimeout - likewise.

* ProtocolVersion - include parameter name in ArgumentException.

* TransferEncoding - use implementation from corefx.

* BeginGetRequestStream / GetRequestStreamAsync / GetRequestStream:
  throw exceptions when called with incorrect arguments rather than
  returning faulted tasks.

* Disable the corefx tests for the moment.

* Bump API snapshot submodule

* Update tests.make
2018-02-28 00:32:06 +01:00
Alexis Christoforides ce2584911f Fix gdb not being used for native stacktraces in some cases 2018-02-27 17:24:43 -05:00
Ludovic Henry 096147d428 [tests] Add --repeat parameter to enable runtime tests to run multiple times (#7291) 2018-02-27 17:09:56 -05:00
Alex Rønne Petersen a5da7b21f4 [runtime] Implement thread info flags and get rid of tools threads. (#7226)
* [acceptance-tests] Revert part of 1216780e83.

This didn't work as well as I'd hoped.

* [libgc] Export GC_start_blocking () and GC_end_blocking ().

* [libgc] Allow GC_start_blocking ()/GC_end_blocking () to be called unbalanced.

This makes things a bit easier in Mono.

* [libgc] Implement GC_start_blocking ()/GC_end_blocking () for Windows.

* [utils/event] Export the MonoOSEvent APIs for use in the profiler.

* [runtime] Implement thread info flags and get rid of tools threads.

The concept of a tools thread was originally a good solution to the problem of
some internal threads needing to be exempt from stop-the-world. Since they were
introduced, however, we've added more code in the profiler's internal threads
which require certain properties that don't hold true for tools threads. In
particular, we call into some APIs in the metadata layer that, while not
needing the managed heap, do need a domain to be set under certain conditions
(see #6188).

To avoid further complicating the semantics of tools thread by trying to set a
domain for them in a way that doesn't break things horribly, we'll instead do
away with the concept entirely. We already had mono_gc_set_skip_thread () to
flag a thread as being exempt from stop-the-world, which we used in thread pool
threads. This means we already have the infrastructure that is necessary for a
thread to be fully attached to the runtime as a managed thread while still
being exempt from stop-the-world.

So, we do the following:

1. Introduce a set of flags that can be set on a MonoThreadInfo at arbitrary
   points (although not in async context). These can indicate that the thread
   doesn't want to participate in stop-the-world, doesn't want to receive
   sampling signals, etc.
2. Change the thread iteration macros to allow skipping threads with specific
   flags set and use this where appropriate (e.g. SGen stop-the-world code).
3. Get rid of mono_gc_set_skip_thread () and make runtime code use the new
   mono_thread_info_set_flags () instead.
4. Switch all internal profiler threads to using mono_thread_attach () and
   mono_thread_detach (). Use mono_thread_info_set_flags () to disable
   stop-the-world and sampling signals for these threads immediately after they
   start.

With these changes, internal profiler threads are now fully attached threads
and can call any APIs in the runtime as long as they don't touch the managed
heap.

* [libgc] Add a note about how GC_start_blocking ()/GC_end_blocking () differ from upstream.
2018-02-27 12:36:26 -05:00
Zoltan Varga e8141fc31d [sdb] Fix VirtualMachine.CreateEnumMirror () so it works with types from non-root domains.
Fixes https://github.com/mono/mono/issues/7289.
2018-02-27 17:58:13 +01:00
Aleksey Kliger (λgeek) b8da973620 [marshal] Use MonoClass getters in marshal.c (#7253)
* [runtime] Use getters in IS_MONOTYPE()

* [metadata] Add m_class_offsetof_fieldName accessors

These look like:
```c
intptr_t
m_class_offsetof_someField (void) {
  return MONO_STRUCT_OFFSET (MonoClass, someField);
}
```

When Mono is compiled with the definition of MonoClass
hidden (--enable-checked-build=private_types),
only the function prototypes are available via
mono/metadata/class-abi-details.h
When Mono is compiled without the checked build flag,
the functions are inlined into that header.

* [metadata] Add accessor function mono_class_set_nonblittable

This is needed by mono_marshal_load_type_info ()

* [marshal] Use m_class_get_ getters to access MonoClass fields
2018-02-27 10:55:16 -05:00
monojenkins 2f9b9142cd [msvc] Update csproj files (#7310) 2018-02-27 16:32:45 +01:00
Calvin 6ca674ed68 Update the random checking code in autoconf to this decade (#7250)
* OpenBSD hasn't have /dev/srandom anymore. See:
	  https://mastodon.social/@_xhr_/99389358375291806

	* Crichton hasn't touched Mono since 2004, per logs. I
	  doubt they're who to consult about this issue anymore, if
	  someone somehow does.
2018-02-27 14:34:42 +01:00
Calvin b1801b7804 Always enable explicit null checks for AIX (#7300)
* Always enable explicit null checks for AIX

AIX has a "null page" that allows reads (but not W|X) to occur on
*0; allegedly legacy crap for old stupid C programs that poorly
managed string handling. Because of this, we can't catch SIGSEGVs
to give out NREs with - we have to do null checks ourselves. As
such, turn this debug option on all the time; it's seemingly what
other managed runtimes have done, at least according to with what
one contact says.

* Make explicit null checking definable by architecture headers

Turns out other OSes do this too; so best to keep it generic.

To the poor souls on HP-UX and IRIX, good luck!

* Make arch-specific explicit null checks a backend option instead

Don't put ifdefs into JIT code except in that init_backend func;
also make ifdef name consistent with the debug flag name
2018-02-27 11:39:03 +01:00
Filip Navara 31c03a9cbe [System.Windows.Forms] Remove dependency on Hwnd objects outside of XplatUI code. (#7243)
* Rework the Win32 drag and drop bridge not to depend on Hwnd object.

* Avoid using Hwnd.GetBorderWidth directly.

* Unify GetParent calls to make same sense out of them. They should either consider form owners or not, which wasn't consistent across the XplatUI backends and uses.

Reimplement Control.FromChildHandle using XplatUI instead of relying on Hwnd class.

* Update GetParent parameters.

* Remove direct accesses to Hwnd objects from Control.

* Don't create the Hwnd object in the XplatUIWin32 backend.

* Split handling of Hwnd.GetNextStackedFormLocation for MDI windows into MdiClient to remove dependency on Hwnd objects.
2018-02-27 09:19:01 +01:00
Bernhard Urban 6ac2003417 bump nunitlite
Commit list for mono/NUnitLite:

* mono/NUnitLite@70bb70b [FinallyDelegate] rely on PlatformNotSupportedException in order to determine remoting support (#10)
* mono/NUnitLite@09ad9cf [FinallyDelegate] add comments for why CallContext is used (#9)
* mono/NUnitLite@ab5cc9c [FinallyDelegate] Make this work with platforms without remoting. (#8)

Diff: https://github.com/mono/NUnitLite/compare/b7776829bb7b2f9c58db045a6f40be40bcd96761...70bb70b0ffd0109aadaa6e4ea178972d4fb63ea3
2018-02-27 07:37:55 +01:00
Alexis Christoforides 216b5c5db8 Merge pull request #7286 from lambdageek/fix-gh-7095
[runtime] Don't assert in mono_class_is_assignable_from on iface gtd
2018-02-26 21:32:53 -05:00
Rodrigo Kumpera 909b30b5ba [wasm] Fix v8 provisioning. (#7244) 2018-02-27 00:23:00 +01:00
Vlad Brezae cfaa28e1d8 [threads] Reduce race window with async abort (#7274)
We were previously passing to EH the address to the context that is being set up by the suspend mechanism. This context could get modified while we unwind, confusing EH (could raise `cfa_reg != -1` assertion)

This commit significantly reduces the race window and should mostly avoid crashes (if we get the wrong context we should just fail to invoke clauses from managed)
2018-02-26 16:56:26 -05:00
Aleksey Kliger f901c70548 [runtime] Don't assert in mono_class_is_assignable_from on iface gtd
Don't assert when comparing if an "array special interface" is assignable from
an array.

The code assumed that the special interface is some sort of generic instance
like ``IList`1<string>``, but it could be a generic type definition
``IList`1``.

There is a case where we would be obligated to return TRUE:
If someone used reflection to get the generic param of ``IList`1`` and then made an
array:
```
   var i = typeof (IList<>);
   var iparam = i.GetTypeInfo().GenericTypeParameters [0]; // returns gparam T
   var a = iparam.MakeArrayType (); // T[]

   Console.WriteLine (i.IsAssignableFrom (a));
```

But that case is handled by the `MONO_CLASS_IMPLEMENTED_INTERFACE` check,
earlier in mono_class_is_assignable_from.

So we can return FALSE here.

Fixes https://github.com/mono/mono/issues/7095
2018-02-26 16:31:54 -05:00
Aleksey Kliger (λgeek) 8d37ddbf1d [runtime] Use MonoClass getters in a few small files (#7254)
* [metadata] Fix m_classdef_get_next_class_cache getter to be byref

Apparently the way this field is used is to internally chain cached classes, so
we need its address.

* [metadata] Use MonoClass getters in image.c

* [metadata] Allow debug-helpers to access MonoClass fields directly.

* [metadata] Use MonoClass getters in mono-error.c

* [sgen] Use MonoClass getters in sgen-debug.c

* [sgen] Use MonoClass getters in sgen-client-mono.h

* [metadta] Use MonoClass getters in appdomain.c

* [metadata] Use MonoClass getters in exceptions.c
2018-02-26 16:26:42 -05:00
Aleksey Kliger 375304d501 [test] System.Type.IsAssignableFrom of gtd array special interfaces.
Regression test for https://github.com/mono/mono/issues/7095
2018-02-26 16:18:59 -05:00
Marek Safar d63e8b6f5a [corlib] CompareInfo from CoreFX (#7272) 2018-02-26 21:06:44 +01:00
Alexis Christoforides c152f67574 Merge pull request #7263 from filipnavara/swf-carbontests
[System.Windows.Forms] Fix test freezes with Carbon driver.
2018-02-26 14:47:41 -05:00
Alexis Christoforides de8dc8311d Merge branch 'master' into swf-carbontests 2018-02-26 12:28:31 -05:00
Alexis Christoforides ffbb3d90ae Merge pull request #7234 from filipnavara/swf-painteventend
[System.Windows.Forms] Simplify XplatUI code by adding PaintEventArgs parameter.
2018-02-26 12:13:12 -05:00
Ludovic Henry 5705b3d207 Update CODEOWNERS 2018-02-26 11:46:06 -05:00
lateralusX 905077f90f Add zlib.lib/zlibstatic.lib in Windows VS mkbundle build when using -z argument.
The mkbundle VS toolchain build has never supported zlib and the -z argument.
Commit adds zlib.lib or zlibstaticlib (depending on use of --static) to the
linker command line when using -z argument.

NOTE, user still needs to make sure zlib.h, zconf.h, zlib.lib or zlibstatic.lib
is visible to cl.exe and link.exe when running mkbundle using VS toolchain.
2018-02-26 17:42:29 +01:00
Filip Navara d69c1568f6 Remove mention of MONO_THEME from man page. (#7282) 2018-02-26 17:18:40 +01:00
Aleksey Kliger (λgeek) dabdacd99b [metadata] Cache GenericParamInfo for anonymous gparams in MonoImage (#7155)
* [metadata] Create transient ginst during parsing.

Allocate the instantiation types transiently so that they can be freed if
we're going to ultimately discard this MonoGenericInst candidate.

* [metadata] Store GenericParamInfo for anonymous generic params in a cache in MonoImage

The issue is that mono_metadata_parse_generic_param can be called from
mono_metadata_parse_method_signature_full without a MonoGenericContainer which
means we will image_alloc0 temporary MonoGenericParamInfo every time.

This happens, for example in method_from_methodspec in loader.c when we
parse a generic instantiation without having a generic container on hand.

* [metadata] Use MonoGenericParamFull for all generic params

We used to allocate a smaller MonoGenericParam for anonymous generic
parameters.  Instead always allocate a MonoGenericParamFull now (which has the
extra MonoGenericParamInfo fields).

As a result, update call sites that checked whether mono_generic_param_info
returned non-NULL to check gparam->owner->is_anonymous instead.

As a fesult of that, update mono_metadata_load_generic_params to create
non-anonymous parameters right away if we know the class or method that will
eventually own them.

* [metadata] Remove anon gparam MonoClass caches from MonoImage

Now that all generic parameters are MonoGenericParamFull and have a pklass
field, cache the class corresponding to a generic param in the struct itself
instead of an external cache.

* [metadata] Remove gshared constraint gparam caches from MonoImage

Now that every gparam is a MonoGenericParamFull, we can always cache the
MonoClass for a gparam in MonoGenericParamFull:pklass.
2018-02-26 10:58:21 -05:00
Rodrigo Kumpera 94f8dcf102 [wasm] Add LTO release configuration. Saves 15% of binary size. (#7221)
* [wasm] Enable LTO in release builds. Change packaging to include both debug and release builds.

* [wasm/sgen] Make it possible to disable debug helpers and do so under wasm. Saves 2% on a release build.
2018-02-26 10:57:36 -05:00
Alexis Christoforides ba40177a44 Merge pull request #7269 from filipnavara/swf-theme-obsolete
[System.Windows.Forms] Remove obsolete theme code.
2018-02-26 09:58:31 -05:00
jaykrell 8ebc608feb [Tailcall] Add 11 tests that are all runnable, never crash, are self checking. (#7232)
* [Tailcall] Add 11 tests. They all run w/o exception or stack overflow, on all platforms.
They are self-checking and report if they were tail called.
All 11 pass on Windows .NET.
2 pass with Mono on Windows or Mac.
CoreCLR not tested as it is a difficult/unknown command line environment.

Mono has problems with at least:
	virtual
	non-managed pointers
	generics
	calli
	managed references even if not to current frame

Tests originally written in C# and then run through ildasm and perl.
See https://github.com/jaykrell/mono/commits/tailcalltest2.gen.

* [Tailcall] Interpreter fails all tailcall tests.
2018-02-26 09:53:54 -05:00
Filip Navara 120be0fa4e Remove obsolete Nice theme code. 2018-02-26 13:42:53 +01:00
Paul Fertser e2e66cb4f8 [wcf] use ConcurrentDictionary for wait handles (#7265)
SvcHttpHandler is supposed to be thread-safe so it shouldn't use plain
Dictionary without additional locking.

The problem is apparent when running test app from issue #7134 with
hyperfastcgi as the following exception sometimes surfaces:

```
[System.NullReferenceException]: Object reference not set to an instance of an object
  at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x00111] in .../mono/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:441
  at System.Collections.Generic.Dictionary`2[TKey,TValue].set_Item (TKey key, TValue value) [0x00000] in .../mono/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/Dictionary.cs:223
  at System.ServiceModel.Channels.SvcHttpHandler.ProcessRequest (System.Web.HttpContext context) [0x00048] in .../mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/SvcHttpHandler.cs:82
  at System.Web.HttpApplication+<Pipeline>d__225.MoveNext () [0x008fd] in .../mono/mcs/class/System.Web/System.Web/HttpApplication.cs:1338
  at System.Web.HttpApplication.Tick () [0x00000] in .../mono/mcs/class/System.Web/System.Web/HttpApplication.cs:927
```
2018-02-26 12:59:15 +01:00
Alexander Köplinger 8739c9b05a Bump api-snapshot 2018-02-26 12:55:27 +01:00
Filip Navara 5aafe83bbd Activate MDI child windows after showing them (fixes 7 unit tests failures). 2018-02-26 12:52:02 +01:00
Filip Navara cb48d78dc6 Return dummy value in XplatUICarbon.IconSize to let System.Windows.Forms.SystemInformationTest.IconSizeTest pass. 2018-02-26 12:52:02 +01:00
Filip Navara 091595f3d8 Fix the default font value in test. 2018-02-26 12:52:02 +01:00
Filip Navara 0d524452c5 Make XplatUICarbon.SetFocus send messages synchronously, fixes 9 unit tests. 2018-02-26 12:52:02 +01:00
Filip Navara bb99dcade2 Fix windows creating, destroying and message processing in Carbon driver to be stable enough not to freeze the test suite. 2018-02-26 12:52:02 +01:00
Filip Navara cde44408a4 Spit out the name of a test along with the error about undisposed forms. 2018-02-26 12:52:01 +01:00
Filip Navara 0a2d57ed67 Call XplatUI.PaintEventEnd when an exception happens in OnPaint. 2018-02-26 12:52:01 +01:00
Filip Navara 931380017f Unregister thread exception handler at the end of test. 2018-02-26 12:52:01 +01:00
Marek Safar 0129c25e43 [tests] Use RemoteExecutor from corefx 2018-02-26 11:52:12 +01:00
Zoltan Varga 335ca28eaf [llvm] Pass only the imt argument if both imt and rgctx arguments are required.
Fixes https://github.com/mono/mono/issues/7240
2018-02-26 11:47:46 +01:00
Filip Navara c99ac6a87e Add missing XplatUI.EndLoop call. 2018-02-26 11:29:00 +01:00
Ludovic Henry a974057d92 [sdks] Merge mxe-Win32 and mxe-Win64 targets since we are building both in XA anyway 2018-02-26 11:18:43 +01:00
Filip Navara 1af9291294 Fix layout of ColorDialog on systems with different window border sizes. 2018-02-26 11:13:51 +01:00
Filip Navara 657c7637fb Fix typo in implementation of Disposing property. 2018-02-26 11:13:09 +01:00
Filip Navara 67e557fa2e Handle more special keys in KeysConverter to ensure compatibility with designer generated resource files. 2018-02-26 11:11:38 +01:00
Filip Navara 6d889314b2 Remove obsolete theme code (disabled by commits 910c669 and 93724d2) and the last remaining usage of MONO_THEME environment variable. 2018-02-25 17:05:47 +01:00
Jonathan Chambers 67c1708677 Add PointerValue.Value to dereference and access pointer value. (#6840) 2018-02-25 01:14:11 -05:00
monojenkins 9bbe5e5e5f Bump API snapshot submodule 2018-02-23 21:18:18 +01:00
Marek Safar 392d3452f2 [System.Net.Http] Better exception message for invalid header value 2018-02-23 21:18:18 +01:00
Katelyn Gadd 798c5efa52 Fix bug 18941: Marshal.OffsetOf and Marshal.SizeOf return incorrect results (#7142)
* Add test for bug 18941

* Expand and update bug 18941 test because there are more problems with our handling of empty structs

* Remove array offset calculation from test because it uses unmanaged sizes. Fix calculation of struct sizes used in marshal struct layout (fixes SizeOf(TestOffsets))

* Correct Marshal.SizeOf implementation to use mono_marshal_type_size instead of returning native sizes

* Remove commented out code
2018-02-23 11:49:21 -05:00
Filip Navara bfdbc1e676 Update the method signatures in the new X11 backend. 2018-02-23 17:48:12 +01:00
Vlad Brezae 1f0fc93de4 [sgen] Check if we are exceeding the worker count limit (#7180) 2018-02-23 11:28:56 -05:00
monojenkins 12cbe9a7bd [msvc] Update csproj files (#7238) 2018-02-23 17:00:46 +01:00
Katelyn Gadd d45fb4e882 Fix xamarin-android issue 1130 and add test (#6326) 2018-02-23 15:32:43 +01:00
Vlad Brezae a32ca3e2c2 [tests] Avoid false pinning in weak-fields test 2018-02-23 15:29:58 +01:00
Vlad Brezae 1e9816a10e [tests] Avoid false pinning in tests
When object is allocated at start of tlab.
2018-02-23 15:29:58 +01:00
Ben Lubar 38846ee754 Properly handle non-quoted multipart content dispositions
Fixes #6801
2018-02-23 15:28:55 +01:00
Filip Navara bf12b6318a Simplify System.Windows.Forms XplatUI code by adding PaintEventArgs parameter to PaintEventEnd. 2018-02-23 15:27:12 +01:00
Bernhard Urban 9c55770f3f [icall table] add ldflags for bitcode 2018-02-23 15:26:18 +01:00
Rodrigo Kumpera a9aa188ab2 Make field tokens sequential in SRE. (#7055)
* [sre] Remove S.R.E.FieldBuilder:table_idx field

The field was used in two ways:
  1. as the temporary token returned by MemberInfo.MetadataToken
     property
  2. as a way for sre-save to record the field index in the dynamic assembly.

For (1) we now use the value returned by
  ModuleBuilder.GetToken(MemberInfo) (ie a pseudotoken).

For (2) we lookup the field index in the dynamic assembly hash that maps
MonoClassField pointers to indices.

* [sre] Assign consecutive tokens to all fields in a class.

Ensure that a token and a Module are enough to uniquely identify every
MonoClassField.

Because of how metadata is represented in Mono, the fields defined in a
class must have consecutive tokens (because the MonoClass:field.first
and and MonoClass:field.count are used to index into the
MonoClass:fields array).

When the class is created we bump the "next available field token" value
in the ModuleBuilder.  Any FieldBuilder objects that are still alive
after the type is created will use RuntimeResolve() to map from their
pseudotoken to the real token.

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

* [sre] Change S.R.E.ModuleBuilder.get_next_table_index to take a count

Allow us to reserve more than one consecutive token.

(For now all the callers just have count == 1)

* [sre] Access S.R.E.ModuleBuilder:table_indexes from typebuilder_setup_fields

Use the ModuleBuidler:table_indexes array for assigning tokens to fields
when a TypeBuilder is constructing a type.  Also register those tokens
with the runtime so that ResolveMember calls work.

* [test] System.Reflection.Emit.ModuleBuilder field tokens in a module should be distinct

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

* [runtime] Relax assertions in mono_class_{get,set}_first_field_idx

Removed the !klass->image->dynamic check.  Classes created by SRE are
of kind MONO_CLASS_DEF and have a first field index.

* Fix issues due to API changes.

* Bump mscorlib version
2018-02-23 15:25:05 +01:00
monojenkins 1804219600 [xbuild] add property that is available in msbuild (#7223)
* add property that is available in msbuild

They fsharp team decided to remove a `#if MONO` with the assumption that
`xbuild` is dead and everything has switched over to `msbuild`:
https://github.com/Microsoft/visualfsharp/pull/3969/files#diff-bcb4028a918d13bbab2d0c1c15c97e6aL181
https://github.com/Microsoft/visualfsharp/pull/3969/commits/5e17e3111f88b1a1f025ac54c8147052e12f347f#r151844561

which, alas, is not true yet.

With this PR we started to ship above modifications in the MDK:
https://github.com/mono/mono/pull/7018

* Bump API snapshot submodule
2018-02-23 13:28:30 +01:00
jaykrell 03371921a1 Problem building on Arch linux #7200 (#7230)
https://github.com/mono/mono/issues/7200
Three styles:
1. LIBS="$LIBS -lfoo"   -- common and probably works
2. LIBS+="-lfoo"        -- was here and does not work
3. LIBS+=" -lfoo"       -- should work
2018-02-23 03:56:08 -08:00
Rolf Bjarne Kvinge 481827b6af [runtime] Don't prepend '0x' to %p-formatted numbers.
%p-formatted numbers already include '0x'

Fixes this output when dumping threads:

    "Threadpool worker" tid=0x0x7000105cc000 this=0x0x10bc18508 , thread handle : 0x7fbb9e6c6c90, state : not waiting

to become:

    "Threadpool worker" tid=0x7000105cc000 this=0x10bc18508 , thread handle : 0x7fbb9e6c6c90, state : not waiting
2018-02-23 05:15:19 -05:00
Marek Safar 5eb4191943 [build] Remove multi stage build from Mono.Security (#7171) 2018-02-22 22:47:58 -05:00
Alexis Christoforides 218ffb9883 Merge pull request #7225 from alexischr/bump-bockbuild
[bockbuild] Detect HTTP errors  when using curl
2018-02-22 22:43:04 -05:00
Rodrigo Kumpera 2b068cb5a4 Fix some enable minimal. (#7195)
* [configure] Remove sgen_copying. It's dead.

* [configure] Add sgen_gc_bridge and sgen_split_nursery to the configure flags.

* [configure] Remove more dead configure flags.

* [configure] Par is now just a feature of conc, remove that too

* [sgen] Fix enable minimal for concurrent configuration.

* [sgen] Fix enable minimal for the split nursery.

* [sgen] Use the new enable minimal to compile the bridge code out.

* [wasm] Switch to the new enable minimal flagd and add mono-opt.js build. The new flags save 300k out of 2.8m.
2018-02-22 22:39:59 -05:00
Calvin ca47362a92 Fix mono_arch_setup_async_callback and add mono_arch_setup_resume_sighandler_ctx on PPC (#7159)
* Fix *setup_async_callback and add *resume_sighandler_ctx on PPC

mono_arch_setup_async_callback didn't work on systems that use
function pointers. For consistency with other backends with
exception support, also add mono_arch_setup_resume_sighandler_ctx,
which we can use to support mono_arch_setup_async_callback, like
those other backends.

Also enable async callbacks on AIX, then enable
*resume_sighandler_ctx on PPC Linux (untested) and AIX. With this,
I can now ^C in the REPL with AIX and have it work; whereas before
it bombed out, with or without async callbacks enabled or disabled.

* Don't configure func descriptors twice, set args reg with user data

	* No sense configuring configuring function descriptors if
	  the restore sigcontext call already set them up. (If Mac
	  OS supports is verified and added to the ifdef maze, it'd
	  be safe to remove this whole ifdef, and let the call in
	  `exceptions-ppc` handle it all, as all supported OSes
	  would have that call...)

	* Set user_data in an arguments register, like what amd64
	  and z do.

These don't seem to cause any regressions, like the first patch.

* Remove unnecessary case for PPC

* mono_ppc_set_func_into_sigctx is unused now, remove it

* Everyone has MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX on PPC now

* Everyone has MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX on PPC too
2018-02-22 21:49:12 -05:00
Bernhard Urban 6e0c91f053 [interp] add another signature for interp_in wrappers 2018-02-22 20:45:08 -05:00
Ludovic Henry c382b03fd5 [coop] Rename mono_threads_is_coop_enabled to convay better its semantic (#7178)
mono_threads_is_safepoints_enabled is used to check if cooperative suspend safepoints are enabled, while mono_threads_is_blocking_transition_enabled is used to check if GC safe/unsafe transition are enabled.
2018-02-22 18:53:20 -05:00
Alex Rønne Petersen 8900231c8b [mini] More minor JIT cleanups. (#7130)
* [mini] Change mono_arch_is_inst_imm () to receive the non-imm and imm opcode.

* [mini] Provide a stub for mono_arch_exceptions_init ().

* [mini] No need to define MONO_ARCH_FPSTACK_SIZE on platforms that don't use it.

* [mini] Remove some dead defines from backend headers.

* [mini] Remove the unused dummy_store opcode.

* [mini] Handle dummy init instructions in all backends.

* [mini] Implement live range instructions in all backends.

* [mini] Allocate trampolines from the domain code manager where appropriate.
2018-02-22 18:32:42 -05:00
Alexis Christoforides 983966c7ca [bockbuild] Detect HTTP errors when using curl 2018-02-22 18:31:24 -05:00
Rodrigo Kumpera 0a8126c209 [WASM] Implement timers. (#7193)
* [wasm] Add server.py for those that want to experiment with streaming compilation.

* [wasm] Implement System.Threading.Timer.

Timer implementation is done in a somewhat convoluted way.

First, we change Timer to not depend on a scheduler thread.
What we do is call for the runtime to schedule a timed callback to be executed.

Next step, the runtime. We add enough plumbing to get this call to JS.

Finally, in JS we either call setTimeout or schedule it to be run on the next tick.

Oh, wait, timeouts are ignored on non-web environments? Yes, right now its only use case
is offline testing, so ain't no time to wait for all this timeouting.
2018-02-22 18:24:01 -05:00
Katelyn Gadd f0b7825189 Updates to support building the BCL using Visual Studio 2017 on windows (#6877) 2018-02-22 23:48:37 +01:00
Alexis Christoforides 123d086e27 Merge pull request #6892 from lambdageek/use-getters
[metadata] Use getters for MonoClass fields in class.c
2018-02-22 16:36:08 -05:00
Alexis Christoforides c1cbe060f6 Merge pull request #7218 from mono/revert-6018-fix_10087
Revert "Run the ProcessExit events in the threadpool and enforce a 3 seconds limit. Fixes #10087"
2018-02-22 15:25:05 -05:00
Alexis Christoforides 49a1c8423c Disable a flaky test on Windows
https://github.com/mono/mono/issues/7199
2018-02-22 14:49:06 -05:00
Rodrigo Kumpera 199dad7e84 Revert "Run the ProcessExit events in the threadpool and enforce a 3 seconds limit. Fixes #10087" 2018-02-22 10:06:18 -08:00
monojenkins 72e5ca60b8 [msvc] Update csproj files 2018-02-22 19:03:29 +01:00
Ben Lubar c6f91eaa58 Fix unknown-length requests being treated as if they are fully preloaded. (#6822) 2018-02-22 14:56:02 +01:00
Zoltan Varga 119cf5259e [aot] Emit the same instances in hybrid aot mode as in full aot mode.
Fixes https://github.com/mono/mono/issues/7086.
2018-02-22 14:54:28 +01:00
Zoltan Varga f90612e047 [bcl] Comment/stub out some unused icalls to prevent problems with AOT. (#7183) 2018-02-22 14:49:30 +01:00
Alexis Christoforides 3addbfe627 Merge pull request #7181 from mono/bockbuild-download-using-curl
Bump bockbuild for https://github.com/mono/bockbuild/pull/62
2018-02-22 08:42:43 -05:00
Alexis Christoforides 8a52f590fc Bump bockbuild for https://github.com/mono/bockbuild/pull/62 2018-02-22 08:02:58 -05:00
Marek Safar d4816ef1ab [System.Xml] Remove reflection calls for value has to be set 2018-02-22 08:39:29 +01:00
Zoltan Varga 8ce0775a03 [jit] Disable partial sharing during JITting, its only been tested in full aot mode, and doesn't seem to work with JITted methods. (#7161)
* [aot] Add hybrid aot tests.

* [jit] Disable partial sharing during JITting, its only been tested in full aot mode, and doesn't seem to work with JITted methods. Fixes https://github.com/mono/mono/issues/7085.
2018-02-21 21:11:47 -05:00
Jonathan Chambers 2d2033e440 Use proper sized integer for ioctlsocket on Win32. (#7153)
Windows expects a 32-bit unsigned long in this API.
Previously we passed a 64-bit value and the actual amount
was stored in the wrong bits.
2018-02-22 01:33:13 +01:00
Jonathan Pryor 89804e62bb [mono-api-html] Expand "ignore" functionality (#7154) (#7175)
Context: https://github.com/xamarin/xamarin-android/pull/1078

xamarin-android uses `mono-api-html` and `mono-api-info` in order to
perform API comparisons; see e.g. 4e459045.

A recent problem has arisen regarding "inter-API-level diffs": there
are many API changes which we consider to be acceptable, and thus
would like to ignore. Unfortunately, `mono-api-html` doesn't support
ignoring many of these constructs, e.g. base class changes:

	<h3>Type Changed: Android.Preferences.CheckBoxPreference</h3>
	Modified base type: <span class='removed removed-inline removed-breaking-inline'>Android.Preferences.Preference</span> <span class='added '>Android.Preferences.TwoStatePreference</span>

and property type changes:

	<h3>Type Changed: Android.Views.InputEvent</h3>
	<p>Modified properties:</p>
	<pre>
	<div data-is-breaking>	public <span class='added added-breaking-inline'>abstract</span> int DeviceId { get; }
	</div><div data-is-breaking>	public <span class='added added-breaking-inline'>abstract</span> InputSourceType Source { get; }

Overhaul the `mono-api-html` "ignore" infrastructure:

  * Introduce ignore "scoping". Previously, the ignore options would
    only match the *member* text against any provided regular
    expression. Thus, `mono-api-html -r ToString` would ignore *all*
    members containing `ToString`. Furthermore, there was no way to
    restrict the ignore to a particular type. Expand the regex
    semantics so that the declaring type is used as a "prefix" for the
    to-be-matched text. For example, if a class `Example` is removed,
    `mono-api-html` will now match the following value against any
    `-r` regular expressions:

        Example: Removed type

  * Add a `mono-api-html -v` option, to control output verbosity.
    When specified, `mono-api-html` will print out available `-r`/etc.
    option values:

        $ mono-api-html expected.xml new.xml -v
        Possible -a value: Android.Resource: Added fields: public static const int AccessibilityEventTypes;
        Possible -r value: Android.Preferences.CheckBoxPreference: Modified base type: 'Android.Preferences.Preference' to 'Android.Preferences.TwoStatePreference'
        Possible -r value: Android.Views.InputEvent: Modified properties: public int DeviceId { get; }
        Possible -n value: Android.Views.UnavailableException: Added type
        ...

Additionally, allow `mono-api-html` to take a
`Mono.Options.ResponseFileSource`, which allows `@response-files` to
be used as command-line options.
2018-02-22 01:31:10 +01:00
Rodrigo Kumpera df273181b5 Merge pull request #6018 from kumpera/fix_10087
Run the ProcessExit events in the threadpool and enforce a 3 seconds limit. Fixes #10087
2018-02-21 15:48:38 -08:00
Rodrigo Kumpera 03b6095e3e [runtime] Magic interfaces requires the complex stelemref to handle arrays. Fixes gh #6266 (#7038) 2018-02-21 23:17:43 +01:00
Marek Safar 761ddc60f9 [corlib] Make MissingMember exceptions working again after #6123 2018-02-21 22:50:04 +01:00
Aleksey Kliger 735337d5e6 [metadata] Implement MONO_CLASS_IS_INTERFACE(c) in terms of public API
Althought it was previously defined in a public API header, the macro was not
usable for the last several years since it was implemented in terms of
the MonoClass definition which was not visible in the public API.

There is a subtle semantic change here: mono_type_is_generic_parameter will
return FALSE if it's given a byref type parameter, the previous definition of
the macro would return TRUE.  (E.g. if you had "class F<T>" then
IS_INTERFACE("T&") used to return TRUE but will now return FALSE. )
2018-02-21 15:05:18 -05:00
Aleksey Kliger bae5cd2d6e [metadata] (class.c) Use MonoClass getters
Also
- Move mono_class_set_failure definition to class-accessors.c
- Move a few functions that set up specific MonoClass fields to class-init.c:
  - mono_class_setup_has_finalizer
  - mono_class_setup_nested_types
  - mono_class_setup_supertypes
2018-02-21 15:05:18 -05:00
Brian Luczkiewicz f636486045 [metadata] add missing MONO_ENTER/EXIT_GC_SAFE guards around access(2) in is_file_writable (#7126) 2018-02-21 12:16:24 -05:00
Kai Ruhnau d2383c037d [corlib] Support terminals without color support
Some terminals like vt220 don't have a format string for setting foreground
or background colors. In that case, the set*color members of the
TermInfoDriver are set to null and trying to set the background color throws.

Signed-off-by: Kai Ruhnau <[email protected]>
2018-02-21 17:57:19 +01:00
Vlad Brezae 705223f6d5 [interp] Use frame_addr as base pointer in more places (#7128)
When unwinding with the interpreter, we don't make use at all of the MonoContext's SP pointer.
2018-02-21 11:33:39 -05:00
Alex Rønne Petersen 5b0503a5b3 [profiler] Some minor housekeeping. (#7123)
* [profiler] Document addition of MONO_ROOT_SOURCE_EPHEMERON.

* [profiler] Remove dead ELF traversal code.

This was buggy and hasn't been enabled for a long time.
2018-02-21 11:31:36 -05:00
Rodrigo Kumpera ec2faf0388 [wasm] Fix master and add sample. (#7160)
* [wasm] Fix wasm compilation due to recent master regression.

* [wasm] Add Readme and sample to the package.
2018-02-21 11:20:17 -05:00
monojenkins ad03afd96e [msvc] Update csproj files (#7173) 2018-02-21 16:33:38 +01:00
Alexis Christoforides a85911f480 Merge pull request #6034 from alexischr/bug-59400
[class] Fix resolution of interface implementation for 'special inter…
2018-02-21 10:16:26 -05:00
Marek Safar 8658bb6048 [build] Don't add specific support file to all xunit test builds (#7163) 2018-02-21 12:28:48 +01:00
Alexis Christoforides a19fad65f3 Fix copyright 2018-02-20 21:15:56 -05:00
Alexis Christoforides 7de96dd412 Merge pull request #7150 from alexischr/bug-46473
[remoting] Synchronize serializer/deserializer usage for call data. F…
2018-02-20 21:05:42 -05:00
Martin Baulig 5fabb059cf Add Mono-specific System.Net.Test.Common.Configuration.Http. (#7156)
This is the Mono part for corefx commit
https://github.com/mono/corefx/commit/a46b8d9a2c960d0cb882831ef4e6a665e5d9b8e2.
2018-02-21 01:31:16 +01:00
Alexander Köplinger d7551cc9bf [metadata] Improve error message for loading unresolved types (#7147) 2018-02-21 00:21:19 +01:00
Alexander Köplinger 2837f433d9 [corlib] Fix RuntimeFeatureTest.NoNewFeaturesAdded on mobile (#7149)
The code uses reflection to access all the fields in the RuntimeFeatures
class. When running the linker we strip out these fields since
they're `const` and the test fails because it can't find the expected values.

Since the linker always removes all constant fields we can't simply
"use" the field in the test and instead we just bail out when encountering this case.

Also used Dictionary instead of tuples for the test since it renders
better in the nunit output.

Fixes https://github.com/mono/mono/issues/7145
2018-02-21 00:13:06 +01:00
Alexis Christoforides 1426d6a8da [remoting] Synchronize serializer/deserializer usage for call data. Fixes #46473 2018-02-20 17:05:05 -05:00
Alexander Köplinger 18e274b14b Bump corefx submodule
For some reason it got bumped to a commit that is no longer in master.
2018-02-20 22:33:44 +01:00
Zoltan Varga 045acb8f19 [jit] Handle more cases for gsharedvt constrained calls. (#7081)
Hopefully fixes https://github.com/mono/mono/issues/7016.
2018-02-20 15:41:10 -05:00
Rodrigo Kumpera 3b8ec9e97b [wasm] Fix the port to work with the latest version of emcc. (#7091) 2018-02-20 15:39:02 -05:00
Calvin eef0801f3e Assorted fixes for AIX and i (#6934)
* Assorted fixes for AIX and i

	* Fix a bug I introduced when changing the MonoArray vector
	  type; array lengths wouldn't match up to what they
	  actually were on AIX/i.

	* Use a custom mkdtemp implementation on Unices without
	  mkdtemp - and ones that do but don't necessarily have it,
	  like i 7.1, which lacks mkdtemp in its libc. We can't
	  determine this at runtime, so AIX will have to suffer
	  with i.

	* Enhance PowerPC hwcap on AIX to detect features like
	  Linux does.

	* Don't use clock_getres on AIX, because i 7.1 doesn't have
	  that syscall - it's in libc, but it'll bomb out with a
	  SIGILL; the way unimplemented opcodes are handled on i.

* Don't use PROT_NONE for hazard pointer alloc when on AIX

AIX and i 7.2 are OK with doing this, but i 7.1 is not and will
SIGSEGV because we violate access privleges; not even mprotect will
change this. As such, change to r/w protection for AIX/i.

* Fix Environment.OSVersion on AIX/i

Before, it would report "Unix 1.0.0.0" due to the fact AIX only
puts the minor version number where other Unices would put the
whole version in uname. Set up an ifdef for AIX and deal with this
semantic difference with a sprintf.

* Disable mffgpr on AIX

Reports of it not working on i 7.1 on POWER7; tester reports
disabling this in hwcap makes it run. This requires further
investigation.

* Fix threadpool errno delivering bogus values with _THREAD_SAFE

We didn't set this, and we need it so that errno is thread-local on
AIX/i. Oops!

* Make suggested changed to AIX branch

	* use sizeof (utsname) for sanity's sake

	* use a variable for hazard table protection

	* match defines for CPPFLAGS -> libmono_cflags
2018-02-20 15:38:22 -05:00
jaykrell 38989b012f [Coop] Convert many simple mono_object_new_checked to mono_object_new_handle. (#7129) 2018-02-20 15:24:21 -05:00
Paul Fertser dd4dbd8d4b [System.ServiceModel] Prevent crash in Dispatcher.ListenerLoopManager… (#7136)
In certain cases of having concurrent WCF requests
HttpReplyChannel.TryReceiveRequest can return true with the context
being null ("at closing phase").

This patch prevents crashing the whole application with a
NullReferenceException as reported in issue #7134.

Whether this is just covering the issue over or a real fix is yet to be
determined.

Fixes https://github.com/mono/mono/issues/7134
2018-02-20 14:05:05 -05:00
Alexis Christoforides 1791e50b56 [class] Fix resolution of interfaces in classes implementing IEnumerator. Fixes #59400
Assume a class implementing multiple generic I`1 interfaces. If a virtual call invocation is trying to resolve the correct interface using object O implementing I`1 also , the interface is resolved using a set of rules (not fully implemented in Mono), but a requirement is that the chosen interface is "variant-compatible" with object O, that is its generic parameters are set to the same types.

This last requirement is relaxed as an implementation-specific detail when I`1 is IEnumerator`1, in which case e.g. a virtual call on a class implementing IEnumerator<byte> can happen with an object of type IEnumerator<sbyte> by way of sharing IEnumerator`1 as a generic interface they define. Here, clearly the interfaces are not "variant-compatible", and this is allowed.

Resolution of classes implementing IEnumerator should still attempt to select a compatible interface using the standard rules before attempting to apply this special rule.
2018-02-20 12:13:16 -05:00
monojenkins 7b120ae2d4 [msvc] Update csproj files (#7140) 2018-02-20 17:01:19 +01:00
Bernhard Urban 98cadff5f6 bump nunit-lite
Commit list for mono/NUnitLite:

* mono/NUnitLite@b777682 [FinallyDelegate] only call it if available, on some platforms (e.g. iOS) it can be set to null (#7)

Diff: https://github.com/mono/NUnitLite/compare/0dc7716771023274074160d1816c2fa610e23d2f...b7776829bb7b2f9c58db045a6f40be40bcd96761
2018-02-20 14:59:24 +01:00
Rodrigo Kumpera ecadc6cf31 [wasm] Make .stamp-depot-tools more reliable. (#7078) 2018-02-20 14:34:03 +01:00
Marek Safar 9b1e845740 [corlib] order sources content 2018-02-20 07:52:45 +01:00
Alexander Köplinger bf3ed7115b [corlib] Add System.Runtime.ProfileOptimization APIs (#7120)
They are starting to be used by Roslyn (https://github.com/dotnet/roslyn/commit/eed147d330e92a55cb2daa26acb28fcde1776f04)
and without them we crash because we can't load the type.

Making the APIs no-ops is explicitly allowed by the docs (e.g. on single-core machine):
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.profileoptimization.startprofile?view=netframework-4.7.1#Remarks

* Bump corlib version otherwise monolite won't work with recent csc
2018-02-20 02:35:08 +01:00
Miguel de Icaza 6a01a0b314 WinForms: Enable external CocoaDriver external driver (#7100) 2018-02-20 02:29:52 +01:00
Alexander Köplinger a65c354f7b Bump api-snapshot submodule 2018-02-19 20:15:46 +01:00
Alex Rønne Petersen 4d52a10ca0 [mini] Move some arch-specific interpreter logic into backends and provide stubs. 2018-02-19 18:02:12 +01:00
Alex Rønne Petersen 4358581865 [mini] Don't use arch_target to point to arch/ subdirs.
This is unnecessary and doesn't really make sense semantically in general as
some targets might define a different arch_target depending on bitness, while
still using the same arch/ subdir.
2018-02-19 18:02:12 +01:00
Alex Rønne Petersen e9c51fa3e5 [mini] Use a MONO_ARCH_INTERPRETER_SUPPORTED define instead of checking archs in driver.c. 2018-02-19 18:02:12 +01:00
Ludovic Henry 23acd0f78b Fix for XA integration 2018-02-19 16:59:45 +01:00
monojenkins 7da8b503c6 [msvc] Update csproj files 2018-02-19 16:50:41 +01:00
Egor Bogatov f6a6779ff5 [corlib] CoreRT System.Threading.Tasks (#6672) 2018-02-19 15:59:33 +01:00
jaykrell ed95106965 Coop/handle conversion of ByteArrayToCurrentDomain and ByteArrayToRootDomain. (#6692) 2018-02-18 20:08:46 -08:00
monojenkins c4d1da6ef3 [master] [sdks] Fix for XA integration (#7103) 2018-02-18 21:13:09 -05:00
jaykrell a7ed34f4db Centralize handle-based post-object creation code. (#7096)
i.e. merge 20e69fa199 and d7626e8217.

Remove some redundant error_init calls.
2018-02-18 00:58:44 -08:00
jaykrell 79ef9d5105 Fix race condition in mono_thread_execute_interruption. (#6833)
* Fix race condition in mono_thread_execute_interruption.

* Cleanup mono_thread_execute_interruption w/o semantic change.
2018-02-17 15:01:00 -08:00
jaykrell d7626e8217 [coop] Add handle-based object create functions. (#6876)
* Change first parameter of mono_nullable_box from guint8* to gpointer to avoid casts.

* [Coop] Provide object creation functions that return handles
and related. Existing functions are left unchanged
instead of layering over new to allay performance concerns.

Note that there are several variations new_object:
	alloc vs. non-alloc
	fast vs. regular -- fast does not handle finalization or weak fields and is external only
	specific vs. non-specific -- specific is "vtable" and "non-specific" is "class"

"_handle" implies "_checked" if we can get away with it, as conversion continues

mono_gc_alloc_handle_array
mono_gc_alloc_handle_mature
mono_gc_alloc_handle_obj
mono_gc_alloc_handle_pinned_obj
mono_gc_alloc_handle_string
mono_gc_alloc_handle_vector
mono_gc_register_object_with_weak_fields(MonoObjectHandle) (raw "obj" vs. handle "object")
mono_gc_wbarrier_object_copy_handle
mono_nullable_box_handle
mono_object_clone_handle
mono_object_new_by_vtable               "_by_vtable" instead of "_specific", and implies handle
mono_object_new_handle                  "_by_class" implied
mono_object_new_handle_mature           "_by_class" implied
mono_object_new_pinned_handle           "_by_class" implied
mono_object_register_finalizer_handle
mono_value_box_handle

* Combine mono_object_new_fast and mono_object_new_fast_checked.
2018-02-17 01:43:02 -05:00
Alexander Köplinger aec2773e1d Revert "[System.Drawing] Disable tests except on ARM64 (#6909)"
(reverted from commit 5e7483f354)

dcda4c77bc is a better approach.
2018-02-16 21:16:16 +01:00
jaykrell 83ed33ba2c [Coop] Convert Console to Coop/Handles. (#7060) 2018-02-16 10:09:42 -08:00
Zoltan Varga b043ff5f74 [aot] Bump aot file format version because of 7cac757e60. (#7079) 2018-02-16 00:59:04 -05:00
jaykrell ded74c0b12 Use the preallocated domain->out_of_memory_ex instead of allocating. (#6819) 2018-02-15 18:23:58 -08:00
Aleksey Kliger 52514effbf [marshal] For generic method icalls, handle generic param arguments when using coop handles
Suppose we wanted to use coop handles to implement the following icall:

   [MethodImpl (InternalCall)]
   extern void GetGenericValueImpl<T> (int idx, T out value);

The question is: how should we pass the argument "value" to the C code?

If it was a reference type like "string" , we would use a coop handle:
    void ves_icall_GetGenericValueImpl_string (gint32 idx, MonoStringHandleOut value, MonoError *error);

But if it was a valuetype, we would instead pin the memory with an interior
handle and pass the raw address:
    void ves_icall_GetGenericValueImpl_int32 (gint32 idx, gint32 *value, MonoError *error);

But we don't have two different implementation on the C side - there's just one
icall - we have to choose a single mechanism.

So the mechanism we choose is to treat all the args like valuetypes - pin the
memory in the wrapper and pass a raw pointer to the C side.

The other troubling possibility is if someone writes:
   [MethodImpl (InternalCall)]
   extern void BadInternalCall<T> (Something s, T bad);

Now we really don't have any options.  So we just assert that noone ever writes
such a call.
2018-02-15 18:50:02 -05:00
jaykrell e01355eead [Cplusplus] Fix possible race condition and add casts between void* and function pointers. (#6871) 2018-02-15 13:12:27 -08:00
Alexis Christoforides 9209ea0629 Merge pull request #7073 from mono/disable-test-sleep
Disable a flaky test on PRs (https://github.com/mono/mono/issues/6999)
2018-02-15 14:53:50 -05:00
Zoltan Varga cfa087bfd7 [aot] Rename mono_aot_get_method_checked () to mono_aot_get_method (), there is no non-checked version anymore. (#7071) 2018-02-15 14:12:13 -05:00
Vlad Brezae e2419dee78 [interp] Add missing exception checkpoints (#6917)
On interp we can't async abort since we cannot unwind from an ip in the interp, so the interpreter does explicit checks as part of branch instructions.

Note this can lead to increased stack usage when compiling with -O0.
2018-02-15 20:27:32 +02:00
Alexis Christoforides 1028994a88 Disable a flaky test on PRs (https://github.com/mono/mono/issues/6999) 2018-02-15 12:29:38 -05:00
monojenkins cf644472f9 [msvc] Update csproj files (#7070) 2018-02-15 16:43:51 +01:00
Zoltan Varga 23e6f6f4b5 Revert "[jit] Make some JIT regression test files compile in the mobile profile (#7059)" (#7069)
This reverts commit e2874db522.

Revert this as it breaks the SDK tests.
2018-02-15 16:43:30 +01:00
Zoltan Varga b7385ba797 [sdks] Add targets for the watch cross compiler. (#7061)
* [offsets-tool] Add an '--output' argument to specify the output file directly instead of generating it from the target triple.

* [sdks] Add targets for the watch cross compiler.
2018-02-15 10:07:37 -05:00
Jay Krell fc7bda62d3 [coop] Convert some mono_exception_* functions
Reduce managed exposure in utils a little.

[coop] install object-forward.h
2018-02-15 10:06:17 -05:00
Zoltan Varga e2874db522 [jit] Make some JIT regression test files compile in the mobile profile (#7059)
Remove tests from Mono.Runtime.Tests which depend on assemblies not in the mobile profile.
2018-02-15 15:07:44 +01:00
jaykrell ea1fac3d89 [coop] Remove unnecessary write barriers against thread locals and cleanup a little. (#6874)
Restore scope for Centrinel, because the array macros
are not expressions, so MONO_HANDLE_SUPPRESS does not work.
2018-02-15 03:00:26 -08:00
Miguel de Icaza 3bd630eba7 [mkbundle] Automatically bundle config files and machine.config files (#7002)
* [mkbundle] Automatically bundle config files and machine.config files for the simple/cross compiler scenario, fixes one of the missing issues for #6230
2018-02-15 10:07:16 +01:00
jaykrell b90d8ec387 Remove GetNLSocket which is unused and produces a warning because it is unprototyped. (#6691) 2018-02-14 19:25:27 -08:00
jaykrell 4a83009a03 WSL does not nul terminate uname.release. memset(0) it first. (#7023) 2018-02-15 01:11:27 +01:00
Alexis Christoforides 8d82699736 Merge pull request #7057 from lewurm/interp-disable-flaky-pinvoke-test
[interp] disable flaky pinvoke test
2018-02-14 19:09:23 -05:00
Marek Safar 62bf8bd4d5 [System.ServiceModel.Activation] Move ServiceHostFactory.cs where it's used (#7044) 2018-02-15 00:55:45 +01:00
Bernhard Urban 2322177e6a [interp] disable flaky pinvoke test 2018-02-15 00:51:24 +01:00
jaykrell 8ad191dfbb mono_get_exception_runtime_wrapped_checked contains an unnecessary 16 (#6659)
element array that can be just 1 element, or completely absent.
It is a rare path, but stack use should always be minimized.
2018-02-14 14:59:26 -08:00
jaykrell 20e69fa199 Centralize post-object creation code in mono_object_new_common_tail. (#6903)
This resolves inconsistency around support of weak fields (bug?)
and is smaller and easier to maintain.
2018-02-14 14:56:09 -08:00
Vlad Brezae a33cbb873c [interp] Fix native to interp transition (#6868)
When using the interp_wrapper to enter interp from native we don't need to save the lmf since it doesn't make sense to unwind to native. Also make sure we have the interp context set up if we weren't attached at interp transition time.
2018-02-14 23:09:59 +02:00
Zoltan Varga 7cac757e60 [aot] Emit the weak field indexes table using the MONO_AOT_TABLE code, so it works with separate aot data files/bitcode.
Fixes https://github.com/mono/mono/issues/6948.
2018-02-14 22:02:38 +01:00
Ankit Jain 8c90350d11 Add denied assembly versions from previous ms extensions nugets
Extracted from Microsoft.NET.Build.Extensions

	2.1.0-preview1-62414-02   # https://github.com/dotnet/cli/blob/501e11d928c21608999c934f0a7078570b688c6c/build/DependencyVersions.props
	15.5.0-preview-20171027-2 # https://github.com/dotnet/cli/blob/ed916bb13e798a470855fb4f60acd3cabb2765fc/build/DependencyVersions.props
	2.0.0-preview3-20170622-1 # https://github.com/dotnet/cli/blob/7c928a9f18f81001e586e5bf0411f9bfa92e30d4/build/DependencyVersions.props

And also remove incorrect entries from earlier version
2.1.0-preview1-62516-03 , which were not committed to mono's msbuild.

A future commit will sort and de-dedup the lists, but this one avoids
removing any existing duplicates, to make review easier.
2018-02-14 18:59:11 +01:00
Miguel de Icaza 47187bbc9b [Mono.Posix] .NET Core compatibility - Use [In,Out] for arrays of structures
While Mono does copy the values of arrays back when they are marshaled
to unmanaged code, .NET does not seem to be doing this, and manifests
as the Syscall.poll invocation in Mono.Posix with .NET Core does not update
the values in the provided array.

The following example should print "Got 1 and 1" with the following command:

```
echo foo | dotnet run
```

But instead prints 0 and 1 on .NET Core, but the correct result with Mono.

This patch is going here for the sake of the Mono.Posix.NetCore package that
we publish.

Sample:

```
using System;
using System.Runtime.InteropServices;

class X {
        private struct _pollfd {
                public int fd;
                public short events;
                public short revents;
        }

        [DllImport("libc")]
        static extern int poll ([In,Out]_pollfd[] ufds, uint nfds, int timeout);

        static void Main ()
        {
                var p2 = new _pollfd [1] { new _pollfd () { fd = 0, events = 1 } };
                var m = poll (p2, 1, -1);

                Console.WriteLine ("Got: {0} and {1}", n, pollmap [0].revents);
                Console.ReadLine ();
        }
}
```
2018-02-14 18:53:08 +01:00
Ludovic Henry 57f3f34e60 Revert "[coop] Remove support for invoke thunk wrapper" (#6927)
We still want to be able to invoke thunk wrappers. The transition to MonoHandle will be a separate change.

This reverts commit 150d896d19.
2018-02-14 12:03:23 -05:00
Rodrigo Kumpera 8d19e5a1c5 [runtime] Unboxing of nullable enums should throw for boxed ints. (#6958)
* [runtime] Unboxing of nullable enums should throw for boxed ints. Fixes gh #6666.

For some reason, one can't unbox the underlying type of an enum into a nullable.

This is counter intuitive to the unboxing rules of enums, but it's what dotnet does.

* [interp] Unboxing of nullable enmus should throw for boxed ints

fixes https://github.com/mono/mono/issues/6666 for the interpreter
2018-02-14 17:58:15 +01:00
Bernhard Urban 8f35227b88 [debugger] disable StepOutAsync test because it's flaky 2018-02-14 15:33:22 +01:00
Ludovic Henry 545191f773 Pass null-terminated string for logging 2018-02-14 11:54:06 +01:00
Bernhard Urban 2c1f45f379 [TermInfo] support new file format terminfo2 introduced with ncurses6.1 (#6960)
See also https://github.com/mirror/ncurses/commit/1501ae2a13db0ffd2db8404c24aa5010a88ea91b#diff-2c0786db969084ba9e087d82f8275e0b

Fixes https://github.com/mono/mono/issues/6752
2018-02-14 05:35:11 +01:00
Don Syme 3012ce06e4 Update F# to 4.1.33
Next update to F# to include regression fix Microsoft/visualfsharp#4348
2018-02-14 02:31:23 +01:00
Zoltan Varga ff98989579 [runtime] Avoid recreating the icall table in lookup_icall_symbol (). (#6988) 2018-02-13 19:42:37 -05:00
Zoltan Varga 17b4b28f05 [sdk] Fix the invocation of run-step.sh, the --timeout argument is mandatory. (#7013) 2018-02-13 18:04:49 -05:00
Zoltan Varga 3fdbbe5e44 [sdks] Fix the tar command since the llvm binaries are in different directories now. (#7010) 2018-02-13 23:01:41 +01:00
Rodrigo Kumpera f4d3da6d4a [runtime] Fix merge conflict and Move code to its right place. 2018-02-13 14:00:29 -08:00
Rodrigo Kumpera c3c6e6c9cd [runtime] Ignore FireProcessExit if the method is missing on corlib. 2018-02-13 12:30:18 -08:00
Rodrigo Kumpera b9b08c0d02 [runtime] Implement a domain resistant version of mono_domain_foreach and switch the unloading code to use it.
Ensure that the callback to mono_domain_foreach_safe can actually do stuff with the domain argument like running code.

This new function make it possible to do so safely, unlikely the previous one.

This ensures that the process exit callback has a shot of correctly executing on domains racily being unloaded.
2018-02-13 12:30:18 -08:00
Rodrigo Kumpera 755c5bd713 [runtime] Fix docstring for mono_unhandled_exception_checked. 2018-02-13 12:30:18 -08:00
Rodrigo Kumpera 4f8968cf6c [corlib] Fix minor style issue. 2018-02-13 12:30:18 -08:00
Rodrigo Kumpera 1fd32df7d1 [runtime] Introduce a non-fatal unhandled exceptions and use it for AppDomain::ProcessExit.
Introduce AppDomain::NonFatalUnhandledException icall that delivers an exception as an unhandled exception but don't fail the process.
2018-02-13 12:30:17 -08:00
Bernhard Urban c9c7dad3a3 Bump mono/NUnitLite
Commit list for mono/NUnitLite:

* mono/NUnitLite@0dc7716 [FinallyDelegate] make key for `lookupTable` actually unique (#6)

Diff: https://github.com/mono/NUnitLite/compare/a8bef89392920dd0ef5d74ef3563d97083246414...0dc7716771023274074160d1816c2fa610e23d2f
2018-02-13 21:25:33 +01:00
Rodrigo Kumpera dd2c320aa3 [runtime] Change domain before firing ProcessExit. 2018-02-13 12:24:12 -08:00
Rodrigo Kumpera 7500341ec0 [runtime] Run the ProcessExit events in the threadpool and enforce a 3 seconds limit. Fixes #10087
The ProcessExit event is fired before the threadpool is shutdown, so we can leverage that to run them
with a timeout.

The timeout is 3 seconds per appdomain. It could be improved by making that global to all domains if that
ever becomes an issue.
2018-02-13 12:24:12 -08:00
Rodrigo Kumpera 6e28ccb4e5 [utils] Add "exec" log category for misc runtime activity.
This is intended to be a catch-all category for all sorts of miscellaneous events
we don't have a clear category for and that don't deserve one.
2018-02-13 12:12:10 -08:00
Alexis Christoforides 96f2d163a3 Merge pull request #6970 from dsyme/patch-1
Bump F# mono version to 4.1.32
2018-02-13 13:37:20 -05:00
Marek Safar e52ef6aedd [build] Fixes monolite build (#6982) 2018-02-13 19:33:04 +01:00
monojenkins 36cbab657f [msvc] Update csproj files 2018-02-13 16:50:22 +01:00
Rodrigo Kumpera f61bc393d3 Simplify MonoError and managed Exception creation (#6123)
MonoError is simplified for MME by having the error message eagerly created, which simplifies things A LOT.
Managed Exception creation is simplified by only setting Message, as it's done by other runtimes.

* [mini] Fix mini_emit_memory_copy_internal with ref types and remove workaround from mono_method_to_ir

* [mini] Remove unused argument and rename function to better reflect its use.

* [utils] Fix swapped member and signature fields in error message.

* [runtime] Simplify MME by only setting the message field since ClassName/MemberName don't need to be set.

* [runtime] Add mono_error_set_method_missing to exceptions.c and collapse setting MME to a single function.

This implements the cleanup discussed in the PR.

* [runtime] Cleanup MonoError for BadImageFormatException.

Move mono_error_set_bad_image & mono_error_set_bad_image_name to exception.c.
Rename mono_error_set_bad_image_name to mono_error_set_bad_image_by_name.

Introduce mono_corlib_exception_new_with_args to be used when creating exception objects.
It's easier to consume than mono_exception_from_name_two_strings_checked as it takes string arguments as char*.

Fix usage of mono_error_set_bad_image_by_name to never dup the supplied image name as the callee does it.
Fix some empty error messages.

Finally, reduce the cruft in mono_error_prepare_exception by using the new exception creation function from above.

* [runtime] Cleanup MonoError of FileNotFoundException.

Move it to use the generic first_argument and make it a simple error - IE, get_message doesn't format anything.

* [runtime] Rework MonoError for MissingFieldException.

* Fix build issues

* [runtime] Ensure memory is freed using new MonoError set functions.
2018-02-13 16:24:00 +01:00
Alexander Kyte 60d4907f48 [runtime] Revert mkbundle defaulting behavior made in ca8b8bd346 (#6687)
Fixes https://github.com/mono/mono/issues/6187
2018-02-13 09:59:53 -05:00
Alexander Köplinger d8d3e29f38 Bump api-snapshot 2018-02-13 15:14:58 +01:00
Don Syme 0354912603 Bump F# mono version to 4.1.32
This version contains a fix to fsharpi to make no-gui the default again
2018-02-13 13:41:31 +00:00
Radek Doulik d573dec96e Bump linker and update linker-analyzer references 2018-02-13 14:31:03 +01:00
Vlad Brezae d6e7483454 [interp] Fix CEE_UNBOX
When unboxing nullable we call Nullable.Unbox which returns the valuetype, but CEE_UNBOX needs to return an address to it. Therefore we store the result in a local in the frame so we can get its address.
2018-02-13 13:44:01 +01:00
Aleksey Kliger (λgeek) 7a528f6f97 [sre] Unlock loader lock on error paths (#6951) 2018-02-12 20:48:27 -05:00
Alexander Köplinger e572acca55 [ci] Only create artifacts.json GitHub status on release branches 2018-02-13 02:00:13 +01:00
Alexander Köplinger 939d720770 [ci] Disable monodoc tests on Windows for now
They fail: https://github.com/mono/mono/issues/6956
2018-02-13 01:51:12 +01:00
Rodrigo Kumpera ea7b3849c4 Cleanup recent JIT fix to get it done in the right place. (#6895)
* [mini] Fix mini_emit_memory_copy_internal with ref types and remove workaround from mono_method_to_ir

* [mini] Remove unused argument and rename function to better reflect its use.
2018-02-13 00:22:06 +01:00
jaykrell 29d402d8e0 [handle] Have MONO_HANDLE_* macros use a uintptr_t instead of int (#6906) 2018-02-12 18:15:34 -05:00
Zoltan Varga 25c41cbf41 Fix gshared support for default interface methods by always passing an mrgctx to them. (#6935)
* Fix gshared support for default interface methods by always passing an mrgctx to them.

This is needed because these methods can be part of more than one inheritance hierarchy or
be present more than once in the same inheritance hierarchy so its not possible to
assign rgxtx slots to their gshared entries that would work in all cases.

* [jit] Add a mini_method_is_default_method () helper function.
2018-02-12 17:36:27 -05:00
Alexis Christoforides 1c631424d2 Merge pull request #6929 from mono/disable-test-TaskCancelWait1
[System.Threading.Tasks] Disable a flaky test (corefx bump)
2018-02-12 13:16:29 -05:00
Alexis Christoforides dcecd8ff83 Disable flaky test
(https://github.com/mono/mono/issues/6947)
2018-02-12 13:02:49 -05:00
Martin Baulig b97d0c43d1 [System]: WebConnection.Connect() needs to probe all IP addresses.
Fix a regression introduced in the new web stack - when connecting
to a DNS host name that resolves to multiple IP addresses, we need
to probe them all.

On iOS, "localhost" will resolve to both "::1" and "127.0.0.1".
2018-02-12 16:59:58 +01:00
jaykrell e43adf3cd5 Change mono_thread_resume_interruption to return void, one less raw pointer to worry about. (#6690) 2018-02-12 01:29:11 -05:00
jaykrell c944c358f1 [scripts] Fix scripts/update_submodules.sh for use with git worktree 2018-02-11 23:15:25 -05:00
Zoltan Varga 7f9167bc5b [runtime] Fix the --enable-icall-symbol-map build. (#6943) 2018-02-11 18:32:55 -05:00
Zoltan Varga 921132a362 [runtime] Make icall tables loadable. (#6905)
* [runtime] Make icall tables loadable.

Move the icall table code into a separate icall-table.c file, which is either linked into libmono or compiled into a
separate libmono-icall-table.a archive which can be linked into an app, and installed by calling mono_icall_table_init ().

* Change ClCompile to ClInclude for new .h file.
2018-02-11 10:43:07 -05:00
Alex Rønne Petersen d8beb3ef11 [profiler] Remove obsolete code coverage support from the log profiler. (#6896) 2018-02-10 15:57:52 -05:00
Zoltan Varga 48898cb810 [sdks] Fix ios+llvm. (#6939) 2018-02-10 10:47:47 -05:00
Zoltan Varga 7f47f19085 [runtime] Fix a warning. (#6937) 2018-02-10 10:23:50 -05:00
Vlad Brezae b970e766fa [interp] Add class failure checks 2018-02-10 10:14:05 +02:00
Vlad Brezae 52ebab8603 [interp] Fix varargs passing
We must not push one vararg at a time since the alignment of the argument is not the same as the alignment of a value type in interp (which is always 8)
2018-02-10 10:12:39 +02:00
Vlad Brezae 3369b6e214 [interp] Align vt stack in some places 2018-02-10 10:12:39 +02:00
Vlad Brezae 6ffa48f6ad [interp] Add define for value type alignment 2018-02-10 10:12:39 +02:00
Zoltan Varga 9f2b8595a3 [jit] Fix the DISABLE_JIT build. (#6933) 2018-02-10 02:14:04 -05:00
Zoltan Varga 5c4510a8a7 [runtime] Implement support for conflict detection for Default Interface Methods. (#6897)
Detect conflicts caused by diamond inheritance during vtable construction, and throw an exception when a conflicting
methods is called.
Disable generic sharing for default interface methods, it doesn't work yet, probably
because these methods are called on classes, but the gshared information is associated with the interface.
Enable dim-diamondshape.exe test.
2018-02-09 21:28:19 -05:00
Zoltan Varga 284c5afdf4 Bug 60088 - Assertion at ../../../../external/mono/mono/mini/debugger-agent.c:4765, condition `array->len == 1' not met (#6902)
Problem was that I didn't consider `async void` method when adding that assert
2018-02-09 19:15:32 -05:00
Alexis Christoforides 6a5a14bea7 [System.Threading.Tasks] Disable a flaky test 2018-02-09 17:48:19 -05:00
Alexis Christoforides dcda4c77bc Disable some PngCodecTest that have trouble on CI right now 2018-02-09 15:36:18 -05:00
Alexander Köplinger 5e7483f354 [System.Drawing] Disable tests except on ARM64 (#6909)
See https://github.com/mono/mono/issues/6908
2018-02-09 21:22:16 +01:00
monojenkins dd5b5ca52e Set NetworkStream.ReadTimeout in WebConnection.InitConnection(). (#6904)
Setting ReadTimeout in WebResponseStream.ctor throws System.Net.Sockets.SocketException : Invalid arguments on iOS.

Set it in WebConnection.InitConnection() immediately after establishing a connection, before we read/write anything.
2018-02-09 21:21:52 +01:00
Zoltan Varga 2a3b0812a4 [jit] Simplify some gshared code. (#6899)
* [jit] Simplify some gshared code by calling mini_method_get_rgctx () in more places, make mono_method_lookup_rgctx () static. NFC.

* [jit] Get rid of the 'method' argument to emit_get_rgctx (), it should always be equal to cfg->method. NFC.
2018-02-09 12:52:26 -05:00
Bernhard Urban 2a3c498cbf [interp] disable test_42_arm64_dyncall_vtypebyval
regression test introduced by https://github.com/mono/mono/pull/6826
fails on ARM64 with interp
2018-02-09 17:29:36 +01:00
Ankit Jain 43617b0123 nuget-hash-extractor: Add msbuild extensions nuget to list of nugets to
.. process. Version from:

https://github.com/dotnet/cli/blob/501e11d928c21608999c934f0a7078570b688c6c/build/DependencyVersions.props

```
    <MicrosoftNETSdkPackageVersion>2.1.0-preview1-62414-02</MicrosoftNETSdkPackageVersion>
    <MicrosoftNETBuildExtensionsPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftNETBuildExtensionsPackageVersion>
```

Also, update the list in the runtime and deniedAssembliesList.txt
installed for use by msbuild.
2018-02-09 11:28:48 -05:00
Ankit Jain 4cb7884477 nuget-hash-extractor: Add support for handling nuget with multiple
.. assemblies.

This is specifically required for handling .net assemblies in
`Microsoft.NET.Build.Extensions` nuget which don't work on mono. These
assemblies are bundled with msbuild and we want to be able to deny these
at runtime.
2018-02-09 11:28:48 -05:00
monojenkins d2998f5089 [msvc] Update csproj files 2018-02-09 11:24:46 -05:00
Marek Safar 71ad99f720 [build] Narrow recursive dependencies 2018-02-08 23:49:44 -05:00
Marek Safar b3d60257e5 [Mono.Security] Remove unused using 2018-02-08 23:49:44 -05:00
Rodrigo Kumpera 06b836ed91 [wasm] Make v8 build verbose and fix zip package root. (#6900) 2018-02-09 02:27:17 +01:00
Tychshenko, Dmitriy 06a89a59bc Adjust tabbing. 2018-02-08 16:52:39 -05:00
Tychshenko, Dmitriy b2ec39daa5 Add ordinal comparison when matching request path to listener paths 2018-02-08 16:52:39 -05:00
Tychshenko, Dmitriy 8917ddfb0c Fixes WCF methods with path parameters in UriTemplate annotation. Bugzilla bug #25444 [https://bugzilla.xamarin.com/show_bug.cgi?id=25444] 2018-02-08 16:52:39 -05:00
Tychshenko, Dmitriy f3b1c9bd88 Pick the Listener that matches the start of the request URL 2018-02-08 16:52:39 -05:00
Alexander Köplinger c84e6c81a2 [bcl] Fix more assembly identity mismatches (#6870)
As a follow up to https://github.com/mono/mono/issues/6848 I checked
all the assemblies and found some more identity mismatches with .NET
2018-02-08 22:22:37 +01:00
Rodrigo Kumpera 9adf4bd322 [wasm] Add system test suite exclude file. (#6847) 2018-02-08 22:08:17 +01:00
Ludovic Henry b6784b27a5 [sdks] Fix build for iOS (#6878) 2018-02-08 14:36:07 -05:00
Alexander Köplinger 3f61f9ff5d configure.ac: Only use library path in libgdiplus_loc
We use the value defined there to insert into `config` file in
runtime/Makefile.am and this would get the "preinstalled at" string.
2018-02-08 20:32:17 +01:00
jaykrell af03c6ae83 Detect libgdiplus in configure.ac by default on MacOSX (darwin). (#6873) 2018-02-08 20:02:45 +01:00
Alexander Köplinger b3eabd51c3 Bump bockbuild 2018-02-08 19:42:41 +01:00
Martin Baulig 8bfcb27147 [System]: Revert my latest WebResponseStream changes.
This reverts PR #6662 (commit 18a1a25) and #6771 (commit da03780).

These two changes introduced a regression:
https://github.com/mono/mono/issues/6788
2018-02-08 12:52:36 -05:00
Alexander Köplinger b9d463acb5 Bump bockbuild to get new gtk+ repo location 2018-02-08 17:54:05 +01:00
monojenkins 8e678de3f3 [msvc] Update csproj files 2018-02-08 11:38:43 -05:00
Marius Ungureanu a5078a2815 Bump bockbuild to add gtk# generator fix (#6880)
Bug 61202 - Fatal error when adding aspect ratio constraint
2018-02-08 15:32:10 +01:00
Alexis Christoforides 3203c8bfb3 Merge pull request #6835 from alexischr/disable-monitor-wait-test
Disable a couple of flaky tests (monitor-*abort)
2018-02-07 22:59:27 -05:00
Ludovic Henry fcb97b2279 [sdks] Add Android build for CI (#6846) 2018-02-07 22:16:38 -05:00
jaykrell 149073b84c Use gpointer (void*) as a generic pointer, not char*. (#6704)
This allows for removing many casts, and casts are bad.

Also, gulong does not hold a pointer on Win64, favor uintptr_t (or gsize).
2018-02-07 17:35:19 -08:00
Alexander Köplinger 31784ba06c [reference-assemblies] Fix public key for some newer v4.7.1 facades (#6863)
Fixes https://github.com/mono/mono/issues/6848
2018-02-08 01:07:39 +01:00
Ludovic Henry 1ad2fc4891 [sdks] Fix download-llvm.sh 2018-02-07 17:29:51 -05:00
Bernhard Urban 9cab3d73c6 [timezone] ignore LocalId test on XAMMAC_4_5 too
https://github.com/xamarin/maccore/issues/628
2018-02-07 23:14:02 +01:00
Ludovic Henry 2c96890aff [sdks] Fix execution permission of download-llvm.sh 2018-02-07 15:31:02 -05:00
Martin Baulig e9235144ca Bump corefx. (#6810) 2018-02-07 21:13:11 +01:00
Aleksey Kliger (λgeek) 766bf49afb [metadata] Define getters for MonoClass fields (#6652)
* [configure.ac] Add --enable-checked-build=private_types option

  The idea is that when private_types is turned on, we will hide the definitions
  of various structs in Mono and only allow access via getter/setter
  methods.

  If private_types is off, those same getters would be static inline functions
  and also the struct definition would be visible (to allow for incremental
  conversion of existing code).

* [metadata] Move _MonoClass definition to class-private-definition.h

* [metadata] Define a getter for every MonoClass field

  in a checked build, the getters are just declared in class-internals.h and
  defined in class-accessors.h

  in a non-checked build, the getters are static inline functions in class-internals.h

  For a field foo of type FooType define
      FooType m_class_get_foo (MonoClass *klass) { return klass->foo; }

  The exceptions are fields that are embedded structs, e.g. MonoType byval_arg,
  for those we return a pointer to the field instead of a copy:
      MonoType * m_class_get_byval_arg (MonoClass *klass) { return &klass->byval_arg; }

* [metadata] Rename MonoClass boolean getters to use is/has names

  instead of the string m_class_get_fieldname pattern

  - m_class_is_inited
  - m_class_is_size_inited
  - m_class_is_valuetype
  - m_class_is_enumtype
  - m_class_is_blittable
  - m_class_is_unicode
  - m_class_was_typebuilder
  - m_class_is_ghcimpl
  - m_class_has_finalize
  - m_class_is_delegate
  - m_class_is_gc_descr_inited
  - m_class_has_cctor
  - m_class_has_references
  - m_class_has_static_refs
  - m_class_has_no_special_static_fields
  - m_class_is_com_object
  - m_class_is_interfaces_inited
  - m_class_is_simd_type
  - m_class_is_has_finalize_inited
  - m_class_is_fields_inited
  - m_class_has_failure

* [metadata] (class-internals.h) Use m_class_get_ getters

* [metadata] (class-inlines.h) Use m_class_get_ getters

* [metadata] (class-accessors.c) Use m_class_get_ getters; setters not done

  The setters are not converted.
  Ultimately, I think that will sort itself out - a few of them are only used
  from SRE and from MonoClass construction - we will eventually provide setters
  for just two places and hide them elsewhere.
2018-02-07 13:01:19 -05:00
Egor Bogatov c1fd4b064d Add stubs for Interop.NetSecurityNative (#6824) 2018-02-07 10:48:05 -05:00
Zoltan Varga d813c533b9 [arm64] Handle arguments of type ArgVtypeOnStack in the dyn call code. Part of the fix for #59184. (#6826) 2018-02-07 10:29:49 -05:00
Ludovic Henry d79a892d77 [configure.ac] Do not always enable ninja (#6823) 2018-02-07 09:47:57 -05:00
Alexis Christoforides 0a3d7c0da6 Disable a couple of flaky tests (monitor-*abort) 2018-02-07 09:21:57 -05:00
Ludovic Henry 43026da5d4 [sdks] Bring back download of llvm for iOS (#6818)
Revert part of https://github.com/mono/mono/commit/605cadfb09d6c79723763b8afd09480a5941eabf
2018-02-06 18:56:32 -05:00
Alexander Köplinger f8a4bbd357 [ci] Add setting artifacts.json status
Needed for QA automation.
2018-02-07 00:41:53 +01:00
Alexander Köplinger 687dc212dc [ci] Add Windows .msi PR build (#6815)
Use the trigger `@monojenkins build pkg and msi`.
2018-02-07 00:31:28 +01:00
Vlad Brezae 4b8e0bea19 [interp] Add support for vararg call convention
When doing a vararg call we push on the vtstack the current call signature followed by the params. The child_frame will have a pointer to this memory on the parents vt_stack from where it can linearly access the varargs using the same ArgIterator logic.
2018-02-06 16:15:51 +01:00
Vlad Brezae f6786099a5 [glib] Include ALIGN_TO and ALIGN_PTR_TO 2018-02-06 16:15:51 +01:00
Vlad Brezae d3647fa17e [interp] Add storage fetching for typedbyref
Which is just a structure.
2018-02-06 16:15:51 +01:00
Vlad Brezae c8b7d6eece [interp] Add class check for refanyval 2018-02-06 16:15:51 +01:00
Vlad Brezae b66cbf955f [interp] Remove virtual call duplicated code 2018-02-06 16:15:51 +01:00
Vlad Brezae c3c2819da7 [interp] Remove void call duplicated code 2018-02-06 16:15:51 +01:00
Vlad Brezae ed9e0d101d [interp] Rename variable 2018-02-06 16:15:51 +01:00
Vlad Brezae f6964ef658 [interp] Remove some null checks
We emit explicit MINT_CKNULL. Add missing null check for internal multidimensional array runtime calls.
2018-02-06 16:15:51 +01:00
monojenkins e8cdc382a7 Bump API snapshot submodule 2018-02-06 09:52:24 -05:00
Egor Bogatov 1dd3fd1c64 Add missing api to System.Data (fixes 6767) 2018-02-06 09:52:24 -05:00
Rodrigo Kumpera 386b4d2bc6 [Mono.Posix] Fix the Android xattr check to not disable it on all other platforms. 2018-02-06 09:05:48 -05:00
Zoltan Varga 9317773e68 [tests] Disable threads-init.exe, it runs out of system threads. (#6803) 2018-02-06 00:04:18 -05:00
Alex Rønne Petersen 63652bfc25 [utils/threads] Gracefully handle ENOTSUP from pthread_kill () on Apple platforms. (#6754) 2018-02-05 17:33:04 -05:00
jaykrell 96082e3495 Fix some function pointer types to match, i.e. so C++ compiles w/o extra casts. (#6732) 2018-02-05 14:21:44 -08:00
Ludovic Henry ed4331a3d8 [ide] Add setup file for VSCode 2018-02-05 16:48:30 -05:00
Aleksey Kliger (λgeek) 993ed19a6f [metadata] Move MonoClass initialization to a separate file (#6611)
Use `git blame -C10 mono/metadata/class-init.c` to see attribution for most of the old code.

This PR comprises:

* [metadata] Move (some) MonoClass construction to class-init.c

So far moved MonoClassDef, MonoClassGtd and MonoClassGenericInst construction
functions.

The idea is to eventually isolate functions that needs write/setter access to
MonoClass fields in a separate translation unit and make MonoClass opaque and
only accessible via getters everywhere else.

* [metadata] Move pointer MonoClass creation to class-init.c

* Mark mono_ptr_class_get as external only, runtime should use
  mono_class_create_ptr.

* [msvc] Add mono/metadata/class-init.c (and .h) to the .targets file

* [metadata] Rename mono_generic_class_get_class

to mono_class_create_generic_inst

* [metadata] Move array class creation to class-init.c

* Mark mono_array_class_get external only, runtime should use
  mono_class_create_array
* Mark mono_bounded_array_class_get external only, runtime should use
  mono_class_create_bounded_array

* [metadata] Move generic param creation to class-init.c

* Also move mono_class_setup_vtable_general, mono_class_init_sizes, mono_class_setup_methods

* [metadata] Move mono_class_setup_basic_field_info to class-init.c

* [metadata] Move mono_class_setup_fields to class-init.c

* [metadata] Rename mono_class_from_generic_parameter_internal

to mono_class_create_generic_parameter

* [metadata] Move mono_class_layout_fields to class-init.c

* [metadata] Move mono_class_setup_{properties,events} to class-init.h

* [metadata] Move mono_class_setup_interfaces to class-init.c

* Also move mono_class_setup_mono_type

* [metadata] Move mono_class_setup_parent to class-init.c

* [metadata] remove some extern statistics
2018-02-05 16:31:42 -05:00
Zoltan Varga f01083ac48 [runtime] Add a 'frame_addr' field to MonoStackFrameInfo, which is equal to either interp_frame or ctx->sp. (#6644)
* [runtime] Add a 'frame_addr' field to MonoStackFrameInfo, which is equal to either interp_frame or ctx->sp.

Use this field to compare frames with each other or with stack addresses instead of setting ctx->sp to
the interp frame address, which breaks mixed mode, since mixed mode assumes ctx->sp is the real
sp of the last native interpreter frame.

* [ci] Reenable mixed mode tests.
2018-02-05 16:28:46 -05:00
Alexander Kyte c0bd5f8a5a [sdks] Script lldb android integration (#6310) 2018-02-05 15:47:35 -05:00
Alexander Köplinger c7f89e7837 [ci] Make sure packageFileName is a string
It was the file object before and just got turned into string
by coincidence in most places.
2018-02-05 21:35:12 +01:00
Ludovic Henry 51ec3ddf99 Bump version to 5.13 (#6792) 2018-02-05 15:21:08 -05:00
Martin Baulig da03780370 [System]: WebResponseStream now correctly reads the chunk trailer when using gzip/deflate. (#6771)
* [System]: WebResponseStream now correctly reads the chunk trailer when using gzip/deflate.

This should actually fix bug #59779.

* Add missing ConfigureAwait(false)
2018-02-05 14:45:56 -05:00
Alexander Köplinger 0bfda265b7 [ci] Report pending/failed status on GitHub for pkg/msi 2018-02-05 17:29:02 +01:00
Alexander Köplinger 4682391599 [ci] Include commit hash in blob URL of pkg/msi
This makes it easier to infer the commit just based on the URL.
2018-02-05 17:29:02 +01:00
Calvin d568c0b28d Support IBM AIX on POWER (#6677)
* Get autotools scripts for Mono and Boehm to recognize i

PASE is most similar to AIX, and perhaps I assume other commercial
Unices, as well as PowerPC Linux, so grab variables from them as
needed.

With this, we get glib failing to build due to missing mkdtemp.

* Use better cpp definition to grab more of what we want

* Fix random and 64-bit file offset support

* Set TARGET on IBM i on POWER

* Add hack to gfile-unix.c to work around flawed AIX header

From comment:

/* HACK: the preprocessor will not give us mkdtemp no matter
   what and Mono (for good reason) does
   "-Werror-implicit-function-declaration" so we error out;
   instead declare mkdtemp here; the linker will find mkdtemp
   anwyays. libuv has had similar issues, but they just ignore
   the compiler warning instead of failing on it.

   See: github.com/libuv/libuv/pull/740 */

* Work around missing definition on AIX/PASE

* Fix conflicting definition from due too AIX headers

* Initial work to get JIT working on AIX

* uncertain about NIP; is IAR the right register? need review from
  PPC asm people

* needs calling convention work; AIX does NOT use ELF

* Fix lack of casting on sigcontext macros, fix errnos for AIX

* AIX doesn't distinguish between ENOTEMPTY and EEXIST without a
  define. Handle this case with a conditional cpp directive..

* When ctx is a void pointer, dereferencing as a struct will fail.
  Handle this case with a cast.

* Handle regular AIX as well as PASE

* Implement stack boundaries check for AIX, volume info func

* vol info should be like other Unix, just needs to bridge ifdef

* highly uncertain for the bounds checking, needs further review

* Fix typo in mono/utils/mono-threads-aix.c

* In boehm-gc.c, don't use pthread_getattr_np on AIX even if available

It's not available on IBM i, and even if available, toolchains for AIX
may "helpfully" swap out system headers with variants that remove
functions like pthread_getattr_np.

* Don't use "-export-dynamic" on non-GNU ld

IBM ld considers "-e" to be a flag for setting the entry point.
Detect non-GNU ld, and offer equivalents when possible.

The makefile in mini had to be changed as a result due to
hardcoded flags.

* Use pthread-stop-world.c on AIX

Remove an ifdef that gated this off to AIX. It seems the old AIX
specific files shouldn't be used, and that the changelog for libgc
says pthread should work fine on AIX instead; yet it was blocked.
Restore this, as it compiles and seems to let mono-boehm link fine.

* AIX workarounds for some of support dir

* fstab on AIX is there, but defines a struct more like other
  platforms' checklist struct.

* AIX, like macOS and some BSDs, doesn't define some serial types.

* psignal is another victim of GNU; even then it isn't in PASE
  headers anyways

* More support workarounds for AIX headers

* Replacement function body for syslog2 on vsyslog-less platforms

AIX lacks vsyslog; detect in autoconf and act appropriately.

* Final support hacks for AIX

* Fix problematic stack management on AIX

this gets us past ifdefs, after much handwringing

* get the right end of the stack; r1/stack pointer is on the wrong
  end and ustk is just plain broken

* AIX doesn't seem to like the semantics of the mmap call valloc
  does here; either we're allocating into an area we shouldn't be
  or we're not passing the right flags. Until then, learn to live
  without the stack guard?

* Disable Boehm GC on AIX

Focus on getting SGen working, and avoid legacy debugging nonsense

* Remove AIX ifdef-undef and replace with s/hz/uhz

* Don't use sigaltstack on AIX due to bugginess with guard sections

The valloc call on AIX has issues after issuing mprotect; don't do
do it. I believe it fails because we aren't issuing the right
flags on AIX, or because we're allocating inside of an already
allocated area.

* Perform a 64-bit build on AIX

We still crash at the same place, but probably for the best that
we switch to 64-bit. (Maybe we could make it configurable?)

* Fix func descriptor ifdef, add initial (likely wrong) defs for AIX

* AIX doesn't define __powerpc64__ or __ppc64__ when compiling as
  64-bit. Use an alternate ifdef, and shuffle around that ifdef
  anyways, as it could lead to wrong results on other platforms
  too.

* AIX likely needs special definitions, especially on 32-bit. The
  calling convention is closest to PPC64BE Linux, but not exactly.

* Fix stack size on AIX

Ruby dealt with this before: https://github.com/ruby/ruby/commit/a2594be783c727c6034308f5294333752c3845bb

* Set up initial PPC hwcap for AIX, fix ftnptr ifdefs, tweak AIX defs

* Fix hwcap to use better values on PPC AIX

Still needs more adjustment though

* Fix alignment issue on AIX, tweak mini-ppc values just a bit more

* On AIX, doubles are always aligned by 4 if they're in structs.
  Since we need to have them aligned by 8 on 64-bit, this is bad,
  so change the type on AIX.

* We can use this definition on AIX

Now we can bootstrap Mono!

* Shuffle MonoArray ifdef per suggestion of @vargaz

* Fix System.Decimal division on big endian systems

Before, we got non-sensical overflow on things like
`(Decimal)Int32.MaxValue / 1000`; now they get the same value,
comparing this POWER6 running AIX to my server's output running
OpenBSD/amd64.

* Fix dynamically linked build of Mono on AIX

nm wasn't seeing 64-bit symbools as it defaults to 32-bit mode,
also never try to use GNU nm

* Fix PPC64 define in mono-config

Interestingly, there was an AIX define already present, and that
definition is present in AIX's passed includes, so continue to use
it.

* Don't use __thread even if detected on AIX

tl;dr: The assembler gets angry with __thread and minimal-toc, and
changing options to replace minimal-toc causes linker issues; this
TLS option isn't important anyways if we have pthread instead,
like before when we were using Perzl's old GCC without __thread.

* Get lib.a(lib.o) type archives working with P/Invoke for AIX

AIX libraries are very, very strange compared to other Unices.

I'm not entirely sure if this is correct or optimal; it may need
to special case further. For now, it's enough to get gacutil
up and running.

Some resources I found useful for this charade:
<http://stromberg.dnsalias.org/~dstromberg/AIX-shared-libs.html>

Also set libc and libintl to their proper values.

* Scheduling priority hack for i

PASE doesn't accept anything other than SCHED_OTHER, and the funcs
for getting min/max don't work either. AIX suffers, but only a
little bit.

* Final polish on request

Remove Boehm changes if we don't use Boehm, tweak some defines,
remove some externs, tweak autoconf file

* Be aware of ERESTART, on OSes that use it

Instead of EINTR/EAGAIN, AIX uses ERESTART. Handle this, so things
like xsp are less chatty when performing async IO.
2018-02-05 17:17:20 +01:00
Alexander Köplinger 8fca785bcb Update README.md with new links to builds 2018-02-05 15:01:40 +01:00
Alexander Köplinger eafd6e916f [ci] Consistently use CI_TAGS instead of label (#6782)
The `label` environment variable is set by Jenkins based on the
chroot/node configuration a given job is using.

This crept into the CI scripts while it should have been a
separate concern and caused all sorts of issues when we bumped
from e.g. debian-8-* to debian-9-* in some jobs.

Instead we should consistently use the CI_TAGS env var which we
control exclusively.
2018-02-05 13:58:59 +01:00
Zoltan Varga 73eb0cc2fd Fix a regression introduced by e05343ddf5: Disable the ldobj+stobj optimization
for reference types.

Fixes https://github.com/mono/mono/issues/6777.
2018-02-04 18:34:47 -05:00
Marek Safar 9c3ed250a7 [System] Disable few tests which blocks when run on main loop 2018-02-03 21:17:55 -05:00
Alexander Köplinger 338c7957cd [boringssl] Bump to include Neale's big endian fixes (#6761)
https://github.com/mono/boringssl/pull/4 and followup 2ba8564f8b6.
2018-02-03 03:02:04 +01:00
Ludovic Henry 34a684da0f [sdks] Fix build for llvm (#6770)
* [sdks] Fix build for llvm

* [sdks] Have .stamp-%-configure always depend on .stamp-%-toolchain

* [sdks] Dependencies on directories should always be order-only
2018-02-02 20:48:31 -05:00
Alexander Köplinger 33a445d0fb [m4] Drop autoconf min version in ax_check_compile_flag.m4 (#6764)
It should work with earlier versions too and prevent issues like
https://lists.dot.net/pipermail/mono-devel-list/2018-February/044638.html
2018-02-03 01:02:24 +01:00
Ludovic Henry 605cadfb09 [sdks] Add more targets for XA (#6678)
* [sdks] Remove redundant dependency

* [sdks] Build mxe-Win{32,64}

* [sdks] Build host-{Darwin,Linux,mxe-Win{32,64}}

* [sdks] Build llvm-llvm{win,}{32,64}
2018-02-02 16:14:15 -05:00
monojenkins d3da6980cc [msvc] Update csproj files (#6758) 2018-02-02 20:19:49 +01:00
Zoltan Varga 42feadda8c [jit] Avoid extending the size of Vector2/Vector3 to 16 bytes. Disable SIMD for these types for now, since the SIMD code can't handle types (#6746)
which are smaller than a SIMD reg.

Fixes https://github.com/mono/mono/issues/6411.
2018-02-02 14:18:29 -05:00
Bernhard Urban b86aa686dc [interp] build library of interp even if it's disabled and ship it
so the install directory looks like this:

```
$ find . -name '*interp*'
./lib/libmono-ee-interp.la
./lib/libmono-ee-interp.dylib
./lib/libmono-ee-interp.0.dylib
./lib/libmono-ee-interp.a
```
2018-02-02 17:41:02 +01:00
Marek Habersack 4a99504591 Check for compiler switches to mitigate Spectre/Meltdown
This commit implements checking whether the compiler used to build mono supports
the recently added switches to generate code designed to mitigate the effects of
the Spectre/Meltdown bugs of the modern CPUs (https://meltdownattack.com/).

As of this commit the options are implemented for GCC 8.x, 7.3 and backported to
some older versions of gcc 7.x (e.g. in Ubuntu). The options tested for, and
used, here are:

  -mindirect-branch (https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/x86-Options.html#index--mindirect-branch)
  -mfunction-return (https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/x86-Options.html#index--mfunction-return)

Checks and usage of the above flags is hidden behind the
`--with-spectre-mitigation` configure option, defaulting to `no`.

Two additional options are implemented to specify the kind of thunk to implement
by each of the flags above:

  --with-spectre-indirect-branch-choice=keep,thunk,inline,extern
    Convert indirect branches to the specified kind of thunk (defaults to inline)

  --with-spectre-function-return-choice=keep,thunk,inline,extern
    Convert function return instructions to the specified kind of
    thunk (defaults to inline)
2018-02-02 08:53:02 -05:00
Zoltan Varga 9b3e3187d9 [jit] Fix OP_ICONV_TO_OVF_I8_UN, it should use OP_ZEXT_I4 instead of a 0 shift which can be eliminated by cprop. (#6753)
Fixes https://github.com/mono/mono/issues/6721.
2018-02-01 19:55:27 -05:00
Martin Baulig 5f8a128064 [System]: Use WebClient from CoreFX. (#6711)
The CoreFX version has a few error checks which are not in the
referencesource, switching to CoreFX allows us to enable their tests.

Use Path.GetRandomFileName() and Path.GetTempFileName() in tests.
2018-02-01 23:45:30 +01:00
Martin Baulig 18a1a25345 [System]: Refactor and cleanup WebResponseStream (#6662)
We are now using nested streams to take care of buffering, chunked encoding and automatic decompression.

GZip / Deflate decompression have been moved inside `WebResponseStream`, the `HttpWebResponse` now always returns a `WebResponseStream` (and not a `GZipStream`) because we have to do extra book-keeping after reading the entire content.
2018-02-01 23:39:46 +01:00
Zoltan Varga 115915b3ca [runtime] Fix the build with the --disable-libraries configure option. (#6750) 2018-02-01 13:09:38 -05:00
Zoltan Varga b84d6664c9 [sdks] Remove obsolete --with-glib=embedded configure option. (#6751) 2018-02-01 13:08:32 -05:00
Rodrigo Kumpera 45d6269774 [wasm] Fix nunit dep description. (#6749) 2018-02-01 15:07:23 +01:00
Marek Safar 4a95673dc0 [github] Add issues template (#6739) 2018-02-01 00:40:53 +01:00
Alexander Köplinger ac20560ae5 Merge pull request #6728 from alexrp/master
[sgen] Don't report gc_resize profiler events from worker threads.
2018-01-31 22:52:31 +01:00
Aleksey Kliger (λgeek) ca11e233b1 Fix warnings (#6685)
* [checked-build] Fix warnings in g_free of g_getenv results

```
checked-build.c:63:12: warning: passing 'const gchar *' (aka 'const char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                        g_free (env_string);
                                ^~~~~~~~~~
../../mono/eglib/glib.h:126:20: note: passing argument to parameter 'ptr' here
void g_free (void *ptr);
                   ^
checked-build.c:79:12: warning: passing 'const gchar *' (aka 'const char *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                        g_free (env_string);
                                ^~~~~~~~~~
../../mono/eglib/glib.h:126:20: note: passing argument to parameter 'ptr' here
void g_free (void *ptr);
                   ^
```

* [boehm] Fix warning in GC_push_all call

```
boehm-gc.c:603:17: warning: incompatible pointer types passing 'HandleChunkElem [125]' to parameter of type 'ptr_t' (aka 'char *') [-Wincompatible-pointer-types]
                        GC_push_all (cur->elems, (char*)(cur->elems + cur->size) + 1);
                                     ^~~~~~~~~~
../../libgc/include/private/gc_priv.h:1318:34: note: passing argument to parameter 'bottom' here
void GC_push_all GC_PROTO((ptr_t bottom, ptr_t top));
                                 ^
```
2018-01-31 16:30:16 -05:00
Rodrigo Kumpera 8af222e188 [wasm] Fix WASM CI script. (#6741) 2018-01-31 19:22:22 +01:00
Marek Safar fd186ce1b6 [github] Tweaks to issue template 2018-01-31 09:58:46 -05:00
jaykrell 264c1ad840 Save 1K of stack and an extra string copy when a heap allocation was going (#6720)
to be done unconditionally anyway. And make it valid C++.
2018-01-31 09:43:40 -05:00
Bernhard Urban fe9b82fec5 [ci] update ARM label for ignored interpreter tests (#6738)
image got upgraded for interpreter lanes too
2018-01-31 15:41:41 +01:00
jaykrell 28b1a7a79e [threads] Return boolean instead of pointer from Thread_internal (#6661) 2018-01-31 09:27:24 -05:00
Vlad Brezae c0dd0232af Revert "[mini] Align stack when resuming to catch handler"
This reverts commit ab20369d5f.

It breaks llvm EH : https://github.com/xamarin/xamarin-macios/issues/3241
2018-01-31 06:34:32 -05:00
Aleksey Kliger 9a8b2b6c30 [interp] Don't use external only functions in transform.c
Switch over to various _checked alternatives and propagate the MonoError outwards
2018-01-31 11:49:00 +01:00
Aleksey Kliger 833e9c1569 [interp] config.h must be included first; only by .c files
Not by headers.
2018-01-31 11:49:00 +01:00
Aleksey Kliger c7c7b8d0b8 [interp] Fix some leaking error paths in generate ()
If there's an error, we should free the TransformData before returning
2018-01-31 11:49:00 +01:00
Aleksey Kliger 9e96492f47 [metadata] New method mono_method_has_no_body
Returns TRUE if the method flags indicate that it's not expected to have a
body because it is abstract, a PInvoke, an internal call or a
runtime method.
2018-01-31 11:49:00 +01:00
Zoltan Varga 826f931c5c [runtime] Avoid building a separate static library, use the shared object files for the static library as well. (#5233) 2018-01-31 11:48:08 +01:00
EgorBo 90d11817f8 fix leak in FontFamily 2018-01-30 23:03:43 -05:00
Marek Safar 2c52be83e2 Bump corefx 2018-01-30 15:34:52 -05:00
Alex Rønne Petersen 6e596beb22 [sgen] Don't report gc_resize profiler events from worker threads.
See 4acc3dfeed for why this is problematic. The
bug was introduced in d7ac79ccc0.

This fixes an occasional deadlock in the profiler stress tests.
2018-01-30 16:22:06 +01:00
Alex Rønne Petersen 1216780e83 [acceptance-tests] Some improvements to the profiler stress runner.
* Print combined stdout and stderr in console output.
* Print the RNG seed used for a test run on startup and in the test report.
* Set the individual test timeout back to 6 hours.
* Use the nodefaults profiler option.
* Allow configuration through environment variables:
 - MONO_PROFILER_STRESS_OPTIONS: Specify a set of profiler options to use
   instead of the randomly generated ones.
 - MONO_PROFILER_STRESS_REGEX: Specify a regular expression to filter which
   tests should be run.
 - MONO_PROFILER_STRESS_SEED: Specify the RNG seed. Useful for reproducing full
   test runs at a later point.
 - MONO_PROFILER_STRESS_TIMEOUT: Specify a different individual test timeout
   from the default.
2018-01-30 16:22:01 +01:00
Martin Baulig e9d967f661 [System]: Enable ServicePoint tests from CoreFX. 2018-01-30 08:01:50 -05:00
Michael Sørensen 78f653d7f8 fixed markdown syntax 2018-01-29 21:21:18 +01:00
Marek Safar c6369ccce2 [corlib] Optimization for stacktrace build up 2018-01-29 21:20:46 +01:00
Alexander Köplinger 7579c53569 [ci] Reenable System.Runtime.CompilerServices.Unsafe-xunit on 32bits (#6708)
The corefx bump was done so we can reenable this.

Fixes https://github.com/mono/mono/issues/6379.
2018-01-29 19:44:31 +01:00
Marek Safar 030afc1db4 [packaging] Bump mono-basic to bring latest fixes (#6706) 2018-01-29 15:28:42 +01:00
Alexander Köplinger 4831b1cd0b [packaging] Move GitHubCommitStatusSetter into node 2018-01-29 14:01:28 +01:00
Alexander Köplinger 1177d7cad9 [packaging] Add GitHub status for packaging result
PKG-mono for the OSX .pkg and MSI-mono_{x86|x64} for the Windows .msi
2018-01-29 12:42:45 +01:00
Bernhard Urban 0acf7ff606 [interp] use libmonoldflags (to enforce -no-undefined)
it has the right logic to avoid this:

```
ld: -undefined and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
```

i.e. setting `-no-undefined`. However, this requires that we link
against `libmonosgen` on those platforms.
2018-01-29 10:41:36 +01:00
Jonathan Chambers 65389bd4f2 Remove extra reference count on images loaded via byte array. (#6656) 2018-01-28 10:55:58 -05:00
Alexander Köplinger b153e9074a [packaging] Fix variable 2018-01-28 01:34:44 +01:00
Alexander Köplinger 3238bf3586 [packaging] Move setting build description to end
This ensures we don't advertise the link if e.g. signing fails.
2018-01-28 00:05:33 +01:00
Alexander Köplinger 758154731a [packaging] Add signing to Windows build 2018-01-28 00:05:33 +01:00
Alexander Köplinger d9a7a04f05 [packaging] Produce correct Windows .msi file name
We've been using a certain pattern for the Windows .msi for a long
time but the build output used a different name which we simply
manually renamed before publishing.

Since we want to automate as much as possible we can change the
build to produce the correct name right away.
2018-01-28 00:05:33 +01:00
Alexander Köplinger 4248d073d6 [packaging] Set MONO_BUILD_REVISION for OSX package build (#6698)
Otherwise the default bockbuild behavior is to use the tip of
MONO_BRANCH which is not what we want when building on Jenkins.
2018-01-28 00:04:07 +01:00
monojenkins 4506807e67 [msvc] Update csproj files (#6696) 2018-01-27 20:22:02 +01:00
Marek Safar 386d63a13b [build] Add recursive run-xunit-test target 2018-01-27 11:31:13 +01:00
Marek Safar b55c24911f [corlib] Implements StackTraceHiddenAttribute 2018-01-27 09:51:07 +01:00
monojenkins 27480ee50d Bump API snapshot submodule 2018-01-26 19:04:04 +01:00
Marek Safar 1f7a31c9f0 Bump api-snapshot 2018-01-26 19:04:04 +01:00
Marek Safar 8d1928a0a7 [System.Core] Enable more tests 2018-01-26 19:04:04 +01:00
Marek Safar 28d577d63f Bump corefx 2018-01-26 19:04:04 +01:00
Vlad Brezae 3c0e572280 [interp] Don't push lmf with no interp frame data 2018-01-26 13:56:51 +01:00
Alexis Christoforides d7f2e40b7a Merge pull request #6674 from lambdageek/gitignore-string-test
[unit-tests] Add test-mono-string to .gitignore
2018-01-25 19:33:49 -05:00
Alexis Christoforides 4bdc132f51 [scripts] mac-sdk-package.sh now uses command-line arguments. 2018-01-25 17:40:25 -05:00
Aleksey Kliger a03792d8b6 [unit-tests] Add test-mono-string to .gitignore 2018-01-25 11:16:33 -05:00
Alexander Köplinger 5195135825 [System.IO.Compression.FileSystem] Improve ZipCreateFromEntryChangeTimestamp test
`entry.LastWriteTime` is an unspecified/local DateTime but we're
comparing it against `date` which is in UTC. This could lead to
issues where the Day isn't matching when running the test around
midnight.

Examples:

https://github.com/xamarin/maccore/issues/597
https://jenkins.mono-project.com/job/xamarin-android-pr-builder/2387/testReport/Xamarin.Android.Bcl_Tests,%20MonoTests.System.IO.Compression.FileSystem/ZipArchiveTests/ZipCreateFromEntryChangeTimestamp___Debug/
2018-01-25 10:36:26 +01:00
Balló György 693a7c896d Avoid crash under GNOME if no gtk+2 available (#6654)
gtk+2 is non-essential part of the GNOME 3 desktop nowadays.
2018-01-24 17:48:07 -05:00
Sauta, Usevalad a369eb8fb0 [WindowsBase] Use case-insensitive extension match in System.IO.Packaging.ZipPackage 2018-01-24 14:30:43 +01:00
Manuel de la Pena d568da2d1d Address review comments. 2018-01-24 12:50:37 +01:00
Manuel de la Pena 6108d098ce [Test] Skip some tests from System.ServiceModel on WatchOS.
Some of the classes are not supported in the platform while are
supported in MOBILE. Skip them accordingly.
2018-01-24 12:50:37 +01:00
Vlad Brezae 9fca288cab [interp] Abide by the abort threshold constraint
For mono_thread_get_undeniable_exception to work, it needs to unwind the stack and find the first managed frame. This is only possible if we push an interp LMF with a frame for the interp to native transition.
2018-01-24 12:17:02 +02:00
Vlad Brezae 8b1c87bc15 [interp] Interp frames are also managed 2018-01-24 12:17:02 +02:00
Vlad Brezae c52e05c19a [interp] Initialize sp for first interp frame
During interp frame unwinding, we were initializing the sp field (to the corresponding interpreter frame) starting with the parent frames of the first interpreter frame.
2018-01-24 12:17:02 +02:00
Vlad Brezae be280a1fe2 [interp] Remove checks not needed for try blocks
Leave from catch clauses is translated to MINT_LEAVE_S_CHECK, which does the exception reset and abort rethrow.
2018-01-24 12:17:02 +02:00
Marek Safar 07a0edbf4e [ci] Align acceptance tests timeouts 2018-01-24 09:22:14 +01:00
Bernhard Urban 236a8d6dc0 [offsetdumper] remove InterpMethodArguments
Every user of this tool is using architectures that are implementing
`CallContext`.
2018-01-23 21:45:36 +01:00
Jonathan Chambers 8ade62d7ca Reusee class unload cache filter logic from metadata in debugger. (#6641)
Debugger maintains it's own list of loaded classes. The unload/filter
logic does not handle composite types like arrays and generic instances.
Expose and reuse the logic from metadata that properly detects any
usage of an image within a type.

This prevents the cache from containing MonoClass values which have
already been freed by the metadata cleaning code.
2018-01-23 15:32:08 -05:00
Zoltan Varga 5c806eed27 [sgen] Use sgen_is_object_alive_for_current_gen () instead of sgen_is_object_alive (), the latter doesn't work for oldspace objects, causing the gc handle to be freed even through the object is still alive. Fixes https://github.com/mono/mono/issues/6490. (#6501) 2018-01-23 14:52:13 -05:00
jaykrell c8d6314d0c Understand PE32+, at least as much as PE32 is understood. (#6503)
* Minimal fix to Authenticode infrastructure to understand PE32+.
A number of other problems are noticed in the code but commented only.
This fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56071

* Induce many array out of bounds accesses, and some other error paths.

* Tweaks.

* tweak

* Move braces, move addition, document constants and use them.

* whitespace

* fix comment

* remove diff-minimizing hacks

* cosmetic

* move braces and assume zero-initialization; adjust comment.

* improving Makefile but still a ways to go

* fix C# indent

* Change from C++ to C, and cleanup Makefile.

* update clean target in Makefile

* cleanup Makefile and C#

* remove test code that people don't like and it wasn't very useful
wordsmithing and new good information in comments

* Fix indentation
2018-01-23 14:07:20 -05:00
monojenkins b8e80e0ae5 [msvc] Update csproj files (#6642) 2018-01-23 16:59:46 +01:00
Mikhail Filippov 2f6005cc21 Fix NUnit reference generation 2018-01-23 14:40:00 +01:00
Alexander Kyte 49d2d5ae51 [tests] Fix cscs/mcs specific GetMethodBody logic 2018-01-23 14:37:12 +01:00
Michael DeRoy 36ad395368 Fixes an issue where a pipestream handle may be closed twice (Case 942966) 2018-01-23 14:13:07 +01:00
Vlad Brezae 57f08cedc8 [interp] Disable mixed mode tests
When an exception is thrown from jitted code, the EH mechanism correctly sets the interp resume data to the right interp frame that should catch the exception, but it resumes to the interpreter by force, setting the MonoContext. This context has invalid data (for example the SP points to a InterpFrame and it is not the real sp at interp exit)

This bug was exposed by inlining changes from d3763c6c1e
2018-01-23 10:59:12 +01:00
monojenkins 47a4c02dc2 Bump API snapshot submodule 2018-01-23 09:48:49 +01:00
Marek Safar 6b242716fb Bump corefx 2018-01-23 09:48:49 +01:00
Zoltan Varga c4affa12bc [jit] Clear cfg->error after inlining, the error can be ignored, it will happen when the called method is JITted. (#6587) 2018-01-22 20:32:45 -05:00
jaykrell da444c9d51 [perfcounters] Move machine handling from native to managed. (#6543)
* Move machine handling of performance counters from native
to managed -- just slightly less native code therefore.

* PR feedback: Rename ValidMachine to IsValidMachine.
             Use string::operator== instead of .Length/[].
             Change InstanceExistsInternal to return bool/MonoBoolean directly instead of int.
             Remove question mark on FIXME comment for more reliable grep.
             Remove redundant zeroing of a pointer.
2018-01-22 17:40:33 -05:00
Alexander Kyte 3363ec9cc4 [runtime] Apply cctor filters to callees of cctors (#6562) 2018-01-22 15:55:12 -05:00
Marek Safar 51e1e5af32 [mcs] Implements C# 7 tuples implicit deconstruction 2018-01-22 19:11:27 +01:00
Mikhail Filippov b519d42c15 Add test for reproduce problem in debugger stepping 2018-01-22 17:20:27 +01:00
jaykrell 31ec1631c2 Fix configure --disable-boehm to build more tests. (#6614) 2018-01-22 10:37:29 -05:00
Egor Bogatov 056a267752 Fix watchos tests for system.data (#6600) 2018-01-22 10:33:34 -05:00
jaykrell 181aa3c026 Fix missed closedir in commit 947d0bc0ef (#6599) 2018-01-22 10:32:30 -05:00
Aleksey Kliger a529b43453 [mono-error] Use mono_error_assert{f,_msg}_ok instead of if (is_ok (e)) g_error(...) 2018-01-22 10:27:06 -05:00
Aleksey Kliger 77c68b952b [mono-error] Use g_assertf in mono_error_assert_ok implementation
Also add two more variants

* mono_error_assert_msg_ok (err, msg) to print "msg, due to <err>" on failure
* mono_error_assertf_ok (err, fmt, args...) to print
  "<formatted args>, due to <err>" on failure.
2018-01-22 10:27:06 -05:00
Vlad Brezae d3763c6c1e [interp] Decrease stack usage (#6580)
Avoid inlining some functions with high stack frame locals usage (ex functions that use MonoLMFExt which is a big structure).

No performance cost was observed on microbenchmarks, while stack usage decreased by over 3 times on amd64 and over 4 times on arm.
2018-01-22 09:43:01 -05:00
Alexander Köplinger fad6e0cc31 Bump bockbuild to bump gtksharp (#6604)
https://github.com/mono/bockbuild/pull/57
2018-01-22 13:23:49 +01:00
Manuel de la Pena 668c90e2b6 [Tests] Skip a subset of the System.IdentityModel for iOS and Mac. (#6594) 2018-01-22 13:03:22 +01:00
Vlad Brezae 672efa3ef3 [interp] Disable tests on arm due to known issue
Due to clobbering of R8 by interp entry.
2018-01-22 12:28:11 +01:00
Jay Krell 844a927f25 This test is supposed to take between 1 and 2 seconds, but takes slightly longer in practise and fails.
Give it 2.5 seconds.

https://jenkins.mono-project.com/job/test-mono-pull-request-amd64/10727/parsed_console/log.html

Tests run: 120, Passed: 119, Errors: 0, Failures: 1, Inconclusive: 0
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Elapsed time: 00:00:32.8320000

Errors and Failures:

    EndBuildWaitsForSubmissionCompletion (MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion)
    #5
    Expected: less than or equal to 00:00:02
    But was: 00:00:02.0757916

at MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion () [0x00126] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs:105
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) [0x00032] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
2018-01-22 12:24:35 +01:00
jaykrell 3b34235086 Convert dis, profiler, pedump, unit-tests to new MonoError/ERROR_DECL style. (#6607)
Convert dis, profiler, pedump, unit-tests to new MonoError/ERROR_DECL style.
2018-01-21 15:41:05 -08:00
jaykrell 5839d7b434 Split mono_method_get_header_checked into internal and external forms. (#6609)
Split mono_method_get_header_checked into internal and external forms. (#6609)
External form is mono_method_get_header_checked, the preexisting name.
Internal form is mono_method_get_header_internal.
External must initialize the MonoError for compatibility, internal can/should assume it is already initialized per the new pattern.
2018-01-20 22:15:48 -08:00
Zoltan Varga 40adef8a03 [jit] Move more declarations to mini-runtime.h. (#6586) 2018-01-20 21:38:48 -05:00
jaykrell 423cd24649 Check errors when mono_method_to_ir calls handle_delegate_ctor. (#6588) 2018-01-19 18:05:33 -05:00
Marek Safar eef1a5aff2 [mcs] Adds missing default literal conversion test in probing code path 2018-01-19 14:49:47 +01:00
Marek Safar a5e2efe17f [mcs] Fixes assumption that string class has no implicit/explicit conversion operators 2018-01-19 14:45:10 +01:00
Jay Krell 8a968a3550 Cleanup mono_string_to_utf16 -- use unichar2 type to advantage over char. 2018-01-19 03:52:01 -08:00
Marek Safar 44309f79f1 Bump linker 2018-01-19 09:45:20 +01:00
Alexander Köplinger 4e2b3ad0d9 Fix CLA link in CONTRIBUTING.md (#6585)
It was changed when .NET Foundation switched to new CLA infrastructure.
2018-01-19 01:36:45 +01:00
Vlad Brezae 117468d740 [interp] Add check for class failure 2018-01-18 13:33:05 -05:00
Vlad Brezae 0b398d63b0 [tests] Change test to use less stack
The interpreter uses a lot of stack and the stack overflows on this test.
2018-01-18 13:33:05 -05:00
Ramin Zaghi at Mosaic3DX.com 947d0bc0ef [mini] Make sure mkbundle executables work if they are run from a path on the PATH environment variable. (#6147)
* Make sure mkbundle executables work if they are run from a path on the PATH environment variable.

* Review

* Fix build on Windows
2018-01-18 13:31:20 -05:00
jaykrell 12970c4bbd g_assert should be an expression not a statement; provide g_assertf f is format like printf (#6235)
* g_assert should be an expression not a statement; provide g_assertf f is format like printf

- g_assert should be an expression, not a statement
   ANSI C assert gets this correct, and I corrected
   widely used NT ASSERT circa 2001 with no ill effects
   Note that ANSI C assert is void, g_assert here is boolean.

 - provide g_assertf
   f is for format, like printf -- too terse?
   Where you might previously say:
   if (!(expr))
     g_error(...); // like printf
   now:
    g_assertf(expr, ...)

Manual tests provided -- how to provide a test whose success is failure to compile?
Correct existing eglib/test to build and pass, but don't enable in build.
Enabling it is a line in toplevel configure.ac to add eglib/test/Makefile
after eglib/Makefile.

* Fix comment in test code.

* format with s instead of hs

* review
2018-01-18 13:27:43 -05:00
Manuel de la Pena 12d676563e [Tests] Skip System.ServiceModel tests that are not supported on XamMac 4.5 (#6574) 2018-01-18 19:08:03 +01:00
jaykrell 2e029d691e Convert ves_icall_System_Threading_Thread_GetName_internal to coophandle. (#6435)
Convert thread get name to coop/handle (ves_icall_System_Threading_Thread_GetName_internal).
2018-01-18 08:27:56 -08:00
Jay Krell 6a04dc6451 Convert K&R warning farm to ANSI and add static/const.
Also smaller part fix C-vs.-C++-isms.
2018-01-18 14:35:36 +01:00
Rodrigo Kumpera 232af8c206 Add CI to WebAssembly. This is PR based on top of # Only the top 3 commits matter for this PR: (#6488)
* [WASM] Fix System.Core issues and disable broken tests.

* [wasm] Fix cookie computation heap overflow. Use a local to make it thread safe.

* [wasm] Disable System tests that don't work under WASM. Change the wasm profile to disable BSD sockets.

* [wasm] Address reviewer feedback.

* [wasm] Disable test that requires multiple threads.

* [wasm] Add package target to wasm.

* [wasm] Modify the runner to exit(1) if the test suite fails.

* [wasm] Add CI configuration for WebAssembly.

* [wasm] Fix issues found over review.
2018-01-18 14:34:00 +01:00
Alexander Köplinger 0c59209931 [tests] Disable weak-fields.exe on LLVM as well 2018-01-18 12:59:02 +01:00
Ankit Jain 06b9b48420 Bump msbuild (#6569) 2018-01-18 12:37:33 +01:00
Bernhard Urban 5ba19cb478 [configure] fix altstack detection
newer linux headers hide the `struct sigaltstack` definition (e.g. on
Ubuntu 17.10), probably because it is encouraged to use `stack_t`
anyway.

We use `stack_t` in our code anyway:
https://github.com/mono/mono/blob/146346977cea8aaed2de8ab6a84c2a58b30aea24/mono/mini/mini-exceptions.c#L2379

The change introducing the `ifdef` was already wrong imho:
https://github.com/mono/mono/commit/f6d15e14c234c505e4b5e4d5e46a2666370d2b4a
2018-01-18 09:31:03 +01:00
Alex Rønne Petersen 3491b7b604 [profiler] Write out all uncovered classes/methods in a loaded image. (#6544)
* [runtime] Export mono_class_get_checked () for use in profilers.

* [runtime] Expand mono_method_get_header_summary () to collect more info.

It now collects all the trivially-accessible header data that doesn't require
chasing down other metadata.

* [profiler] Use mono_method_get_header_summary () in the coverage code.

We only need code start and size information, not all the data that is present
in the header. By switching to this function, we avoid all the side effects
that come with resolving local variables and exception clauses (which can even
result in loading assemblies in the worst case).

* [profiler] Write out all uncovered classes/methods in a loaded image.

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

This required a bit of refactoring and some workarounds for various special
cases. This also fixes some race conditions with respect to how data was
inserted into the lock-free hash tables and queues.
2018-01-18 09:26:40 +01:00
Zoltan Varga 5e72bd6d01 [sdks] Set more ios version variables to empty to fix the build. (#6571) 2018-01-18 01:16:01 -05:00
Zoltan Varga 511c2fd59c [sdks] Set XCODE_VERSION to 'Xcode' for now to fix the ios build. (#6568) 2018-01-17 23:54:59 -05:00
Alexander Köplinger a99d7f4b13 [ci] Use correct -arch syntax in CFLAGS on OSX (#6570)
In c7d8d247c3 I unified how we're
passing -arch in CFLAGS to "-arch=XXX" since the original change
in 63a49e9eb8 mixed the formats.

Turns out the correct syntax is "-arch XXX" instead and it broke
the ccache build in bockbuild because it complained about the
unknown format.

Also add LDFLAGS in the amd64 case to match what we have in bockbuild.
2018-01-18 03:37:54 +01:00
Vlad Brezae 4490aa5112 [runtime] Fix jit info leak when having aot images loaded
When we had a jit info table for aot images loaded in the domain, we would queue jit infos for freeing at domain unload time. This means leaking during entire application life.

Add comment for jit info freeing when having multiple tables.

Fixes #60986.
2018-01-17 20:51:35 +01:00
Katelyn Gadd a717f377f0 Fix bug 60848: Incorrect unicode custom attribute decoding (#6481) 2018-01-17 20:47:43 +01:00
Radek Doulik 9a183f2c83 [Tests] Do not assume order of returned interfaces
Updated the System.Reflection.Emit/SaveTest to not depend on order of
interfaces returned from the System.Type::GetInterfaces method, as the
order is not guaranted. As described in the [documentation][0].

Also see github [issue][1] for more information and reasoning.

[0]: https://msdn.microsoft.com/en-us/library/system.type.getinterfaces(v=vs.110).aspx#Anchor_2
[1]: https://github.com/xamarin/xamarin-android/issues/1186
2018-01-17 20:44:25 +01:00
Vlad Brezae f162931e25 [mini] Fix seq point info leak (#6522) 2018-01-17 20:06:17 +02:00
Rodrigo Kumpera 146346977c Revert "Implement trivial loop detector in the front end and use it to drive inlining decisions. (#6478)" (#6557)
This reverts commit 411791c469.
2018-01-17 11:18:12 -05:00
Rodrigo Kumpera 411791c469 Implement trivial loop detector in the front end and use it to drive inlining decisions. (#6478)
This cute hack allow us to cut the budget of perf irrelevant blocks[1] while massively boosting those that are perf relevant[2].

It has a ton of missing features, like it doesn't detect nested loops, it doesn't take hints from inlined methods and it doesn't compute EH info.
Beyond that, inlining budget is all but horrible, so there's ton of room for improvement here.

Results are promising.

A marginal improvements in benchmarks like Roslyn (2% user) while as much as 30% in micro benchmarks where the now bigger methods are in loop bodies.
Code size with Roslyn changed from 5433242 to 5501751, IE extra 68.5k, or 1.2% more.

[1] those ending in throw or in a catch handler
[2] Loops
2018-01-17 15:42:40 +01:00
jaykrell b909a77020 return 0 is generally redundant in configure.ac, as the construction (#6528)
of the test program wraps the text in int main() { ... ; return 0; }
2018-01-17 15:32:04 +01:00
jaykrell bbf6b67483 Fix some warnings. (#6526) 2018-01-17 15:31:00 +01:00
Egor Bogatov acea63a9c1 Improve GetArgumentName in MonoOptions. Fixes bug-60904 (#6506)
* Rewrite Options.GetArgumentName to use Regex

* code cleanup

* code cleanup
2018-01-17 15:30:14 +01:00
Bernhard Urban f49e87d42a [exceptions] remove restore_stack_prot from managed code (#6518)
it's dead code. restore happens in `restore_soft_guard_pages` upon
returning from the altstack machinery.
2018-01-17 15:25:03 +01:00
Vlad Brezae cdecb851ff [sgen] Fix overflow on large arrays (#6542) 2018-01-17 15:11:47 +01:00
Bernhard Urban e39acb7a0d [exception] propagte stackoverflow exception to managed code (#6458)
we return the address of the StackOverflowException object in
`restore_soft_guard_pages`, so it ends up in the architecture specific
result register (e.g. %rax) where the exception handler expects it.

fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60862
2018-01-17 15:10:15 +01:00
Marek Safar c282af6df5 [mcs] Implements C# 7.0 discards 2018-01-17 14:43:18 +01:00
Manuel de la Pena 3f372d06ee [Tests] Skip some of the System.ServiceModel tests when using MOBILE (#6545)
Mobile does not support all clases found in System.ServiceModel, we skip
those tests of the not supported classes yet run all the others.
2018-01-17 13:50:28 +01:00
jaykrell 1e4f6b185b Convert thread get/set/clear state to coop/handle. (#6389)
* Coop-handle ves_icall_System_Threading_Thread_GetState, SetState, ClrState.
And cleanup.

* Favor mono_internal_thread_handle_ptr.
2018-01-16 12:55:34 -08:00
Marek Safar 370105c5e0 [profiler] Don't double escape special characters. (#6534)
The output of parse_generic_type_names is processed by escape_string_for_xml and
we were double escaping `&` character
2018-01-16 21:02:34 +01:00
monojenkins 7fa8269076 [msvc] Update csproj files (#6538) 2018-01-16 20:39:25 +01:00
Miguel de Icaza d1649e90fc [corlib] Use Environment.Platform to access the platform, rather than probing the file system (#6535)
Alternatve patch to: #6533
2018-01-16 20:36:50 +01:00
EgorBo 15fad0dac2 fix system.data ssl-bug on linux 2018-01-16 13:49:25 +01:00
Jay Krell 042056452a Remove ampersands on MonoError variables name "error", but not on the others. 2018-01-15 23:51:22 -08:00
Jay Krell 111786f944 Support for removing ampersand on MonoError variables and other
preparation for MonoError cleanup (specific use-cases instead
of one error_init).
2018-01-15 23:51:22 -08:00
Jay Krell 31070dfdc0 In MonoError, provide a uint32_t for initialization with
just one instruction instead of two (at least it makes
a difference on the Apple arm32 target).

Also favor expressions over statements.
2018-01-15 23:51:22 -08:00
Jay Krell 242980e00e replace new MonoError with ERROR_DECL 2018-01-15 23:51:22 -08:00
Jay Krell b68b5ad1be Replace some "error" with "gerror" so that "error" is more often a MonoError or MonoError*. 2018-01-15 23:51:22 -08:00
Marek Safar 00934efe15 [corlib] Fixes StoppedThreadsThrowThreadStateException test build 2018-01-16 08:46:03 +01:00
Alexander Köplinger 0d9c3dfff4 [tests] Bump timeouts in process-stress-?.exe runtime tests (#6515)
* [test-runner] Record test duration in NUnit xml

This allows us to keep track of the time on Jenkins.

Also fix issue where we were recording .Seconds of a TimeSpan instead of .TotalSeconds.

* [tests] Bump timeouts in process-stress-?.exe runtime tests

We're seeing these fail sometimes on Linux Azure VMs, let's try
if bumping the timeouts helps.
2018-01-15 20:09:07 +01:00
Zoltan Varga 902626bb80 [runtime] Disallow casts between int[] and IList<int?> etc. Fixes #6401. 2018-01-15 18:18:27 +01:00
Marek Safar 46bb11eb33 [mcs] C# 7.2 non-trailing named arguments 2018-01-15 17:59:44 +01:00
monojenkins 5929e348e9 [msvc] Update csproj files (#6516) 2018-01-15 16:49:55 +01:00
Alexander Köplinger 2a03be316d [class] Add Obsolete message to ICSharpCode.SharpZipLib.dll (#6511)
* [class] Add Obsolete message to ICSharpCode.SharpZipLib.dll

Users should use the nuget package instead, we'll remove the assembly in Mono 6.0

Don't install it into the 4.7.1 reference assembly directory anymore.

* Bump API snapshot submodule
2018-01-15 16:39:14 +01:00
Vladimir Kazakov 89c76cdfa1 Add System.ServiceModel.Description.UseRequestHeadersForMetadataAddressBehavior. (#6508) 2018-01-15 10:25:15 +01:00
EgorBo dee8dc3245 change messages for some system exceptions (consistency with .net) 2018-01-15 10:05:45 +01:00
Manuel de la Pena 001d4d5082 [Tests] Ensure that tests are runnable on xamarin-macios (#5875) 2018-01-15 09:26:27 +01:00
Zoltan Varga faecfce5d0 [runtime] Fix some default interface method problems. (#6484)
* [runtime] Allow access to protected default interface methods from classes which implement the interface.

* [interp] Add some automatic conversations between virtual and non-virtual calls that .net has. Fixes dim-valuetype.il.

* [bcl] Sort the MethodImpl table in PEAPI.

* [runtime] Enable dim-methodimpl.exe test.

* [runtime] Fix vtable construction tracing.

* [interp] Fix null checks on the receiver when converting virtual calls to non-virtual.
2018-01-12 08:34:18 -05:00
Ludovic Henry 9484143e93 [eglib] Add g_assertf (#6483) 2018-01-12 11:17:06 +01:00
Johan Lorensson 52db7f6ae7 Merge pull request #5964 from lateralusX/lateralusX/add-pending-joinable_support
Wait on runtime threads to complete detach/unregister during shutdown.
2018-01-12 09:32:30 +01:00
Katelyn Gadd 7eb8a58597 Fix bug 60359 2018-01-12 08:59:35 +01:00
Bernhard Urban b30a5d37e4 [exception] unprotect whole stack guard if a stack overflow occurs
Rationale:

1. it asks for double faulting scenarios we can't do anything about
   it anyway, exception just unmap yet another page

2. `mprotect(2)` behaves weirdly (at least on macOS) if you try to
   change permissions for subsequent pages with different permissions.
   With the previous code it happened that the requested memory range
   would go from somewhere in the stack guard and overlap into the
   regular, unprotected stack and end up with unpredictable behaviour.
   We could be more careful about it, but it would complicate things
   even more.
2018-01-12 00:41:50 +01:00
Ludovic Henry cdb93684e7 [sdks] Extract versions into a dedicated file (#6474) 2018-01-11 19:28:56 +01:00
Rodrigo Kumpera 77ba59959f Merge pull request #6480 from kumpera/disable-cross-domain-autointern
[runtime] Don't auto intern a string just because another domain has done the same.
2018-01-11 13:12:55 -05:00
jaykrell c3a9d69c8a mono_string_new_utf32_checked leaks in error path, and produces some unused data. (#6374)
* mono_string_new_utf32_checked leaks in error path, and produces
 some unused data.

* assume equivalence of error and null

* line damage
2018-01-11 11:41:57 +01:00
jaykrell c87842d24e Reduce use of mono_marshal_string_to_utf16 which appears (#6438)
no longer needed. It remains only for register_icall.

Remove casts from void* to HANDLE, as HANDLE always and forever
will also be void*.

Add comments explaining the valid use of INVALID_HANDLE_VALUE (-1).
With CreateFileMapping, for the file handle, it means to
use physical memory / pagefile.
2018-01-11 11:38:40 +01:00
Jonathan Chambers 6c9339dd80 Pass TRUE for 'repeat' of send variants. This matches behavior of receive variants. Fixes blocking send call where Win32 returns WSAEWOULDBLOCK. (#6453)
Related to issue https://github.com/mono/mono/issues/6464
2018-01-11 11:34:14 +01:00
Rodrigo Kumpera bcc32da914 [runtime] Don't auto intern a string just because another domain has done the same.
Previously, we tried to keep the intern status of a string consistent across domains. Meaning
that if you interned "FOO" in domain 0, it would return true for String.IsInterned in domain 1.

This behavior exists in the CLR because the string table is shared between domain as string are
what they call agile objects - those that can exit in multiple domains at the same time.

Mono appdomain isolation doesn't work that way and there's not visible advantage of keeping that property.

The reason for this change is to potentially reduce the amount of interned strings and, more importantly,
reduce the amount of domain lookups, which are quite expensive and unsafe.

This should speed up interning queries.
2018-01-10 17:22:21 -08:00
Marek Safar 111a7b3b12 Bump monolite version (#6475)
missed in 190d357c2739a2a294f781b1939d76cb7c340aca
2018-01-11 02:02:51 +01:00
Vlad Brezae 51c200c71f [test] Rename test
There were 2 vararg.exe
2018-01-11 01:38:31 +01:00
Vlad Brezae 6381b6608c [interp] Add support for ldflda with remoting
Field access for classes like MarshalByRefObject need to go through a wrapper.
2018-01-11 01:38:31 +01:00
Vlad Brezae baaf49441c [interp] Allow interp stack to be greater than il stack 2018-01-11 01:38:31 +01:00
Ludovic Henry b58dee4b87 [coop] Disable failing tests on PR (#6472) 2018-01-10 23:23:37 +01:00
monojenkins ec09d13a8e [msvc] Update csproj files (#6473) 2018-01-10 16:46:43 +01:00
Marek Safar 6aa4e4dac9 [corlib] Optimizes non-intrinsics version of string indexer code 2018-01-10 14:41:59 +01:00
Miguel de Icaza e9913fdc48 Improve sgen error reporting for assemblies it attempts to process (#6463)
Makes it simpler to see what is wrong with an assembly.
2018-01-09 20:23:10 +01:00
Marek Safar 25bff86cee Bump corert (#6420)
* Bump corert

* Bump API snapshot submodule
2018-01-09 17:45:26 +01:00
Alexander Köplinger ad5703adfd [System] Set exception on Finish*Failure in SocketAsyncEventArgs (#6462)
Follow up to https://github.com/mono/mono/pull/6431, we should
capture the exception that is passed to the methods.

Copied the SetResult() method that referencesource uses.
2018-01-09 15:45:47 +01:00
jaykrell e6a167a7cd mono_string_to_utf32 produces unused data. (#6375) 2018-01-09 15:31:06 +01:00
Ludovic Henry ba40387f50 [w32process] Ensure process_handle is a legal value (#6449)
* [w32process] Ensure process_handle is a legal value

Fixes https://github.com/mono/mono/issues/6383

* [w32process] Remove dead code
2018-01-09 15:16:57 +01:00
Miguel de Icaza fc2d278cc4 Add capability to list more than one method to be verbose, document some internal APIs, update man page with more explanations (#6426) 2018-01-09 10:14:52 +01:00
Bernhard Urban 711a02e465 [mini] factor out interp into a library (#6419)
* [mini] factor out interp into a library

It enables us to ship the interpreter as an add-on to the runtime.
Embedder can statically link it into their application on demand.

Usage:

configure mono without the interpreter, such as:

```
$ ./autogen.sh --enable-minimal=interpreter ...
$ make; make install
```

run your favorite program with the interpreter and see it fail:

```
$ ./mono/mini/mono-sgen --interpreter ./mono/mini/basic.exe
Mono IL interpreter support is missing
```

despite `--enable-minimal=interpreter`, we can still build the interp
module:

```
% make -C mono/mini libmono-ee-interp-static.la
  CC       interp/libmono_ee_interp_static_la-interp.lo
  CC       interp/libmono_ee_interp_static_la-mintops.lo
  CC       interp/libmono_ee_interp_static_la-transform.lo
  CCLD     libmono-ee-interp-static.la
```

`libmono-ee-interp-static.a` can be statically linked into the target
application.

* [fixup] include libmono-ee-interp reference in runtime unit-tests
2018-01-09 10:05:29 +01:00
Andrew Au 57a2cce4b1 Fix a typo 2018-01-09 09:55:54 +01:00
jaykrell f4bbf7a3b9 Cleanup arm64 OP_SHL_IMM to share code with OP_LSHL_IMM. (#6444) 2018-01-08 23:14:00 +01:00
jaykrell fa83e7828c Convert thread get and set priority to coop/handle. (#6436) 2018-01-08 23:07:47 +01:00
jaykrell 8422ea56bc Convert GetCurrentThread to coop/handle. (#6437) 2018-01-08 23:06:57 +01:00
Aleksey Kliger (λgeek) ab9ecc9903 [metadata] Mark several functions external only (#6384)
* [runtime] Mark mono_class_get and mono_class_get_full external only.

   Runtime should use mono_class_get_checked and
   mono_class_get_and_inflate_typespec_checked, respectively.

* [runtime] Mark mono_ldtoken external only

   Runtime should use mono_ldtoken_checked

* [metadata] Mark mono_type_create_from_typespec external only

   Runtime should use mono_type_create_from_typespec_checked

* [runtime] Remove mono_class_inflate_generic_method_full.

   Mark mono_class_inflate_generic_method external only.

   Runtime should use mono_class_inflate_generic_method_full_checked.

* [runtime] Mark mono_get_inflated_method external only

   This function is obsolete.  It should have no callers.

* [metadata] Mark mono_field_from_token external only

   Runtime should use mono_field_from_token_checked

* [runtime] Add MonoError arg to mono_class_get_inflated_method

* [metadata] Mark mono_metadata_parse_method_signature external only

   Runtime should use mono_metadata_parse_method_signature_full

* [metadata] Mark mono_metadata_interfaces_from_typedef as external only.

   Runtime should use mono_metadata_interfaces_from_typedef_full

* [mini] Add MonoError arg to mono_class_get_method_generic

   Also move its declaration from metadata/class-internals.h to mini/mini.h
   since it's defined and used in mini/

* [class] Assert that mono_class_get_inflated_method never returns NULL
2018-01-08 16:16:45 -05:00
Marek Safar df0fd973cc Make suggestions in github issue template XML comments 2018-01-08 16:42:54 +01:00
Alexander Köplinger 1b5fa0e059 Fix Windows build
fd325223ba didn't change this occurrence of 'error' to 'gerror'.
2018-01-08 15:14:37 +01:00
Miguel de Icaza 406b40bb77 Implement a couple of SocketAsyncEventArgs methods 2018-01-08 13:18:19 +01:00
Vlad Brezae 6ae3e4795c [interp] Add missing param support for floating types in interp_entry (#6427)
* [interp] Add missing param support for floating types in interp_entry

Remove some duplicated code

* [interp] Reenable thunks.exe on arm

It fails due to the known RGCTX register clobbering by trampolines.
2018-01-08 14:16:24 +02:00
jaykrell 61f6da9cb4 return_val_and_set_pending_if_nok macro is missing do/while0. (#6396) 2018-01-08 10:33:40 +01:00
Robert Nagy e31ecb3b41 openbsd related patches (#6358)
* include netinet/in.h for in_addr_t

* there is no need for an openbsd specific implementation anymore
so you use the generic pthread one

* signal.h is required for sigaltstack

* add missing mono/utils/mono-threads.h include

* there is no malloc.h on OpenBSD either

* sys/socket.h is required for struct sockaddr

* add support for btls on openbsd and default to with_tls=pthread as there is only emultls support which is not enough for mono

* there is no need for pthread_attr_init/destroy anymore

* add -Wl,-zwxneeded to LDFLAGS on OpenBSD

W^X is strictly enforced by default on OpenBSD;
a program can only violate it if it is located on a filesystem mounted
with the wxallowed mount(8) option and has been linked with the
above flag
2018-01-08 10:25:19 +01:00
David Karlaš 3277e2be43 [profiler] Fixed GCResizeEvent value overflow (#6335)
In case application was using more than 2GB of heap memory it started reporting minus values because `emit_value` accepts `int`
2018-01-08 10:24:40 +01:00
jaykrell fd325223ba Rename some occurences of "error" to "gerror" so that (#6447)
"error" is more often specifically MonoError.
2018-01-08 10:15:02 +01:00
jaykrell a4ac0aa8a5 if MONO missing in Fix some ThreadPool performance counters. (#6118) (#6434) 2018-01-08 09:48:22 +01:00
Aleksey Kliger (λgeek) 0fb4f03a1b [centrinel] Suppress warning about body of mono_internal_thread_handle_ptr (#6432)
Since object-internals.h is included in a ton of places, we get one Centrinel warning
about mono_internal_thread_handle_ptr per translation unit every time the
header is included which is ridiculously noisy.

This commit will suppress the warning about the body of this function.

Note that uses of the function will still get a warning since it returns a
MonoInternalThread* and we haven't yet taught Centrinel that those calls are ok since
the thread object is pinned.
2018-01-08 09:47:31 +01:00
Zoltan Varga 48badade21 [jit] Convert stores into sign/zero extensions for small ints during alias-analysis. Fixes gh #6414. (#6440) 2018-01-07 18:43:10 +01:00
Bernhard Urban efb6eb891c [interp] fix build when interpreter is disabled (#6416)
```
mini-amd64.c:1103:36: error: incomplete definition of type 'struct _MonoInterpCallbacks'
                        gpointer ret_storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1);
                                               ~~~~~~~~~^
./mini-runtime.h:162:16: note: forward declaration of 'struct _MonoInterpCallbacks'
typedef struct _MonoInterpCallbacks MonoInterpCallbacks;
               ^
mini-amd64.c:1103:61: error: use of undeclared identifier 'MonoInterpFrameHandle'
                        gpointer ret_storage = interp_cb->frame_arg_to_storage ((MonoInterpFrameHandle)frame, sig, -1);
                                                                                 ^
mini-amd64.c:1134:12: error: incomplete definition of type 'struct _MonoInterpCallbacks'
                interp_cb->frame_arg_to_data ((MonoInterpFrameHandle)frame, sig, i, storage);
                ~~~~~~~~~^
./mini-runtime.h:162:16: note: forward declaration of 'struct _MonoInterpCallbacks'
typedef struct _MonoInterpCallbacks MonoInterpCallbacks;
               ^
mini-amd64.c:1134:34: error: use of undeclared identifier 'MonoInterpFrameHandle'
                interp_cb->frame_arg_to_data ((MonoInterpFrameHandle)frame, sig, i, storage);
                                               ^
mini-amd64.c:1214:11: error: incomplete definition of type 'struct _MonoInterpCallbacks'
        interp_cb->data_to_frame_arg ((MonoInterpFrameHandle)frame, sig, -1, storage);
        ~~~~~~~~~^
./mini-runtime.h:162:16: note: forward declaration of 'struct _MonoInterpCallbacks'
typedef struct _MonoInterpCallbacks MonoInterpCallbacks;
               ^
mini-amd64.c:1214:33: error: use of undeclared identifier 'MonoInterpFrameHandle'
        interp_cb->data_to_frame_arg ((MonoInterpFrameHandle)frame, sig, -1, storage);
```
                                       ^
2018-01-06 23:39:48 +01:00
Jay Krell 17a2fba78d Replace MonoError foo; with ERROR_DECL (foo); 2018-01-06 11:48:39 -08:00
Jay Krell 4aa6582504 Add initial ERROR_DECL for easier to read history. 2018-01-06 11:48:39 -08:00
Alexander Köplinger b5c5c55368 [System] Recursively delete directory in ApplicationSettingsBaseTest
Otherwise we'd get a "directory not empty" exception in the
TestFixtureTearDown (which for some reason isn't shown in the log?).

This was added in https://github.com/mono/mono/pull/6272
2018-01-06 01:40:49 +01:00
Alexander Köplinger e0f362764e [System] Clear XDG_DATA_HOME and XDG_CONFIG_HOME in ApplicationSettingsBase tests (#6417)
They were set in https://github.com/mono/mono/pull/6272 but since
env vars are process wide we'd end up with non-existing paths once
the tests are done. It is safer to unset the variables after the test.
2018-01-06 01:37:26 +01:00
jaykrell ad64e938a2 Merge pull request #6392 from jaykrell/string_equal
Provide g_utf16_ascii_equal and g_utf16_asciiz_equal for comparing utf16 to ascii for equality.
2018-01-05 10:26:22 -08:00
monojenkins 6dd4ff09f6 [msvc] Update csproj files 2018-01-05 16:46:19 +01:00
Alexander Köplinger 261b75e047 [ci] Bump timeout in acceptance-tests 2018-01-05 15:28:45 +01:00
Marek Safar aa2ecc7053 [corlib] Fixes ThreadPoolTest test 2018-01-05 15:09:51 +01:00
Alexander Köplinger 3b6c67d61f [scripts] Ignore build output 2018-01-05 13:35:00 +01:00
Eberhard Beilharz 63a8b08dd7 [System] Improve ApplicationSettingsBase behavior (#6272)
* [System] Add unit test for Xamarin-2315

* [System] Use temporary directory for saving settings files

This change modifies the ApplicationSettingsBaseTests so that they
store the settings files in a temporary directory. This reduces
the risk of failed tests because of stale files from previous test
run, or from a build that runs in parallel.

* [System] Improve Settings behavior (Xamarin-15818)

Improve behavior of ApplicationSettingsBase class to match Windows .NET
more closely.
* Implement Upgrade to allow Upgrading of settings
* Make SettingsPropertyValue serialization work for complex objects
* Make Save and Update throw in unimplemented configurations
* Changed Reload to clear PropertyValues so they are reloaded
  and fire PropertyChanged event for all Properties
* Modified Reset to do what Reload used to do.
* Added a backup Type loading for custom SettingsProviders
* don't call SettingsSaving on Reset()

* [System] Fire SettingsSaving event (Xamarin-2315)

When calling ApplicationSettingsBase.Save() the SettingsSaving
event has to be fired.

* [System] Add unit tests for Xamarin-15818
2018-01-05 13:08:20 +01:00
David Karlaš db5f38402f [PerfCounters] Added "Page File Bytes" which shows VmSwap and made few MacOS counters more accurate 2018-01-05 11:42:13 +01:00
Marek Safar c1c70a3622 [build] Bump bootstrap mcs dependency for mcs builds 2018-01-05 11:39:13 +01:00
Vlad Brezae bb17db90a1 [interp] Interp fixes (#6334)
* [interp] Check for exception at field address failure

For example if the static constructor throws an exception

* [interp] Run class cctor before allocating objects

Otherwise we could end up throwing TypeInitializationException from the finalizer thread. We do the same with jit (emit_class_init).

* [interp] Check for method access failure when doing a call
2018-01-05 11:11:54 +01:00
Bernhard Urban d6e5957ecb [valuetypes] incorporate review feedback for 77a53f0dc9 (#6403) 2018-01-05 10:53:02 +01:00
Katelyn Gadd 4051586e6f Replace explicit make invocations with uses of the MAKE variable 2018-01-05 10:28:11 +01:00
Katelyn Gadd 1f174145d1 Fix a race condition in TcpListenerTest caused by sockets' accept queue not filling instantly when machine is under load 2018-01-05 10:27:26 +01:00
Alexander Köplinger 861e52e25c [runtime] Fix include paths (#6402)
VSCode complains about not finding these.
2018-01-05 01:11:46 +01:00
Vladimir Kazakov d036958986 XMLDSIG from .NET Core. (#6154) 2018-01-04 23:20:13 +01:00
Rodrigo Kumpera 87315d19c6 Merge pull request #6372 from kumpera/wasm-p3
[wasm] Improve docs on how to build/test WebAssembly. Add System and System.Core test suite. Improve dep tracking for bcl test suites.
2018-01-04 10:24:38 -08:00
Rodrigo Kumpera f7f280c739 Merge pull request #6329 from lewurm/unaligned-ptrs-in-valuetype-equals
[valuetypes] use memcmp in default implementation of Equals
2018-01-04 10:17:18 -08:00
Bernhard Urban 866d0ad482 [interp] move up rtm assigment so it won't be NULL on potential usage (#6390)
THROW_EX expands to a potential usage of `rtm`
2018-01-04 18:32:30 +01:00
Alexander Köplinger 0f9bb15622 [I18N] Add CP737 (Greek) and CP775 (Baltic) (#6361)
* [I18N] Add CP737 (Greek) and CP775 (Baltic)

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

* Bump API snapshot submodule
2018-01-04 16:29:43 +01:00
Alexander Köplinger c60f2c4ca2 Bump bockbuild 2018-01-04 16:11:40 +01:00
Alexis Christoforides 83d6abd219 Merge pull request #6385 from akoeplinger/bump-gtksharp
Bump gtksharp in bockbuild
2018-01-04 17:04:30 +02:00
Bernhard Urban 7a5df3c524 [mini] Allow stind.ref only on object references. (#6164)
* [mini] Allow stind.ref only on object references.

* [marshal] stind.ref is invalid for non-reference types
2018-01-04 10:18:20 +01:00
jaykrell dc312c772f Fix some ThreadPool performance counters. (#6118)
* Fix some ThreadPool performance counters.
https://bugzilla.xamarin.com/show_bug.cgi?id=41294

The bug is that some performance counters are always zero.
Because we do not update them.
This addresses two of them: Work items added and thread count.

There is PerformanceCounter class and you can Increment instances,
however its metadata and some of the implementation is in System.dll.
Most of the code is in native.
ThreadPool is in mscorlib.dll, so can't use System.dll.
A few options exist to address this.
We could move and forward the type. We could duplicate and rename
and possibly subset the type.
Here we add a new icall very specifically for the scenario.

There is slight cost for the icall, and for the atomic increment.
There is an attempt to measure but the results were unclear.

Note that the count of work items is not specifically for QueueUserWorkItem
as one might expect, but also for any async calls.

Fix a little bit of typos.

* Take command lines from command line per PR feedback.

* newline at end of file
2018-01-04 10:17:30 +01:00
Miguel de Icaza e0e185d70a Adds support for nanosecond resolution file information where available (Fixes: 6283) (#6307)
* Adds support for nanosecond resolution file information where available.

This patch adds support to the runtime to use the nanosecond
information available on Mac and Linux on `struct stat`.
`stat.st_Xtimespec` strucutre on OSX, and `stat.st_Xtime` and
`stat.st_Xtim.tv_nsec` pair on Linux.

Additionally, this adds support in `Mono.Posix` for MacOS nanosecond stat
data, it already had Linux support before.

* Use ULL here to prevent the computation from overflowing
2018-01-04 10:04:56 +01:00
Jay Krell 7c6f619ae5 Provide g_utf16_ascii_equal and g_utf16_asciiz_equal for comparing
utf16 to ascii for equality.

g_utf16_ascii_equal takes lengths, which are checked first
and unequal length implies unequal strings, and then no characters are looked at.

"z"" for zero means nul terminated and requires scanning the string.
Still, an equality primitive is often desired vs. inverting inequality.

These can cleanup some code -- extracted from a larger not yet commited PR
that uses it.
2018-01-03 19:24:28 -08:00
Marek Safar 975765dbab Bump corefx (#6119) 2018-01-03 18:54:35 +01:00
Alexander Köplinger ffc3a83d9b Bump gtksharp in bockbuild 2018-01-03 17:13:58 +01:00
Alexander Köplinger 3826a69bc0 [packaging] Whitelist vbc command in OSX pkg (#6382)
We added vbc in https://github.com/mono/mono/commit/8be2726e127a969cd73e4e92ed03b053f13ed5d5
but didn't whitelist it in the Mac package.
2018-01-03 16:35:39 +01:00
Alexander Köplinger ccd3e6ff12 Update a few more Bugzilla URLs to GitHub (#6381)
Also update the WinForms readme to remove outdated content while at it.
2018-01-03 13:18:11 +01:00
Bernhard Urban 1710dd74fe [configure] change bug URL (#6378) 2018-01-03 12:06:54 +01:00
Vladimir Kazakov 05e8f2b8d7 Add a possibility to use empty X.509 certificates.
Fixes #6264.
2018-01-03 11:27:20 +01:00
Marek Safar 5de513945b [mcs] Allow calling by-ref types virtual methods which can be devirtualized. 2018-01-03 11:23:29 +01:00
jaykrell e23e916f26 The only call to mono_string_to_utf8_mp is in the file that implements it -- object.c. (#6377)
So remove it from any header, even an internal one, and make it static.
2018-01-03 08:46:33 +01:00
Alexander Köplinger ff197eb405 [packaging] Remove files from gtksharp package that would overwrite Mono files
I found out that we were packaging e.g. MonoPosixHelper.dll from
the gtksharp msi instead of the one we build in Mono :P

This only happened in the x86 build because we don't package
gtksharp in the x64 build.
2018-01-03 00:06:40 +01:00
Bernhard Urban 77a53f0dc9 [valuetypes] use memcmp in default implementation of Equals for unaligned fields
some architectures (e.g. ARM) do not support reads of unaligned pointers

fixes https://github.com/mono/mono/issues/6320
2018-01-02 23:30:25 +01:00
Rodrigo Kumpera 4b0b545236 [wasm] Improve docs on how to build/test WebAssembly. Add System and System.Core test suite. Improve dep tracking for bcl test suites. 2018-01-02 11:37:39 -08:00
Alexander Köplinger d3356e6aab [packaging] Add check for cygwin paths on Windows (#6364)
We don't want to package these, found a few that needed to be removed/fixed.
2018-01-02 20:30:11 +01:00
Marek Safar 23675d6292 [runtime] Adds System.Numeric remapping. Fixes #6339 2018-01-02 18:58:29 +01:00
jaykrell 8bbebd920a Remove duplicated code by factoring on endian parameter. (#6321)
* Remove duplicated code by factoring on endian parameter.

* Force inline to mimic previous.

* fix the forceinline part

* Do not forceinline utf32, we never use it.
2018-01-02 18:21:40 +01:00
Aleksey Kliger 009e2d8835 [sre] Emit a memberref token for fields,methods of a gtd
This can happen when emitting code like:
```
  class Foo<T> {
    T elt;
    public T getter () {
      return elt;  // ILGenerator.Emit (OpCodes.Ldfld, /*FieldBuilder of Foo::elt*/)
    };
  }
```

the old incorrect code emitted a fielddef token for Foo::elt, but it should be a
memberref for Foo<!0>::elt.

Likewise, if we have
```
class Foo<T> {
  public T f () { /*...*/}
  public void g () {
    var x = f (); // ILGenerator.Emit (OpCodes.Call, /* MethodBuilder of Foo::f */)
    /*... */
  }
}
```

Fixes https://github.com/mono/mono/issues/6192

the old incorrect code would emit a fieldref token for Foo::f but it should be
a memberref for Foo<!0>::f
2018-01-02 12:05:48 -05:00
Aleksey Kliger 6102b95385 [tests] SRE check that a memberref token is emitted for a gtd
Regression test for https://github.com/mono/mono/issues/6192
2018-01-02 12:05:48 -05:00
Alexander Köplinger af165436b5 Don't add linker tests to tarball
They contain files with very long names which causes issues with `tar`.

We simply remove them from the dist directory before creating
the tarball since we don't use them in the Mono build anyway.

Fixes https://github.com/mono/mono/issues/6349
2018-01-02 16:51:09 +01:00
Alexander Köplinger c354ac8ac1 Dist files in groups of 100 entries
On some distros the number of strings you can pass to execve()
is limited which means you get the following error when trying
to create the tarball:

```
make[5]: execvp: /bin/sh: Argument list too long
make[5]: * [../../build/rules.make:303: dist-default] Error 127
```

To solve this we split the DISTFILES variable into groups of 100
entries and invoke the shell for each group instead of adding all
into the same invocation. Also removed looking for 'makefile' and
'GNUmakefile' since those don't exist in Mono and simplifies the logic.

Found during investigation of https://github.com/mono/mono/issues/6349
2018-01-02 16:51:09 +01:00
Marek Safar 1003597c4e [mcs] Implements 7.2 stackalloc to Span assignment conversion. 2018-01-02 15:30:28 +01:00
Marek Safar eb3f9147ae [mcs] readonly struct this can be reassigned within ctor 2018-01-02 15:05:20 +01:00
Aleksey Kliger (λgeek) e5246d94ab Merge pull request #6331 from lambdageek/string_new_error_leak
Don't leak glib error in mono_string_new_checked
2017-12-28 12:09:12 -05:00
Alexander Köplinger f93caff1c8 [packaging] Windows: remove FSharp.Core from GAC (#6345)
See https://github.com/mono/mono/pull/6295#issuecomment-354156711.
2017-12-27 22:26:31 +01:00
Alexander Köplinger 7363f1ac3d [utils] Include jemalloc dir in tarball build (#6344)
Fixes https://github.com/mono/mono/issues/6343
2017-12-27 19:53:06 +01:00
Aleksey Kliger (λgeek) f783d29462 Merge pull request #6323 from lambdageek/class-h-minor-cleanups
Mark mono_class_vtable and mono_class_from_typeref external only.
2017-12-27 12:38:20 -05:00
Aleksey Kliger 649f509f04 [unit-tests] A few unit tests for mono_string_new_checked 2017-12-27 10:52:42 -05:00
Alexander Köplinger c7d8d247c3 [ci] Add existing LDFLAGS instead of overwriting 2017-12-27 16:44:39 +01:00
Aleksey Kliger 7bdbadbbb4 [unit-tests] Fix Makefile.am when Mono is compiled with LLVM 2017-12-27 10:10:16 -05:00
Aleksey Kliger 68baa2967d [object] Don't leak glib error in mono_string_new_checked
After we save the UTF8 to UTF16 conversion error to MonoError, free the GError.
2017-12-27 10:10:16 -05:00
Zoltan Varga ab04c61b60 [runtime] Add CallContext to the list of cross offset types to fix the cross compiler build. (#6337) 2017-12-25 16:23:20 -05:00
Aleksey Kliger (λgeek) 8ba48b5a41 [object] mono_string_new should not assert on UTF conversion failures (#6333)
Revert the embedding API behavior change introduced by dcdfb3c500

mono_string_new will:
 * return NULL if the given byte sequence is not a valid UTF-8 sequence
 * assert if there is not enough memory to allocate a new MonoString.

This only changes the behavior of the API function.  The runtime will continue
to use mono_string_new_checked which sets MonoError* for both sorts of
failures.
2017-12-25 10:45:52 +01:00
Vlad Brezae 60b180d24f [interp] Rename functions to be clearer 2017-12-23 18:14:15 +02:00
Vlad Brezae e427266501 [interp] Enable most pinvoke tests 2017-12-23 18:14:15 +02:00
Vlad Brezae 929e4b08a4 [arm64] Rework native entry tramp from interp 2017-12-23 18:14:15 +02:00
Vlad Brezae 23ea930161 [arm] Interp support for pinvoke 2017-12-23 18:14:15 +02:00
Bernhard Urban ee43f5a4ad [arm] use DMB ISH barrier instead of DMB SY
ISH is enough, as a "inner shareability domain" contains all PEs
controlled by a single hypervisor or operating system. That is inline
with GCC, linux kernel etc.

We do the same on ARM64: https://github.com/mono/mono/commit/efdf035cfb928ffe3c0ef81e7ce2bad8402cab26
2017-12-23 12:43:58 +01:00
Alexander Kyte c996dac676 [runtime] Bring jemalloc to mono (#6166)
* [runtime] Bring jemalloc to mono

Jemalloc is known to have much better performance than system memory
allocators, and is safe in concurrent/re-entrant situations.

To use, provide the following options to configure:

--with-jemalloc to enable optionally. To use at runtime,
export MONO_USE_JEMALLOC to the environment.

--with-jemalloc-always to enable and make the default

--with-jemalloc-assert to enable with assertions to catch memory
unsafety. It adds overhead, but an overhead that's much less than
valgrind or asan.

If you export
MONO_JEMALLOC_CONF="stats_print:true"

You will see detailed memory statistics for mono at exit.

Now note that jemalloc is used through an explicit registration, so
C libraries called through pinvoke calls will not use jemalloc unless
they configure themselves to do so separately.

To understand the build work, I'm statically linking jemalloc.a into
the compilation unit for mono/utils/mono-jemalloc.c, which is
responsible for registering it with mono at startup. No further
copying out of the submodule is necessary at installation time.

* [runtime] Fix OSX 32-bit build definition
2017-12-22 21:39:13 +01:00
Zoltan Varga 6b58f13177 [runtime] Avoid padding classes with an explicit size. Fixes #60298. (#6223) 2017-12-22 21:38:18 +01:00
Calvin 83a809553f Unbreak XMM register handling on platforms without MonoContextSimdReg (#6219)
* Unbreak XMM register handling on platforms without MonoContextSimdReg

Platforms like Haiku (and glibc-less Linux, but that was unbroken a few
weeks ago) don't have this implemented on Mono. (yet?) Restore old
behaviour behind an #ifdef (same one as on mono-context.h) - perhaps it
could be a nicer ifdef, but I'm keeping this consistent for now.

* Attempt at a universal ifdef for MonoContextSimdReg presence

Suggestion of @kumpera. I've put #ifdefs in the obvious places, and
verified that the commit ensures we're still in the same position as
before.

* Fix non-MonoContextSimdReg calls in tramp-amd64.c

Follow advice of @joncham wrt the type and function to use instead.
2017-12-22 21:18:37 +01:00
Bernhard Urban b3f9ee4413 [mini] cleanup some code to silent compiler warnings (#6325)
* [method2ir] remove unused ldind_to_load_membase ()

* [method2ir] mono_create_tls_get () can be static

* [method2ir] remove unused mono_create_tls_set () (and thus mono_create_fast_tls_setter ())

* [amd64] remove unused array and guard debug code properly to suppress compiler warning
2017-12-22 21:17:00 +01:00
jaykrell 740013d051 Fix an error ignore, and then remove the support for it, and unused similar. (#6292)
* "Fix" a case of an error being ignored.
* And then remove mono_string_to_utf8_image_ignore which is not used.
And then remove the gboolean ignore_error parameter which is always FALSE.
2017-12-22 15:11:19 -05:00
Alexis Christoforides 381d11c97e Merge pull request #6332 from directhex/fixbuild
Add file missed from e0b1d66519 to Makefile.am
2017-12-22 13:46:24 -05:00
Jo Shields c4d1df972e Add file missed from e0b1d66519 to Makefile.am
(cherry picked from commit 8c7efc8a9a7858e5cdf214a55d7c07ace2907cf6)
2017-12-22 11:42:23 -05:00
Marek Safar 841ffc2334 [mcs] Implements C# 7.0 Generalized async return types 2017-12-22 16:53:31 +01:00
Marek Safar 6e885dec43 [mcs] Support implicit user conversion from nullable type without unwrapping. Fixes #60900 2017-12-22 15:31:45 +01:00
Jason Imison 492f66c60f Bump F# to 4.1.29. Fixes #6281 (#6295)
* Bump F# to 4.1.29. Fixes #6281
2017-12-22 13:23:13 +01:00
Aleksey Kliger 2eba6b82ec [runtime] Rename mono_class_vtable_full to mono_class_vtable_checked
No functional change.
2017-12-21 17:06:49 -05:00
Aleksey Kliger dbb76ea0c3 [runtime] Mark mono_class_vtable external only.
- Runtime should use mono_class_vtable_full.
- Updated callers.
- Added a MonoError argument to:
  - mono_marshal_get_remoting_invoke
  - mono_marshal_get_xappdomain_invoke
  - mono_marshal_get_remoting_invoke_for_target
  - mono_marshal_get_remoting_invoke_with_check
2017-12-21 16:56:59 -05:00
Zoltan Varga bf3d8ce52d [bcl] Avoid rebuilding test libs all the time if the corresponding assembly doesn't exist because of the NO_BUILD flag. (#6318) 2017-12-21 14:47:00 -05:00
Zoltan Varga 9527a8e4dd [ios-sdk] Split non working assemblies into non-compiling and non-working, compile the ones which can be compiled. (#6319) 2017-12-21 12:47:08 -05:00
Marek Safar 8d36d250bc [mcs] Adds parser support for readonly ref syntax 2017-12-21 17:47:13 +01:00
Bernhard Urban 9cfdeb1a2e [arm] replace cp15 barrier usage wih dmb instruction on armv7
on armv8 chips this barrier isn't implemented in hardware and must be
emulated by the kernel if it runs aarch32 code:

https://github.com/torvalds/linux/blob/c9b012e5f4a1d01dfa8abc6318211a67ba7d5db2/arch/arm64/kernel/armv8_deprecated.c#L475
2017-12-21 17:05:50 +01:00
Mathieu Bourgeois 29428d9516 * Generalize commit 0c6932a985 to support LDARG{0|1|2|3}, LDLOC{0|1|2|3}, LDARGS, LDLOCS, LDARG and LDLOC instead of LDLOC and LDLOCS. Improves generated code similar to issue #60945 2017-12-21 16:57:46 +01:00
EgorBo 10ab6b7753 skip dim-valuetype test in interp mode 2017-12-21 12:56:02 +01:00
EgorBo 64ecc5d064 change return value from 100 to 0 (for success) 2017-12-21 12:56:02 +01:00
EgorBo 95f4da3358 add "dim-" prefix for the tests and ignore failed ones 2017-12-21 12:56:02 +01:00
EgorBo 8668a85552 Default interface methods IL tests from CoreCLR 2017-12-21 12:56:02 +01:00
Marek Safar c709e42040 [mcs] Fixes parsing of default literal inside conditional expression 2017-12-21 12:54:49 +01:00
Marek Safar fa9acab811 Update codeowners 2017-12-21 12:04:06 +01:00
Vlad Brezae 6b86787945 [interp] Don't abort during finally blocks
Unlike on the jit (where we set a local variable on the stack frame of the last finally block), use the simple explicit abort protecting code which is used also for cctors. We can't use handler block guard logic since we can't async unwind from the interpreter.
2017-12-21 12:17:08 +02:00
Vlad Brezae 9f8e2cd16a [interp] Remove duplicated code 2017-12-21 12:17:08 +02:00
Vlad Brezae edba55b883 [interp] Check for interruption after class initialization
We can have a pending abort that needs throwing
2017-12-21 12:17:08 +02:00
Vlad Brezae 3495c6054f [interp] Replace old and dead EH code 2017-12-21 12:17:08 +02:00
Vlad Brezae a02ef6352d [interp] Check for class failure when emitting constructor
As we do with the jit.
2017-12-21 12:16:49 +02:00
Aleksey Kliger f202cffa2b [runtime] Mark mono_class_from_typeref external only.
Runtime should use mono_class_from_typeref_checked.
2017-12-20 17:31:15 -05:00
jaykrell 93d0e9ed4d Fix apparent double or invalid free. (#6297) 2017-12-20 20:35:05 +01:00
monojenkins ad179f61d7 [msvc] Update csproj files 2017-12-20 17:30:44 +01:00
Marek Safar 723037ab13 Bump linker & cecil 2017-12-20 16:01:33 +01:00
Ludovic Henry 04a275df98 [interp] Fix build when disabled (2) (#6280) 2017-12-20 10:30:41 +01:00
Egor Bogatov cae8dd6dbd [System.Core] Use corefx System.Linq tests (~25k tests) (#5515) 2017-12-19 23:03:59 +01:00
Atsushi Eno 05d5204da8 [mono-api-html] do not warn about removal of [Obsolete] member. (#5294) 2017-12-19 18:23:32 +01:00
Li Keqing c0e6ecb6c2 [System.Windows.Forms] Fix CJK Encoding on Window Title 2017-12-19 18:22:03 +01:00
jaykrell e0b1d66519 cooperative suspend babystep wrt mono_domain_try_type_resolve(MonoObject*). (#6196)
* cooperative suspend babystep wrt mono_domain_try_type_resolve(MonoObject*).
No reduction in warnings, but remove one call to a function that has
warnings, leaving sre.c alone for now.

We have:
 mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb)
 mono_domain_try_type_resolve_checked (MonoDomain *domain, char *name, MonoObject *tb, MonoError*)

The MonoObject* tb parameter causes a warning under cooperative suspend static validation.

Between name and tb, only one is ever used -- i.e. the non-null one, favoring name.

The non-checked function is embedded, so it survives for the time being.

Internally, we have reflection.c calling _checked(name != null, tb == null) and sre.c the opposite.

So, this fix refactors the function such that one takes const char* and the other MonoObject* (or MonoReflectionTypeBuilder*).

Some calls to a function with a warning are therefore replaced by calls to a function without a warning.

sre.c is left alone for now, therefore the number of warnings does not go down.

The caching within of System.AppDomain.DoTypeResolve is refactored into mono_class_get_appdomain_do_type_resolve_method.
Should we have GENERATE_GET_METHOD_WITH_CACHE like GENERATE_GET_CLASS_WITH_CACHE?  Or GENERATE_GET_METHOD_CACHED?

A few stylistic experiments:
   ternary operator?
   const?
   Some name shortening?
   Non-anonymous struct tags?
   Forward declaration to increase type safety?
   _checked suffix optional if not differentiating from other?

* Cleanup MonoError initialization and usage.
Thread MonoError through a bit -- add mono_class_get_method_from_name_checked.
 Could also be named mono_class_get_method_from_name_flags_checked.
Rename tb to typebuilder.
rename _builder to _typebuilder.
Reduce but don't eliminate struct/typedef change.
Remove extra braces.

* More MonoError tweaking -- the existance of cleanup breaks the model.

* remove a newline that was added

* Remove line breaks.
Put struct forward declaration among others.
Restore g_warning.
i.e. code review feedback

* Remove some newlines.

* more newlines

* Move from public class.h to private class-internals.h.

* Move new forward declarations out of public header object.h
and into new internal header object-forward.h.
2017-12-19 16:35:31 +01:00
Pete Lewis 8c9c37c45b Only call waitpid for processes that Mono tracks, rather than all child processes owned by the calling process. (#6202)
waitpid(-1,...) reaps all zombie child processes of the calling process (see `man waitpid`). After a child process is reaped, it can no longer be queried. Because this reaping step is invoked via the `SIGCHLD` signal, all zombie children of the calling process are reaped every time any child process terminates, regardless of whether that child process was tracked by Mono.

The impact of this bug is that apps using Mono that spawn their own child processes (outside of Mono's `w32process` API) cannot query the exit state of its children. For example, a call to `waitpid(my_child_pid,...)` will return `ECHILD` for "no such child" because Mono has already cleaned up the child the moment `SIGCHLD` was raised.
2017-12-19 16:33:33 +01:00
jaykrell 11e18c2a5d This list is almost sorted -- so repair the sorting and add comment. (#6244) 2017-12-19 16:27:03 +01:00
jaykrell fba6bfc954 Minor cleanup split out and expanded from another larger change. (#6263)
* Minor cleanup split out and expanded from another larger change.
 - Spelling in comment.
 - 'l' is a short identifier that looks like '1' -- use "len".
 - Remove extra braces.
 - Add some g_assert (error) before error_init (error).

* remove unuseful asserts
2017-12-19 16:21:55 +01:00
Alexander Kyte 6ca7b346cd [runtime] Fixes issue when compiling with -no_weak_imports (#6276) 2017-12-19 16:08:03 +01:00
Ludovic Henry 5f5c5e97a0 [threadpool] Replace parked_threads condition variable by a semaphore (#6222) 2017-12-19 15:29:29 +01:00
Ludovic Henry f6bf1d427b [threads] Ensure we remove the thread only once (#6194)
* [threads] Ensure we remove the thread only once

* [threads] Inline unsused function

* [threads] Assert we are on the current thread when detaching
2017-12-19 15:28:53 +01:00
jaykrell 891941ecbe Remove a few braces that are contrary to our prescribed style. (#6245) 2017-12-19 09:07:38 -05:00
Zoltan Varga a2407ac76a IOS SDKs (#6257)
* [ios-sdk] Rename test-runner directory to 'runtime' to be consistent with xamarin.ios.

* [ios-sdk] Add missing xamarin_log () icall used by Console.Write ().

* [ios-sdk] Change the run-ios-sim target so it works on ios11 as well, the --console option to simctl appears to be broken.

* [ios-sdk] Add a test harness.

The test harness is resposible for starting the emulator, installing the app on the emulator, running it, and
collecting application output using the osx logging facilities.

* [ios-sdk] Fix detection of the app exiting with an unhandled exception.

* [ios-sdk] Add CI support for running some test suites on the simulator.

* [ios-sdk] Kill the log reader process on shutdown.

* [ios-sdk] Disable android on CI because the make targets error out if the android sdk is not installed.

* [ios-sdk] Fix error checking in make targets.

* [ios-sdk] Remove accidently commited binary.

* [ios-sdk] Switch to using os_log instead of NSLog (), the latter doesn't seem to show up in the logs anymore. Switch to using the default ios sdk instead of hardcoding 11.1.

* [ios-sdk] Don't hardcode the ios version when creating a simulator.

* [ios-sdk] Parse the output of simctl list runtimes as json.

* [ios-sdk] Use 'syslog' style logging, its supported by older osx versions.

* [ios-sdk] Fix logfile parsing.

* [ios-sdk] Fix log filtering.

* [ios-sdk] Add test exclusions file for System.

* [ios-sdk] Redirect runtime logging to os_log ().

* [ios-sdk] Link libMonoPosixHelper and zlib into the test runner.

* [ios-sdk] Fix the target64 and cross64 builds.

* [ios-sdk] Build target64/cross64 on CI.

* [ios-sdk] Add device support to the runtime lib. Mark strings in os_log () calls as public.

* [ios-sdk] Log stdout messages using a separate subsystem for easier filtering.

* [ios-sdk] Add an 'appbuilder' tool which can generate simulator and device apps.

* [ios-sdk] Build device tests on CI.

* [ios-sdk] Add a test-runner instead of using nunit-lite-console.exe. The two are identical right now, but they might diverge in the future.

* [ios-sdk] Add a script to download prebuild llvm binaries.

* [ios-sdk] Run the runtime initialization on a separate thread, not the UI thread.

* [ios-sdks] Fix the build.

* [ios-sdk] Build the cross compiler against llvm.

* [ios-sdk] Add missing file.

* [ios-sdk] Add llvm support, enabled by passing LLVM=1 to make build-ios-dev-<app>.

* [bcl] Enable System.Security tests on the MOBILE profile.

* [ios-sdk] Enable more test suites.

* [ios-sdk] Fix device builds.

* [ios-sdk] Make some test steps non-fatal.

* [ios-dev] Use ad-hoc signing to sign device apps.

* [ios-sdk] Decrease the timeout on run-sim to 20m.

* [ios-sdk] Send back the test results using a tcp connection, parsing the ios logs is too fragile.

* [ios-sdk] Mark System.Net.Http tests as notworking, they seem to fail on CI.

* [ios-sdk] Compile the 32 bit cross compiler against llvm as well.

* [ios-sdk] Package up the binaries which can be uploaded to storage.

* [ios-sdk] Fix the download-llvm.sh script.

* [ios-sdk] Compile cross32 on CI.

* [ios-sdk] Use Options.cs from the mcs sources instead of making a copy.

* [ios-sdk] Avoid hardcoding the xcode sysroot, obtain it using 'xcode-select -p'.

* [ios-sdk] Fix the previous change.

* [ios-sdk] Add an option to appbuilder to cache aot compilation results between building different apps.

* [ios-sdk] Build device apps with llvm as well on CI.

* [ios-skd] Use XCODE_ROOT in a few more places, update README.md.
2017-12-19 09:04:44 -05:00
Egor Bogatov e9e17e069e [System] System.Net.* tests from corefx (+RemoteExecutorTestBase) (#6136) 2017-12-19 11:37:51 +01:00
Alexis Christoforides 84c9542f15 Merge pull request #6215 from YuriyGS/bug15051
[System.Windows.Forms] DataGridView throw exception when trying to remove a row. Fixes #15051.
2017-12-18 18:47:42 -05:00
jaykrell 57ad62b9ec Just fix one typo in a comment. (#6240) 2017-12-18 19:15:43 +01:00
Vlad Brezae 08938db840 [sgen] Fix behavior of forced collections
Triggering a forced collection means that it should to an immediate full collection of that generation. If we were having a running concurrent collection we were only finishing it. We should also trigger a new serial gc.
2017-12-18 19:35:42 +02:00
Vlad Brezae 4bce944f45 [profiler] Trigger heapshots only on major serial collections
After minor or concurrent collections, we can have dead objects (can not be referenced starting from the current root set) still alive on the heap which can confuse profiling tools.

If we have a heapshot requested and we can't do it on the current collection, defer it to the finalizer.
2017-12-18 19:35:42 +02:00
Vlad Brezae b9b639c6a5 [profiler] Report roots from ephemerons
The ephemeron array is an array of (key, value) pairs where value is alive (root) if key is alive.
2017-12-18 19:35:42 +02:00
Zoltan Varga 1b249d561e [bcl] Allow conversion from enums and their basetypes in both directions with Delegate.CreateDelegate (). Fixes https://github.com/mono/mono/issues/6255. 2017-12-18 15:07:07 +01:00
Marek Safar 742590f5b4 Merge pull request #6168 from radekdoulik/pr-add-linker-analyzer-script 2017-12-18 14:54:19 +01:00
Radek Doulik 69f99f1633 [linker-analyzer] Added man page for the linker analyzer 2017-12-18 13:07:08 +01:00
Radek Doulik c7acb025f5 [linker-analyzer] Rename the tool to illinkanalyzer
As per discussion in https://github.com/mono/mono/pull/6168
2017-12-18 13:07:07 +01:00
resurrexit 4a8adbd8dc [I18N] Include missing subset of shift_jis characters (#6232) 2017-12-17 11:45:21 +01:00
Vlad Brezae 6d018681ee [amd64] Rework native entry tramp from interp 2017-12-16 19:49:33 +01:00
Radek Doulik ff76904cbe [monodroid] Build linker-analyzer tool for monodroid
We would like to include linker analyzer in the Xamarin.Android
installation (https://github.com/xamarin/xamarin-android/issues/1093)
2017-12-16 11:04:33 +01:00
Marek Habersack e3ffc2e984 [android] Android NDK does not contain API level/platform 12
Lack of it causes a build error in XA:

   CMake Error at [..]mono/external/boringssl/util/android-cmake/android.toolchain.cmake:800 (message):
         Specified Android native API level 'android-12' is not supported by your

The set of minimum API levels in `configure.ac` is incorrect. The current
NDK (r16) requires minimum API level of 14 for the 32-bit targets and level 21
for the 64-bit targets.
2017-12-15 19:38:47 +01:00
Marek Safar 9c00f0c0c4 [github] Update issue template not to auto-convert platforms into tasks 2017-12-15 15:38:24 +01:00
Vlad Brezae 43e0e6b941 [interp] Restore valuetype copying for pinvoke case.
Reverts 65a94cb15f for native struct copying.
2017-12-15 13:33:30 +01:00
Vlad Brezae 61dde4b1de [interp] Add some missing icall signatures
For mono_marshal_asany and mono_marshal_free_asany
2017-12-15 13:33:30 +01:00
Vlad Brezae f0bfd787e3 [interp] Replace define
It's confusing
2017-12-15 13:33:30 +01:00
Vlad Brezae 710149b90a [interp] Fix delegate invocation of native functions
For a m2n transition we expect that we are already in managed (interp) and the delegate's method_ptr expects an InterpMethod. Refactoring will be needed in the future.
2017-12-15 13:33:30 +01:00
Vlad Brezae 8aafd8660e [marshal] Avoid using CEE_UNBOX for struct marshaling
Mirror mono_marshal_get_struct_to_ptr. These methods can also handle non valuetypes (with certain attributes), which CEE_UNBOX doesn't logically handle.
2017-12-15 13:33:30 +01:00
Vlad Brezae a90d5c7865 [metadata] Remove unused ldloc
Fixes stack warnings in interp
2017-12-15 13:33:30 +01:00
Vlad Brezae 5a7ff666c5 [interp] Remove assert 2017-12-15 13:33:30 +01:00
Bernhard Urban 7924c406d9 [interp] on cee_ret use underlying type which handles, among other things, ref types correctly
while at it:
    * only get MonoClass if really necessary.
    * use helper function to print method with signature.

fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=60756
2017-12-15 12:53:11 +01:00
Josh Peterson 58a491b96c Avoid using BSTR for conversion of a SecureString
There is no need to use BSTR marshaling to convert a SecureString to a
string. On some platforms, BSTR marshaling is not implemented, but we
still want to be able to convert a SecureString to a string on those
platforms.

So instead, use Unicode string marshaling.
2017-12-15 10:40:38 +01:00
monojenkins 99e3bc8904 [msvc] Update csproj files 2017-12-15 10:28:23 +01:00
Katelyn Gadd 252d61d055 Fix bug 60568: SynchronizationContext.Wait not implemented or invoked by runtime (#6062)
* Checkpoint: Implement SynchronizationContext.Wait

* Add missing check for null synchronization context

* Update bug 60568 fix to cover WaitAll and add test cases

* Add missing file
2017-12-14 12:14:47 -05:00
Ludovic Henry 5e9081600f [console] Invoke async console cancel on ThreadPool from managed 2017-12-14 11:14:26 +01:00
lateralusX be683c14b9 Wait on runtime threads to park on joinable thread list during shutdown.
https://github.com/mono/mono/pull/5599 fixed a race condition during shutdown
when runtime threads have come parts of their way through detach, but still
depend on runtime resources, like GC memory. The fix added runtime threads
to the joinable thread list just before they vanished from mono_thread_manage
radar making sure shutdown waited upon the thread before cleaning up.

The above fix slightly changed the behavior of the finalizer thread since it
waits on joinable threads and will now potential block on threads still
executing code (that involves runtime resources). There’s was an assumption
around the threads on the joinable thread list that they should be very close
to complete when added, so join calls coming from the finalizer thread should
almost never block and if it does, the code that remains to execute should not
involve runtime operations risking deadlock situations. Adding the thread to
the list earlier than previously done expose the shutdown to some potential
theoretical problems.

To mitigate the risk and still solve the race condition this commit adds a
mechanism to keep track of active runtime threads until they park on joinable
thread list. The pending counter will be waited upon by the shutdown
thread, just before it does its regular wait on all joinable threads
(after finalizer thread has stopped) to make sure all runtime threads have
been added to the joinable thread list before waiting upon them. Threads are
added to the joinable thread as late as possible, exactly how it’s been done
in the past by sgen_client_thread_detach_with_lock. Shutdown thread will wait
on runtime threads to appear on the list for a short time and if timeout (pending
runtime thread count not reaching 0 before timeout), it will just print a warning
and continue shutdown.

Getting into a wait state during shutdown due to runtime threads not yet added to
joinable threads list should be very rare (hitting previous race condition that was rare),
triggering the timeout should be even more rare, and if that ever happens, we are exposed
to shutdown race condition as we have had in the past, but now we at least get a warning in
the log making it simpler to analyze further.

This commit also fixes a problem with the debugger thread hitting the same race condition as above.
The shutdown thread stopping the debugger thread didn't completely wait for it to stop using runtime
resources before continue shutdown sequence. This triggers the same race condition as when shutting
down regular runtime threads. This commit makes sure stop_debugger_thread waits on the debugger thread
handle to become signaled (happens at the very end of thread lifetime) before continuing the shutdown
logic.
2017-12-14 10:52:51 +01:00
Martin Baulig cd09ddbc55 New PR for the new web stack (#6125) 2017-12-14 10:06:47 +01:00
Alex Rønne Petersen 76d7ab281d [Mono.Profiler.Log] Fix reading of TYPE_JITHELPER events for < v14. 2017-12-14 09:47:31 +01:00
Rodrigo Kumpera f3e04b182a [wasm] Fix runtime compilation. Fixes by Kenneth Pouncey 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera 68eb7bc3f8 [wasm] Update corlib testsuite to disable multi-threaded tests. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera 9eecae812c [wasm] Run finalizers from a background task. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera f08f228fcf [wasm] Add comment to generated file that is was... generated. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera 4ad5fc61c6 [corlib] Mark tests that requires multiple threads with the "MultiThreaded" category. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera 7ac259dc67 [wasm] Implement a wasm specific threadpool worker. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera d5ebaad99d [wasm] Move runtime background pumping to utils and make it work with multiple subsystems. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera 198a7c6482 [wasm] Pass the name of the test suite to the test driver. Disable running tests that fail under the interpreter. 2017-12-14 09:43:00 +01:00
Rodrigo Kumpera 1b1ba678b7 [wasm] Disable mini test that fails due to the interpreter 2017-12-14 09:43:00 +01:00
Jo Shields c593c1e351 [mkbundle] Bundle unmanaged libs 2017-12-14 09:41:50 +01:00
Marek Safar 7bf60c3ec9 [build] Redirect api build to reference-assemblies 2017-12-14 09:24:32 +01:00
Bernhard Urban 746a3d0214 [corlib] rename NotWorkingInterpreter and InterpreterNotWorking categories (#6225) 2017-12-14 00:52:49 +01:00
Bernhard Urban f9287857f2 [mini] isalnum() respects encoding in python3, we only want to have ASCII chars (#6199) 2017-12-14 00:43:27 +01:00
Zoltan Varga 2aadbf1724 [s390x] Fix errors in cpu-s390x.md which are exposed by the new genmdesc. (#6233) 2017-12-13 17:29:39 -05:00
Zoltan Varga c90690310c No mem needs (#6210)
* [jit] Remove unused mono_arch_instrument_mem_needs () function.

* [jit] Remove unused mono_arch_instrument_epilog_full () function, only the non-full version is used.

* [jit] Remove some unused arch specific functions previously used by the global regalloc prototype.
2017-12-13 16:35:33 -05:00
Rodrigo Kumpera e5fa0b75b4 Merge pull request #6234 from vargaz/llvm-weak-fields
[aot] Fix aot+llvm after the weak field changes.
2017-12-13 13:07:22 -08:00
Rodrigo Kumpera aeceaa7e1e Merge pull request #6203 from luhenry/fix-6169
[threads] Fix leak of gchandle to MonoInternalThread
2017-12-13 13:01:39 -08:00
Ludovic Henry 19cba1df37 [interp] Fix build when disabled (#6218) 2017-12-13 08:16:22 -05:00
Zoltan Varga 5ec0243196 [aot] Fix aot+llvm after the weak field changes. 2017-12-13 01:38:18 -05:00
Marek Safar da807f6f90 [mcs] Propagate flow analysis for tuple deconstruct 2017-12-12 23:12:15 +01:00
Ludovic Henry 1e3fb99fa3 [threads] Fix leak of gchandle to MonoInternalThread
Fixes https://github.com/mono/mono/issues/6169
2017-12-12 16:41:51 -05:00
Radek Doulik 85e33cfdba [linker-analyzer] Added to the scripts 2017-12-12 22:19:03 +01:00
Marek Safar 2d43cf694f Add issue template 2017-12-12 14:27:56 +01:00
Miguel de Icaza 4f6e01edcd Create ISSUE_TEMPLATE.md 2017-12-11 14:25:11 -05:00
YuriyGS 61588a1d53 Second issue of bug #15051. first_row_index was corrupted by MoveCurrentCell call. 2017-12-11 14:54:22 +03:00
monojenkins 2b90049bcc [msvc] Update csproj files (#6206) 2017-12-08 11:47:35 -05:00
YuriyGS 09ea581914 Fixed a crash when deleting a row containing a selected cell 2017-12-08 12:32:58 +03:00
Alexis Christoforides 7758f54dcf Merge pull request #1450 from echampet/session
System.Web.SessionState: simplify sessions retrival polling
2017-12-07 20:00:23 -05:00
Alexander Köplinger dd34edb907 Bump roslyn-binaries submodule 2017-12-07 14:41:48 -05:00
Alexander Köplinger 27790b9495 Bump roslyn-binaries submodule 2017-12-07 14:39:47 -05:00
Alex Earl 8be2726e12 Add install of Visual Basic compiler (#6127)
This is a follow on to mono/roslyn-binaries#3 which adds the Roslyn VB.NET compiler to the roslyn-binaries repo. This will then install the binaries to the mono installation.
2017-12-07 13:45:09 -05:00
Marek Safar 1724ce22a3 [mcs] Add a detection for ByRefLikeMarker (#6195) 2017-12-07 13:14:42 -05:00
Alex Rønne Petersen d7ac79ccc0 [profiler] Rework GC roots reporting. (#6144)
This change re-implement GC roots reporting in a way that allows users to correctly track the source of a GC root.

The new design is based on emitting GC root information upfront and only report addresses during heap dumps.

When a GC root is registered we emit an event that is an address range, the root kind, a key and a text description.

A decoder can use this information to match a reported root address with all registration addresses to figure out what they mean.

A GC Root key is used to further its meaning. For example, if kind is thread, key is a tid, if kind is static variables, key is the vtable pointer and so on.

The build of the change is introducing this key argument across all root registration code and rework our root reporting code to encode their addresses.

Some roots use pseudo-addresses when they are not registrable. This is the case of thread stacks/registers and the finalizer queue.

Finally, root reporting was changed to happen only once per collection and at the end, leading to correct and useful data being produced.
2017-12-07 10:47:18 -05:00
Bernhard Urban 4d5d54f7a8 [interp] disable weak-fields.exe (#6191) 2017-12-07 08:28:52 -05:00
Calvin 5a581fb229 Compile on amd64 Haiku (#4473)
* Compile on amd64 Haiku

Use sigcontext (somewhat like win32, or x86) on Haiku amd64.

On amd64, Haiku doesn't have issues with marshalling 64-bit values,
but it currently does have issues with SGen either causing a stall
or a core dump. As such, while it can compile the stdlib (further
than x86 got), it's still a work in progress.

* Use set_real_time_clock for sys-time.c on Haiku

* Get mono-boehm compiling on Haiku again

It still doesn't work. Initialization will call GC_mark_from, which
will cause a segmentation fault as it decrements pointers. (Mono
will enter an infinite loop in mono_get_hazardous_pointer as a result.)

For now, mono-sgen will continue to be used by default.
2017-12-06 15:43:20 -05:00
Rodrigo Kumpera b683e1076a [runtime] Thread MonoError through mono_class_get_overrides_full. (#6069)
* [runtime] Thread MonoError through mono_class_get_overrides_full.

* [runtime] Use goto_if_nok
2017-12-05 22:07:00 -05:00
monojenkins 657ff6d38a [msvc] Update csproj files (#6163) 2017-12-05 17:23:00 -05:00
Alexis Christoforides 233212bd24 Revert "Merge pull request #5643 from alexanderkyte/jemalloc"
This reverts commit 3dac926be3, reversing
changes made to 50b6a2e823.
2017-12-05 15:58:43 -05:00
Alexis Christoforides 3dac926be3 Merge pull request #5643 from alexanderkyte/jemalloc
[DONTMERGEruntime] Bring jemalloc to mono
2017-12-05 14:24:12 -05:00
Egor Bogatov 50b6a2e823 Fix genproj.cs (make update-solution-files) (#6162)
make update-solution-files works but actually throws an ArgumentOutOfRangeException and as a result - corrupted csproj (fails on System.Runtime.CompilerServices.Unsafe -
System.Runtime.CompilerServices.Unsafe.dll.sources is empty)
2017-12-05 11:37:15 -05:00
Alexander Kyte 63a49e9eb8 [runtime] Fix OSX 32-bit build definition 2017-12-05 11:25:26 -05:00
Aleksey Kliger (λgeek) 67c9ed311c README.md: point at GitHub Issues 2017-12-04 22:24:26 -05:00
Radek Doulik 6a867bd856 [linker-analyzer] added --flat option (#5629)
* [linker-analyzer] added --flat option

This options allows to see all dependencies per vertex at once, with
displayed distance in the graph between the vertex and dependent
vertex.

An example of flat output:

    Loading dependency tree from: linker-dependencies.xml.gz

    --- Type dependencies: 'Android.App.Activity' --------------------------

    Distance | TypeDef:Android.App.Activity [total deps: 7]
    ------------------------------------------------------------------------
           1 | TypeDef:XA.App.MainActivity
           2 | Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
           3 | Other:Mono.Linker.Steps.ResolveFromAssemblyStep
           3 | Other:Mono.Tuner.CustomizeActions
           3 | Other:MonoDroid.Tuner.MonoDroidMarkStep
           2 | TypeDef:XA.App.MainActivity/<>c__DisplayClass1_0

* [linker-analyzer] Get back to using "unnamed" tuples

Use unnamed tuples to workaround mcs bug. We can revert this change,
once mcs is updated.

The build with mcs was failing like this, because of mcs bug:

```
MacBook:linker-analyzer rodo$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-local
MCS     [net_4_x-darwin] linkeranalyzer.exe

Unhandled Exception:
System.NotImplementedException: named tuples for .interfaceimpl
  at Mono.CSharp.TypeDefinition.Emit () [0x00028] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeDefinition.Emit () [0x002e8] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.Class.Emit () [0x00000] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.Driver.Compile () [0x002f3] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <e953cb7042ea446195951c3e14c2cc5a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NotImplementedException: named tuples for .interfaceimpl
  at Mono.CSharp.TypeDefinition.Emit () [0x00028] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeDefinition.Emit () [0x002e8] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.Class.Emit () [0x00000] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.Driver.Compile () [0x002f3] in <e953cb7042ea446195951c3e14c2cc5a>:0
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <e953cb7042ea446195951c3e14c2cc5a>:0
make[1]: *** [../../class/lib/net_4_x-darwin/linkeranalyzer.exe] Error 1
make: *** [do-all] Error 2

```
2017-12-04 22:23:36 -05:00
Alexander Köplinger 399c2c89c7 [tests] Disable weak-fields.exe on FullAOT as well 2017-12-04 18:13:04 -05:00
Alexander Köplinger cd5f5282f2 Bump version to 5.11 (#6158) 2017-12-04 15:21:26 -05:00
Alexander Köplinger 58618dea1e [tests] Disable weak-fields.exe on ARM
It was introduced by https://github.com/mono/mono/pull/5972

Filed bug: https://bugzilla.xamarin.com/show_bug.cgi?id=60973

Reviewed manually by @lewurm.
2017-12-04 12:59:46 -05:00
Marek Safar a21fb19fc7 [mcs] Don't emit tuple names for a private types 2017-12-04 13:31:11 +01:00
Zoltan Varga db05a2523c [llvm] Update the llvm backend to work with the 2017-12-01-31d7f39423874d52922c06484f2c2af216844b4d branch of the mono llvm fork. (#6143) 2017-12-04 01:42:53 -05:00
David Karlaš 2bab8fa49e [Profiler] Fix parsing bug when jit is enabled
Bug was caused by wrong values in enum because `string` is parsed only when type is `SpecificTrampoline` but with mismatching values between C and C# enums it didn't parse string when it should causing parsing next event throwing random exceptions because there was still unexpected string data.
2017-12-04 03:45:58 +01:00
Zoltan Varga 5bdaef7e5f [runtime] Add support for weak fields. (#5972) 2017-12-03 23:47:05 +01:00
Zoltan Varga d107f0852c [jit] Fix the DISABLE_JIT build. (#6152) 2017-12-03 11:13:18 -05:00
Radek Doulik e2e34c157c [linker-analyzer] Fix error reporting
Make sure we don't "crash" with an unhandled exception and instead
report a problem loading the file.
2017-12-02 15:11:21 +01:00
monojenkins 0ae98538f6 Merge pull request #6148 from alexrp/profiler-stress-msbiology
[acceptance-tests] Disable the msbiology test completely.

It's proven to be too flaky everywhere, with random timeouts and OOMEs.
2017-12-02 11:35:03 +01:00
Alex Rønne Petersen f714138216 [acceptance-tests] Disable the msbiology test completely.
It's proven to be too flaky everywhere, with random timeouts and OOMEs.
2017-12-02 04:59:58 +01:00
Bernhard Urban ce96441a10 [mem access] don't do regular store if it's already handled by the unaligned case
fixes (for the runtime part): https://bugzilla.xamarin.com/show_bug.cgi?id=60865
2017-12-01 21:46:38 +01:00
Aleksey Kliger (λgeek) 465e2036d3 [w32handle] Don't enter GC SAFE around calls to w32handle_wait_{one,multiple} (#6132)
* [w32handle] Don't enter GC SAFE around calls to w32handle_wait_{one,multiple}

On non-Win32, the mono_w32handle_wait_{one,multiple} implementation is
coop-aware, so there's no need to enter/exit GC Safe.

On Win32, mono_win32_wait_for_{single_object,multiple_objects}_ex is not coop
aware (and can't be - because it's called from utils/os-event-win32.c which is
not supposed to use coop machinery), so do GC transitions around these calls.

Fixes cooperative GC regression due to f5fc773512

* [w32process] Use coop concurrency primitives

for exit_sem and processes_mutex.

With OS semaphores we could deadlock under coop GC if a GC happens at the same time that
a thread is waiting on the exit_sem - the finalizer thread gets suspended and
the incoming SIGCHLD never posts, so the waiting thread never suspends and the
GC STW never happens.

fixup! [w32process] Use coop semaphore for exit_sem

* [test] assembly_append_ordering.cs: mark methods with NoInlining

if TriggerLoadingSystemCore is inlined into Main, System.Core will be loaded
when Main is JITed, which throws off the assembly loading ordering that the
test cares about: that the SRE assembly is loaded before System.Core.
2017-12-01 10:42:49 -05:00
Bernhard Urban f079d5f961 [interp] move interp functions into a callback 2017-12-01 12:10:03 +01:00
Vlad Brezae 13d221bf40 [mini] Add missing try holes
When we leave a try block and invoke finally blocks, we need to add try holes also for catch handlers, since they can invoke the previously handled finally blocks.
2017-12-01 10:33:31 +01:00
Ludovic Henry f408d2c4c4 [log] Rework MONO_TRACE_* to allow for nested io-layer masks (process, file, handle, etc.) (#6138) 2017-11-30 23:28:23 -05:00
Alex Rønne Petersen c12b749434 Merge pull request #6134 from alexrp/master
[profiler] Correctly encode counter type/unit/variance values.
2017-12-01 04:28:31 +01:00
Zoltan Varga 225071a2a5 [llvm] Fix the build. (#6142) 2017-11-30 20:22:21 -05:00
Zoltan Varga c8bf8c287a [runtime] Replace the C and perl versions of the genmdesc tool with a python version. (#6140)
This has the following advantages:
    * There is only one implementation instead of two
    * The C version no longer needs to be compiled/recompiled.

    The disadvantage is the additional build time dependency on python.

    The windows build will keep using the C version for now.
2017-11-30 20:09:22 -05:00
markusbeth 3635db23fc Cleanup unused MONO_DISABLE_SHM env var (#6141)
The environment variable MONO_DISABLE_SHM seems to be unused now.
Cleanup the leftovers.
2017-12-01 01:32:09 +01:00
Zoltan Varga 9c2c689a61 Mini h cleanup (#6072)
* [jit] Extract AOT definitions from mini.h to aot-runtime.h.

* [jit] Remove some dead declarations from mini.h.

* [jit] Extract some non-JIT related functions and MonoJitDomainInfo/MonoJitTlsData into mini-runtime.h
2017-11-30 18:25:11 -05:00
monojenkins dcbc55c615 [msvc] Update csproj files (#6137) 2017-11-30 23:07:22 +01:00
Alexis Christoforides 73c6a2ee50 Merge pull request #6135 from YuriyGS/DataGridViewCell-Border
[System.Windows.Forms] Proper paint cell border and divider in DataGridView
2017-11-30 10:10:07 -05:00
Alex Rønne Petersen 26de079c89 [profiler] Correctly encode counter type/unit/variance values.
The change to encode these fields as byte was incorrect.
2017-11-30 10:09:52 +01:00
YuriyGS be6c2af639 Additional cell paddings in TextBoxCell:
- 1 pixel for right and bottom to compensate cells CellBounds overlapping;
 - one more pixel for top, right and bottom to have one pixel gap between text and border. Left border had a good gap already (why?).
No call DrawText for cell if there is no rectangle at all.
2017-11-30 11:50:01 +03:00
YuriyGS 384a163cfa Drawing row & column divider and take it into account for drawing borders.
Implemented paint for all missing border styles.
2017-11-30 11:45:07 +03:00
YuriyGS 0c873d207a AdjustCellBorderStyle - implemented edge/non-edge header/non-header row and column border styles fixed.
Fixed singleVerticalBorderAdded and singleHorizontalBorderAdded flags for the AdjustCellBorderStyle method call.
2017-11-30 11:27:04 +03:00
YuriyGS 2bd75f83ea Outset and SingleHorizontal border styles fixed 2017-11-30 10:49:42 +03:00
Alex Rønne Petersen 0239710580 [profiler] Ensure the profilers behave sensibly when loaded during AOT compilation.
The AOT profiler is not meant to be loaded during AOT compilation.

The coverage profiler does not currently support instrumentation of AOT code.

The log profiler does support enter/leave instrumentation of AOT code, but no
other functionality should be enabled in this case. We only want to set the
call instrumentation filter callback and then return control to the runtime.
2017-11-29 23:09:02 +01:00
Rodrigo Kumpera 0c88bc2ca3 Merge pull request #6115 from alexrp/profiler-lls-fix
[profiler] Fix thread list insertion failures.
2017-11-29 17:00:48 -05:00
Rodrigo Kumpera 804979969a Merge pull request #6110 from alexrp/master
[profiler] Make it possible to trigger heapshots from the M.P.L library.
2017-11-29 16:53:57 -05:00
Andreas Lindh 370fd7bb86 un-commented HmacSha256Signature bug 35661 2017-11-29 19:41:27 +01:00
monojenkins c5d3bf2428 [msvc] Update csproj files (#6131) 2017-11-29 17:14:06 +01:00
Marek Safar 33afa19ce3 [mcs] Implements C#7.1 default literal 2017-11-29 12:02:24 +01:00
Bernhard Urban 425c62c5da [interp] disassembler for mint instructions should return a string instead of printing char by char (#6114)
* [interp] disassembler for mint instructions should return a string instead of printing char by char

otherwise logs are unreadable on products like XI

* [fixup] free `ins`
2017-11-29 10:40:14 +01:00
Rodrigo Kumpera c79c456bd8 Merge pull request #6043 from kumpera/wasm-p2
Multiple fixes to the wasm backend
2017-11-28 15:39:00 -05:00
Aleksey Kliger (λgeek) 58d94f4f7f [loader] Don't assert on abstract methods in get_method_constrained (#6109)
If the constrained class is abstract, it might not implement the given method.
2017-11-28 15:02:28 -05:00
Alexis Christoforides b4eb34de9b Merge pull request #6121 from akoeplinger/bump-msbuild
Bump msbuild to xplat-master branch
2017-11-28 14:52:38 -05:00
Alexis Christoforides 38cc502132 [ci] Make bockbuild step fatal for run-test-mac-sdk.sh 2017-11-28 14:49:48 -05:00
Alexander Köplinger 8d1ef54321 [ci] Skip System.Runtime.CompilerServices.Unsafe tests on arm32 too
It fails on all 32bit architectures, not just i386.
2017-11-28 19:48:44 +01:00
Alex Rønne Petersen c36f5afb58 [profiler] Add an assertion to the log profiler to catch the thread resurrection case. 2017-11-28 19:06:59 +01:00
Alex Rønne Petersen 22d22ff3d5 [profiler] Remove tools_thread checks when raising profiler thread events.
These checks are no longer necessary as these thread callbacks are not invoked
for tools threads in the first place.
2017-11-28 19:06:57 +01:00
Alex Rønne Petersen cd46e14ee4 [profiler] Use thread_exited profiler event for recording thread end events.
With the revamped GC root reporting work, some GC root unregister events will
arrive after the thread_stopped event. This will cause the thread to be
re-added to the thread list in the profiler, and never be removed until program
exit. This meant that if such a thread had actually exited and a new thread
would reuse its thread ID, that new thread would fail to add itself to the
thread list, leading to failures like this one:

    init_thread: failed to insert thread 0x70000b761000 in log_profiler.profiler_thread_list, found = true

By using the new thread_exited event, we remove the thread from the thread list
after these GC root unregister events have arrived, thereby ensuring that the
thread won't be incorrectly 'resurrected'.
2017-11-28 19:06:55 +01:00
Alex Rønne Petersen 832e161fc9 [profiler] Add thread_stopping and thread_exited profiler events.
thread_stopping occurs earlier than thread_stopped, before any of the detach
code has run. thread_exited occurs after thread_stopped, once all detach logic
has finished.
2017-11-28 19:06:46 +01:00
Alexander Köplinger 8d487ae8e2 Bump bockbuild to upgrade expat library (#6093)
We've been asked by the upstream maintainers to update it: https://github.com/mono/linux-packaging-mono/issues/3
2017-11-28 18:54:24 +01:00
Bernhard Urban c92f638d2e [interp] small improvment for error reporting in interp compile method callback 2017-11-28 18:17:23 +01:00
Bernhard Urban 7ed2c02d0c [aot] encode interp_in wrappers with proper signature 2017-11-28 18:17:23 +01:00
Bernhard Urban fcfaf09acb [interp] fix copy/paste-typo in n2m macro magic 2017-11-28 18:17:23 +01:00
Bernhard Urban ccc1bd2c18 [aot] add more signatures for interp_in wrapper needed for iOS
signatures are coming from there:
https://github.com/xamarin/xamarin-macios/blob/2d4256ef15f1ebf0b7f5774dee03a97a8c32f3a6/runtime/delegates.t4#L9
2017-11-28 18:17:23 +01:00
Egor Bogatov afea7b6c79 [System] Add corefx tests for System.CodeDom (#5623) 2017-11-28 17:18:21 +01:00
Alexander Köplinger eb11cee53c Bump msbuild to xplat-master branch
In preparation for the next branching.
2017-11-28 17:12:49 +01:00
Alexander Kyte 0927d51418 [runtime] Implement a few ModuleBuilder getters (#5787)
* [runtime] Implement a few broken getters on ModuleBuilder

* [runtime] Implement ModuleBuilder.GetCustomAttributes

* [runtime] Test GetMethods, GetCustomAttributes, and GetFields for ModuleBuilder

* [runtime] Specify and test use of typebuilders with Custom Attributes + add more tests
2017-11-28 10:44:38 -05:00
monojenkins b3fad3f0f8 [msvc] Update csproj files 2017-11-28 16:44:07 +01:00
Ludovic Henry f5fc773512 [w32handle] Pass MonoW32Handle to more places (#5570)
* [w32find] Remove use of w32handle

* [w32handle] Ref handle when looking it up so it doesn't get destroyed while using it

* [w32handle] Ref handle when accessing its MonoW32HandleBase

* [w32handle] Make MonoW32Handle public

* [w32handle] Return MonoW32Handle as part of mono_w32handle_lookup_and_ref

* [w32handle] Pass MonoW32Handle from mono_w32handle_ops_own

* [w32handle] Pass MonoW32Handle from mono_w32handle_ops_isowned

* [w32handle] Pass MonoW32Handle from mono_w32handle_ops_signal

* [w32handle] Pass MonoW32Handle from mono_w32handle_ops_prewait

* [w32handle] Pass MonoW32Handle from mono_w32handle_ops_specialwait

* [w32handle] Pass MonoW32Handle from mono_w32handle_ops_details

* [w32handle] Pass MonoW32Handle from mono_w32handle_foreach

* [w32handle] Pass MonoW32Handle to own_if_{owned,signalled}

* [w32handle] Pass MonoW32Handle to mono_w32handle_issignalled

* [w32handle] Pass MonoW32Handle from mono_w32handle_set_in_use

* [w32handle] Pass MonoW32Handle to mono_w32handle_{lock,trylock,unlock}_handle

* [w32handle] Remove dead mono_w32handle_ref

* [w32handle] Pass MonoW32Handle from mono_w32handle_set_signal_state

* [w32handle] Pass MonoW32Handle to mono_w32handle_test_capabilities

* [w32handle] Remove dead mono_w32handle_get_type

* [w32handle] Pass MonoW32Handle to mono_w32handle_ops_signal

* [w32handle] Pass MonoW32Handle to mono_w32handle_ops_isowned

* [w32handle] Pass MonoW32Handle to mono_w32handle_ops_specialwait

* [w32handle] Pass MonoW32Handle to mono_w32handle_timedwait_signal_handle

* [w32handle] Fix some typos and ref/unref imbalance

* [w32handle] Rename mono_w32handle_{trylock,lock,unlock}_handle to mono_w32handle_{trylock,lock,unlock}

* [w32handle] Rename numhandles to nhandles

* [w32handle] Return MonoW32Handle instead of index when creating the handle

* [w32handle] Remove gpointer handle parameter for mono_w32handle_{ref,unref}_core

* [w32handle] Remove gpointer handle parameter for mono_w32handle_timedwait_signal_handle

* [w32handle] Remove gpointer handle parameter for mono_w32handle_duplicate

* [w32handle] Remove gpointer handle parameter for w32handle_destroy

* [w32handle] Remove gpointer handle parameter for mono_w32handle_unref

* [w32handle] Remove dead function

* [w32handle] Remove gpointer handle parameter for own_if_{owned,signalled}

* [w32handle] Remove gpointer handle parameter for mono_w32handle_{wait_one,wait_multiple,signal_and_wait}

* [w32handle] Remove gpointer handle parameter for mono_w32handle_foreach callback

* [w32handle] Remove gpointer handle parameter for mono_w32handle_ops_{signal,own,isowned,specialwait,prewait,details}

* [w32handle] Make mutex and cond coop friendly

* [w32handle] Check for ref before type in mono_w32handle_lookup_and_ref

* [w32handle] Allocate the private_handles array on the heap, to reduce mono executable and library size
2017-11-28 09:14:06 -05:00
Rodrigo Kumpera 87500ea50a [profiler] Improve nodefaults usage.
If nodefaults is passed as the first argument, we would print `Could not parse argument: nodefaults` due to how it's parsed differently.
If nodefaults is passed after the first argument we would not print a warning that this was wrong.

This commit fixes both usability issues.
2017-11-28 11:14:50 +01:00
monojenkins ea10d2f2f8 Bump API snapshot submodule 2017-11-28 09:10:57 +01:00
Marek Safar 6be02ed6c7 Don't run System.Runtime.CompilerServices.Unsafe tests due to JIT crash on i386 2017-11-28 09:10:57 +01:00
monojenkins 3b00c67e0a Bump API snapshot submodule 2017-11-28 09:10:57 +01:00
Marek Safar 82151ac4fa [corlib] Adds Span/Memory tests 2017-11-28 09:10:57 +01:00
Alex Rønne Petersen 2ab06befe9 [profiler] Make it possible to trigger heapshots from the M.P.L library.
Also make it so on-demand heapshots can be done regardless of the heapshot
mode in use. There really wasn't a good reason to not allow it before.
2017-11-27 23:08:58 +01:00
Marek Safar dcf567ff64 [mcs] Populate referencecontainer member-cache correctly. Fixes #60860 2017-11-27 23:07:27 +01:00
monojenkins c1fd42eac8 Merge pull request #6097 from mono/slluis-patch-1
Fix invalid enum values in LogGCEvent
2017-11-27 22:55:06 +01:00
Ludovic Henry 984f648466 [sdks] Use runtime logging features to intercept Console.{Out,Error} and runtime logs for instrumentation (#6083)
* [sdks] Fix Android pick of mono runtime

* [android] Have Console.{Out,Error} go through the runtime log mechanism to ease their interception

* [sdks] Intercept runtime logs instead of Console to send back for instrumentation

* [sdks] Intercept Android test runner logging
2017-11-27 16:37:11 -05:00
monojenkins 20de41832a Merge pull request #6078 from alexrp/profiler-docs
[profiler] Some documentation improvements

* Update and rewrite profiler-related `man` pages.
* Update profiler API documentation for the new API.
* Extend the `exdoc` tool to support some more Doxygen features.
* Document the AOT profiler's file format.
* Clean up the sample profiler module and add a makefile.
* Include context/domain reports in `mprof-report`'s default report set.
* Exit the process when the `help` option is passed to the profilers.
* Remove the IOMap profiler.
* Remove some deprecated options from the log profiler's `help` output.
* Clean up the AOT profiler and bring its user interface in line with the others.
* Allow comments in coverage filter files.
2017-11-27 22:35:03 +01:00
Alexander Köplinger 41a3571272 [acceptance-tests] Run shorter version of GCStress on PRs and update targets (#6106)
In 22f0977132 it was disabled
but we can actually just run a shorter version in PRs.

Also reenable the precompilation target for the managed CoreCLR tests.
2017-11-27 21:49:53 +01:00
Jonathan Chambers 198147add4 Fix MonoContextSimdReg usage on non-glibc Linux amd64(#6007)
Include emmintrin.h and use __m128d for MonoContextSimdReg on Linux.

Fixes breakage on Alpine Linux introduced in #5764
2017-11-27 21:14:06 +01:00
monojenkins b25e55028b Merge pull request #6101 from DavidKarlas/gcrootFromStart
[LogProfiler] Removed GcRoot events logging from start

GcRoots should only be reported/captured during heapshot. We already set callback when heapshot collection starts and unset it when heapshot is finished. Which means after 1st heapshot is taken we don't log them outside heapshot. Hence we shouldn't be logging them from start...
2017-11-27 18:35:11 +01:00
monojenkins a84fa6652f [msvc] Update csproj files (#6105) 2017-11-27 16:42:34 +01:00
Rolf Bjarne Kvinge 6ed4adc2d8 [System][Test] Only Xamarin.iOS has a synchronization context by default.
This shows up when Xamarin.Mac tests start defining XAMMAC [1]

[1]: https://github.com/xamarin/xamarin-macios/pull/3034
2017-11-27 14:25:56 +01:00
Marek Safar 22f0977132 [ci] Update acceptance-tests 2017-11-27 11:15:07 +01:00
Marek Safar 22adb80c21 Update roslyn tests 2017-11-27 11:15:07 +01:00
Marek Safar 5f7452f384 Merge pull request #5273 from vladimir-kazakov/xmlenc-from-corefx
XMLENC from .NET Core.
2017-11-26 22:36:57 +01:00
Alex Rønne Petersen f3706fac10 [profiler] Report GC roots outside of heapshots unless the nodefaults option is given. 2017-11-26 14:52:52 +01:00
monojenkins 46c997fdf7 Bump API snapshot submodule 2017-11-26 10:20:13 +00:00
David Karlaš 82bca175c4 [LogProfiler] Removed GcRoot events logging from start
GcRoots should only be reported/captured during heapshot. We already set callback when heapshot collection starts and unset it when heapshot is finished. Which means after 1st heapshot is taken we don't log them outside heapshot. Hence we shouldn't be logging them from start...
2017-11-26 05:36:28 +01:00
monojenkins e51565c7e5 [msvc] Update csproj files (#6100) 2017-11-25 23:34:52 +01:00
Vladimir Kazakov 9ed8574570 XMLENC from .NET Core. 2017-11-25 16:42:10 +02:00
Alexander Köplinger 031405e9cc [corlib] Fix flaky ThreadPoolTests.AsyncLocalCapture test (#6099)
The test was added in https://github.com/mono/mono/commit/375471820c02ff0bab025bff75b5da7efc95d3cd.

We were seeing some flakyness in the this test, looking at it I
noticed that we were passing executeOnlyOnce = false to
(Unsafe)RegisterWaitForSingleObject. This means that the delegate
would be executed again whenever the AutoResetEvent `evt` is signaled or
the timeout elapsed. The problem is that evt is never signaled by design
and we set a timeout of 1ms which means we'd execute it in a tight loop.

Setting executeOnlyOnce = true fixes this and I verified it doesn't
change the intent of the test (i.e. the test still fails after the
original commit is reverted).

Bumped the timeout for the CountdownEvent as well to be safe
since it's quite short.
2017-11-25 12:59:04 +01:00
Alexander Köplinger e8e92e5323 [genproj] Support setting /langversion in csproj (#6096) 2017-11-24 23:45:23 +01:00
Zoltan Varga d29cc4770a [bcl] Remove the test for ExecutingAssembly.EntryPoint, it behaves in different ways on different configurations. (#6095)
* [bcl] Remove the test for ExecutingAssembly.EntryPoint, it behaves in different ways on different configurations.

* Simplify ifdef
2017-11-24 12:41:21 -05:00
Lluis Sanchez b736b420b5 Fix invalid enum values in LogGCEvent 2017-11-24 18:39:03 +01:00
Marek Safar ec117584a2 [corlib] Update exception message to match .net 2017-11-24 16:56:29 +01:00
Vlad Brezae 4f0fd2a59b [mini] Align stack when resuming to catch handler 2017-11-24 16:44:25 +02:00
Vlad Brezae 3325bdfbd5 [mini] Add counter for try holes memory usage 2017-11-24 16:44:25 +02:00
Vlad Brezae 78933c423f [mini] Add missing try holes
When doing an OP_CALL_HANDLER for a clause (from a leave opcode), all following instructions, up until the actual branch out of the try block, should be part of a hole for that clause. We were failing to account for a single leave instruction invoking multiple finally clauses sequentially, in which case a basic block can be a try hole for multiple clauses.
2017-11-24 16:44:25 +02:00
Vlad Brezae 98d3906a39 [mini] Fix clause try hole checking
This was inexplicably added as part of 2657d9cb1e, likely by mistake.
2017-11-24 16:44:25 +02:00
Alexander Köplinger 5ef930b5f8 [bcl] Build some assemblies with -warnaserror (#5295)
* [bcl] Build some assemblies with -warnaserror

This ensures that we keep the build warning free.

We'll only opt-in a few assemblies that already have zero warnings.
We also only apply this when using csc as mcs might raise different warnings.

For now just opt-in assemblies in the net_4_x profile.
2017-11-24 14:05:39 +01:00
Marek Safar 7b4dfeebc4 Merge pull request #5836 from marek-safar/corefx-bump
Corefx bump
2017-11-24 13:00:33 +01:00
monojenkins edc590a3d3 Bump API snapshot submodule 2017-11-24 09:09:12 +00:00
Alexander Köplinger 4535442e84 [ci] Switch .pkg PR build to pipeline script as well (#6092) 2017-11-24 01:30:00 +01:00
Marek Safar 484a9089a8 [corlib] Disable test check which is timezone dependent 2017-11-23 22:46:49 +01:00
Marek Safar e663bd7c92 Exclude any Mono marked corefx tests 2017-11-23 22:45:16 +01:00
Marek Safar 5eb884bab8 Fixes wrong argument name 2017-11-23 22:45:16 +01:00
Marek Safar 431e36f731 Bump mcs bootstrap version 2017-11-23 22:45:16 +01:00
Marek Safar 1cc3bc58be Bump corefx 2017-11-23 22:45:15 +01:00
Marek Safar ecd85dc839 [build] Support api-snaphot assembly references 2017-11-23 22:45:15 +01:00
Jonathan Chambers 5c2a49f4b6 Add back some more legacy profiler APIs (#6044)
- mono_profiler_install_allocation
- mono_profiler_install_enter_leave
- mono_profiler_install_exception
2017-11-23 21:54:25 +01:00
Rolf Bjarne Kvinge 00e2b06f2f Bump cecil & linker to latest. (#6081)
* Bump cecil & linker to latest.

* Bump API snapshot submodule
2017-11-23 21:30:33 +01:00
Rolf Bjarne Kvinge c2fceeaf39 [tests] Adjust ifdefs to get the expected behavior for Xamarin.Mac/Modern tests. (#6086) 2017-11-23 21:05:24 +01:00
Rolf Bjarne Kvinge 19a7107a03 [tests] Adjust ifdefs to get the expected behavior for Xamarin.Mac's cryptography tests. (#6091) 2017-11-23 21:04:32 +01:00
Alexander Köplinger 9107efe94d [api-diff] Only delete .cs files in the api diff
We're starting to add additional files into the profile directories
in api-snapshot and these would get deleted otherwise.
2017-11-23 19:18:21 +01:00
monojenkins 7ed25b0be4 [msvc] Update csproj files (#6087) 2017-11-23 18:36:33 +01:00
Marek Safar 011d28de46 Bump roslyn 2017-11-23 17:17:40 +01:00
Alex Rønne Petersen 16cf089281 [profiler] Clean up the AOT profiler a bit.
* Use the same option parsing logic as the other profilers.
* Support the same output file syntax as the other profilers.
* Use output.aotprofile as the default output file name.
* Open the output file on startup rather than shutdown.
* Use runtime logging functions instead of printf/fprintf.
* Don't print anything unless the verbose option is given.
* Fix an endianness issue with writing ints to the output file.
* Move all profiler state into MonoProfiler structure and store it statically.
* Remove outdated comments and includes.
2017-11-23 16:25:18 +01:00
Alex Rønne Petersen 0f985ed885 [profiler] Skip lines not starting with +/- in coverage filter files.
This allows writing comment lines.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 76872edd27 [profiler] Use a new suppression file for the coverage profiler.
Keep the old one around only for compatibility with the old coverage support
in the log profiler.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen d1748f7c58 [profiler] Remove coverage options from the help text in the log profiler.
We want people to use the new coverage profiler instead.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 7c8f5e02b2 [profiler] Don't document the nocalls option.
This one is only for compatibility, so don't document it.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 9b0c6fc45d [profiler] Exit when printing the usage info.
Also print proper errors when failing to parse certain arguments rather than
just printing the usage info.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 0d123027b0 [profiler] Remove the iomap profiler.
It hasn't worked for a very long time, contains very unsafe/broken code, and
appears to be used by no one.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen c7f9875f27 [man] Rewrite the profiler-related man pages.
* Separate profiler module documentation into a new mono-profilers(1) page.
* Add documentation for the aot and coverage profilers.
* Rewrite the mprof-report(1) page to only talk about mprof-report itself.
* Rewrite and update the profiler-related sections of mono(1).
* Conform to man page formatting conventions.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen cbe30987b0 [samples] Clean up the profiler sample and add a simple makefile. 2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 0abcdc9c60 [mprof-report] Include domain and context reports in the default set. 2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 8ab10ff01d [profiler] Document the AOT profiler file format. 2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 53084a4098 [profiler] Add a comment to profiler-events.h about backwards compatibility. 2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 80788a3c50 [docs] Improve profiler API documentation.
* Move doc comments to profiler.c so they're picked up by exdoc.
* Rewrite mono-api-profiler.html for the new profiler API.
* Clarify some aspects of the doc comments.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 908d10de6c [exdoc] Don't transform newline characters to spaces.
This is unnecessary and messes with code block formatting.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 528e793ce3 [exdoc] Support Doxygen-style code blocks.
This doesn't support the full syntax, but it's enough for our needs.
2017-11-23 14:16:03 +01:00
Alex Rønne Petersen aa19b6aa18 [exdoc] Support more Doxygen-style formatting. 2017-11-23 14:16:03 +01:00
Alex Rønne Petersen 5d2febd966 [exdoc] Don't insert unnecessary tab characters.
This messes with code block formatting.
2017-11-23 14:16:03 +01:00
Egor Bogatov 076632c3e9 Remove CodeDomConfigurationHandler from machine.config (#6070) 2017-11-23 10:31:56 +01:00
Zoltan Varga 718247da6f [bcl] Remove an ObjCRuntime reference from the TimeZone tests, it shouldn't be needed any more, and it prevents the tests from compiling on the monotouch profile. (#6079) 2017-11-23 00:32:33 -05:00
Ludovic Henry f1f3ae49f0 [sdks] Fix Android pick of mono runtime (#6080) 2017-11-22 20:28:47 -05:00
Alexis Christoforides 9d6f430994 Merge pull request #6067 from lambdageek/bug-60545-fixup-ginst
[loader] inflate constrained result if constraining an inflated generic method
2017-11-22 14:45:14 -05:00
Zoltan Varga 8aed7ab89c [aot] Add generic instances referenced by MONO_PATCH_INFO_METHOD_RGCTX patches. Fixes #60771. (#6075)
Some generic instances were not generated because they were only referenced by METHOD_RGCTX patches, and the gsharedvt
fallback didn't work because the method in question Unsafe.Add<T> uses a sizeof opcode on a gsharedvt type which is currently
not supported.

Testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
using System;
using System.Runtime.CompilerServices;

public class Tests
{
        [MethodImplAttribute (MethodImplOptions.NoInlining)]
        public void Foo55<T> () {
            byte[] arr = new byte [10];
            ref byte data0 = ref arr [0];
            Unsafe.Add (ref data0, 0);
        }

        interface IFace {
            void Foo55 <T> ();
        }

        class AClass : IFace {
            public void Foo55 <T> () {
            byte[] arr = new byte [10];
            ref byte data0 = ref arr [0];
            Unsafe.Add (ref data0, 0);
            }
        }

    public static int Main () {
            IFace iface = new AClass ();
            iface.Foo55<int> ();
            return 0;
        }
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2017-11-22 12:51:36 -05:00
Jonathan Chambers c8cd5a5710 Use image set to store and allocate MonoClass representing arrays and pointers whose elements types may contain generic instances from other images. This can be true for array element classes which are generic instances (List<NonCorlibTyp>[]) or arrays (List<NonCorlibTyp>[][]). 2017-11-22 10:44:19 -05:00
Rolf Bjarne Kvinge ddace393cf [bitcode] Disable test_0_float_return_spill in bitcode to get green tests. (#6073)
See https://bugzilla.xamarin.com/show_bug.cgi?id=59953
2017-11-22 10:06:01 -05:00
Alexander Köplinger 27eed3574d [ci] MSBuild related fixes (#6071)
* [ci] Fix testing of msbuild in run-test-mac-sdk.sh

It contained the old version number and failed on bots that didn't
have leftover old build result.

* [ci] Fix msbuild paths in Windows packaging

They changed with 73bd521c07.
2017-11-22 02:51:45 +01:00
Rodrigo Kumpera 8e09c454f4 [wasm] Rewrite m2n-gen in C# 2017-11-21 15:23:54 -08:00
Rodrigo Kumpera 6549011576 [wasm] Address review issues. 2017-11-21 14:50:58 -08:00
Zoltan Varga 8ea4864f30 [sdks] Add an ios test runner. (#6063) 2017-11-21 15:26:50 -05:00
Aleksey Kliger (λgeek) 9a882ab9cf [class] Make some class setup methods mistakes less costly to make (#6048)
mono_class_setup_interface_offsets and mono_class_setup_interface_id should
only be called for interfaces.

mono_class_setup_interface_offsets is incorrect for classes, and
mono_class_setup_interface_id would be a no-op.
2017-11-21 15:26:04 -05:00
Alexander Köplinger d3c7faa750 [ci] Add Jenkins pipeline script for building OSX and Windows packages (#6065)
* [ci] Add Jenkins pipeline script for building OSX and Windows packages

This replaces the current Jenkins freestyle jobs.

We no longer need the signing inside of the MacSDKRelease profile
since we're now signing on a separate service and having the signing
certificates locally is discouraged anyway.

* [ci] Update embedded gtk-sharp in Windows msi to 2.12.45

This matches what we ship on www.mono-project.com
2017-11-21 21:24:42 +01:00
Aleksey Kliger 7e9074b54c [loader] inflate constrained result if constraining an inflated generic method
Fixes interpreter failure in gtest-253.cs due to 3259e04ace
2017-11-21 12:39:47 -05:00
monojenkins ef0f3a53f3 [msvc] Update csproj files (#6066) 2017-11-21 16:44:42 +01:00
Zoltan Varga 1f59d0958f [bcl] Add an .exclude file to disable some corlib tests when running with the mono sdk. (#6064)
These tests are disabled explicitly on xamarin.ios by xharness.exe: https://github.com/xamarin/xamarin-macios/blob/6fcf4ab7f4c7e2f736a278ca138ab567c1ff6bae/tests/xharness/BCLTestInfo.cs#L16
2017-11-21 16:20:26 +01:00
Ludovic Henry e5248979fe [sdks] Update Android for integration with XA (#6058)
* [sdks] Match xamarin-android targets flags and parameters

* [sdks] Only compile BCL profiles that are needed

* [sdks] Add release and debug out directories for android

* [sdks] Add Android SDK and NDK paths from xamarin-android

* [sdks] Match xamarin-android x86 SDK version

* [sdks] Use make_standalone_toolchain.py to provision the Android toolchain
2017-11-21 08:05:51 -05:00
Martin Baulig 6beed5f791 [System.Net.Http]: Fix "Content-Length: 0" logic for requests without body.
Implicitly add "Content-Length: 0" for all requests with a null body unless
we're using a body-less HTTP Verb (HEAD, GET, MKCOL, CONNECT, TRACE).
2017-11-21 11:34:00 +01:00
Alexander Kyte a178a5273a [runtime] Move mono_aot_can_dedup into aot-runtime 2017-11-21 10:11:59 +01:00
Marek Safar 2c160ed9a7 [mcs] C# 7.2 ref struct feature 2017-11-21 09:15:00 +01:00
Ankit Jain 73bd521c07 Bump NuGet.BuildTasks (#6004)
* Bump nuget-buildtasks

cherry-pick 304d785bd0

* [msbuild] Install importbefore/after hooks for nuget

cherry-pick 4c935964b2

* [msbuild] Fix build - create the directories before installing .. (#5980)

.. to them.

cherry-pick d711efdd90

* [msbuild] Fix build (#5981)

- Don't copy 14.0/Imports to 15.0 now, as we do that in nuget-buildtasks.
- And don't create symlinks for Microsoft.NuGet.targets as it is not
  required anymore.

cherry-pick ef1ea85c0f
2017-11-21 04:28:40 +01:00
Nate Woolls a6e7c1f81c [tools] Fix .apps generated by MacPack not running when Mono 5 is installed on macOS (#6024)
* [tools] Fix .apps generated by MacPack not running when Mono 5 is installed on macOS

The current script used by the generated .app only checks for Mono in /usr/local/bin, but not in /Library/Frameworks/Mono.framework/Versions/Current/Commands (the default location for new installations of Mono 5 on macOS)

* [tools] Fix WinForms .apps generated by MacPack not running when Mono 5 is installed on 64-bit macOS

Latest Mono now defaults to running mono64 on a 64-bit OS but there is currently no WinForms support on 64-bit Mono. Pass --arch=32 to mono when wrapping a WinForms app with MacPack.
2017-11-21 04:27:10 +01:00
Yuriy fab0ce54d3 [System.Windows.Forms] FileDialog internationalization (#6052)
* Localized * FileDialog. Fixed missing Locale.GetText for the displayed strings.

* Fixed padding and size of buttons in the PopupButtonPanel class. This was done to remove the workaround "Recently\nused" and similar in futher localizations.

* Changed width of PopupButtonPanel to prevent sticking buttons to the separator.
2017-11-21 03:49:40 +01:00
Marek Safar 21ba3d0d9d [corlib] Move System.Runtime.InteropServices.RuntimeInformation to co… (#6060)
* [corlib] Move System.Runtime.InteropServices.RuntimeInformation to corlib to match .net 4.7.1 api

* Bump API snapshot submodule
2017-11-21 03:32:23 +01:00
Aleksey Kliger 3259e04ace [loader] Rework get_method_constrained (Fixes #60545)
Instead of using find_method which relies on method name and exact signature
matching (and thus can't work for variant interfaces), use the vtable and the
interface offset to find the constrained method.

Terminology:
  base method - a method of the base class to be called
  base class - some general class or interface that declares a method
  constraint class - a more specific class that also implements the method.
  constrained method - the version of the base method in the constraint class.

To find the constrained method given the base method:

- if the base class is a class:
  the constraint class can't be an interface. it's either the base class or
  some subclass of it.  If the base method isn't virtual there's nothing to do
  the constrained method is the same one.
  If the base method is virtual, get its vtable slot and find the corresponding
  method in the constraint class's vtable.
- if the base class is an interface:
  in this case the constraint class is either another interface or a class.
  if the constraint class is an interface, since interfaces can't have
  implementations, there's nothing to do.
  if the constraint class is a class, then to find the constrained method
  get the interface slot offset of the base method and find the base interface offset
  of the base interface and look in the constrained class vtable.
  (the base interface offset gives the starting vtable slot for the base
  interface in the constraint class vtable; the slot offsets go consecutively
  for each of the methods of the interface).

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60545
2017-11-20 18:36:38 -05:00
Aleksey Kliger 92f20ae75d [tests] Mono test for contravariant constrained.callvirt
Test that constrained.callvirt IL instruction sequence works for contravariant
interfaces.

Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=60545
2017-11-20 18:36:38 -05:00
Aleksey Kliger 0bbc3e8c15 [runtime] Cleanup mono_runtime_get_main_args
- Cleanup MonoError
- Rework coop handles usage to avoid raw pointers until exit.
2017-11-20 16:09:51 -05:00
Zoltan Varga 009b508174 Fix the ios build with recent xcode/osx, add comments about possible targets. (#6056) 2017-11-20 16:02:08 -05:00
Chris Hamons dae27ef2ba Fix CryptoConfig.CreateFromName on XM Modern (#6029) 2017-11-20 20:04:28 +01:00
Marek Safar a985310287 Disable a new test, it's crashing the interpreter 2017-11-20 12:22:48 +01:00
Marek Safar e5a8111a64 [mcs] Better typed-ref deconstruction for indexers. Fixes #60680 2017-11-20 12:22:48 +01:00
monojenkins 1d7ec6a3d7 Bump API snapshot submodule 2017-11-19 18:33:43 +01:00
Marek Safar 7a22e06622 Bump cecil 2017-11-19 18:33:43 +01:00
Egor Bogatov b44333823d XmlReaderSettings.EnableLegacyXmlSettings should always be false on mono. Fixes bug-60621 (#6014) 2017-11-19 13:43:06 +01:00
Alexander Kyte f1a22f31a7 [runtime] Fix test makefrag to accomodate moved tests 2017-11-19 10:16:06 +01:00
Zoltan Varga c498a00479 [bcl] Fix the ResolvePathBeforeDirectoryExists test on the mobile profile. 2017-11-19 10:13:27 +01:00
Zoltan Varga c2ea774d4c Revert "[touchup] Use HANDLE_FUNCTION_RETURN_OBJ instead of HANDLE_FUNCTION_RETURN_VAL (no change in behavior)"
This reverts commit e608ed2386.

Revert this as it breaks the build.
2017-11-18 10:08:44 -05:00
Alexis Christoforides 9c64c7d390 Merge pull request #6030 from luhenry/corefx-switch-to-c
[corefx] Bump corefx to pick switch of System.Native to C
2017-11-17 17:54:01 -05:00
Alexis Christoforides 29d2176893 Merge pull request #6045 from chamons/bump_master_cecil
Bump cecil
2017-11-17 17:30:06 -05:00
Alexis Christoforides e608ed2386 [touchup] Use HANDLE_FUNCTION_RETURN_OBJ instead of HANDLE_FUNCTION_RETURN_VAL (no change in behavior) 2017-11-17 17:27:43 -05:00
Ludovic Henry 24fc118eef [sdks] Cleanup wasm targets (#6025)
* [sdks] Cleanup wasm targets

* [sdks] Remove CUSTOM_BUILD_TARGETS variable
2017-11-17 17:21:44 -05:00
Alexis Christoforides 18fb8563fb [touchup] Remove redundant code 2017-11-17 17:21:20 -05:00
Alexis Christoforides 5cf1aada52 Merge pull request #6017 from monojenkins/update-csprojs
[msvc] Update csproj files
2017-11-17 17:09:56 -05:00
Alexis Christoforides 421f8553fb Merge pull request #6042 from Unity-Technologies/winrt-time-zone-adjustment-rules
Fix TimeZoneInfo rule population for WinRT
2017-11-17 17:08:15 -05:00
Chris Hamons e3862cb004 Bump cecil 2017-11-17 13:51:59 -06:00
Rodrigo Kumpera 937fcd1023 [wasm] Unbreak EH 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 9a143f99ca [wasm] Fix signature of Monitor::Enter icall. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 82e9c5ccd7 [sdks] Adjust debug spew to help debug GC issues. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 1b9e3ec070 [sdks] Add code to run corlib test suite. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 04d0d026b8 [sdks] Remove debug spew from new nunit driver and add option to run a single test. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 3d80b0b50e [wasm] Don't abort on thread creation, simply fail it. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 0d10ad9a26 [wasm] clock_gettime fails on with EINVAL. gtod works just fine. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera c8ed7a1715 [wasm] Current version of libc abort on getpwnam. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 426109e9c9 [wasm] Rework incremental test runner to work more closely to how nunit works WRT setup steps. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera 9e8a648fa7 [wasm] Build the runtime with ASSERTIONS=2 for now to get better crash diagnostics. 2017-11-17 10:25:36 -08:00
Rodrigo Kumpera cb8d515c00 [wasm] Update the wasm m2n tramps.
They are not generated by a ruby script.
The commit includes the generated file and the generation script for now to ease development.
We can later discuss generating it at build time.
2017-11-17 10:25:35 -08:00
Rodrigo Kumpera d9224b10b2 [interp] Make assertions more usable. 2017-11-17 10:25:35 -08:00
Rodrigo Kumpera 48c111e123 [wasm] Add better implementation of mono_w32file_get_volume_information. 2017-11-17 10:25:35 -08:00
Rodrigo Kumpera fed2587457 [wasm] Return actual stack bounds instead of phony values. 2017-11-17 10:25:35 -08:00
Rodrigo Kumpera 0d6f22f04c [wasm] Mono relies waaaay too much on mmap returning zero'ed memory, so just do it. 2017-11-17 10:25:35 -08:00
Rodrigo Kumpera 7cb492db00 [util] Properly Initialize the last entry of a superblock instead of relying on mmap returning zero'd memory. 2017-11-17 10:25:35 -08:00
Rodrigo Kumpera 88e9d00c52 [corlib] Add wasm source lists for test suite. 2017-11-17 10:25:35 -08:00
Rodrigo Kumpera 07d07ad907 [wasm] Switch to an incremental nunit test runner to make sure the main thread gets pumped regularly. 2017-11-17 10:25:35 -08:00
Jonathan Chambers 491f4b651f The return value of GetDynamicTimeZoneInformationEffectiveYears in the successful case is ERROR_SUCCESS (0). Adjust failure case to be for return values non 0. 2017-11-17 12:50:00 -05:00
monojenkins af08374ef2 [msvc] Update csproj files 2017-11-17 15:33:02 +00:00
Alexis Christoforides 3e1eeec6c3 [System.IO] Directory.Exists() now resolves the full path first. Fixes #60267
In Unix, assume our current directory contains:
`test`, a directory
`test/test2`, another directory
`test/test2/test_file`, a file
`test3`, a symbolic link pointing to `test/test2`

Then the path "test3/../test3" has two interpretations depending on the processor:

* The OS (the `lstat` syscall, `ls`, etc.) will find it invalid (as it evaluates to: enter `test/test2`, go up one level, try to enter `test3` which is another level down
* We (.NET, at least CoreCLR) should find it valid (enter `test3`, go up one level, enter `test3`).

This ensures that for Directory.Exists, we process the path `..`'s on the .NET level before passing it for native processing.
2017-11-17 11:31:44 +01:00
Alexander Kyte 2bb178c7a8 [runtime] Increase the BCL imt trampoline count (fix tests) 2017-11-17 11:26:00 +01:00
Bernhard Urban 1f4bd60284 [lldb] update interp main loop function name 2017-11-16 23:27:51 +01:00
Bernhard Urban 4d02be3abf [interp] only access arguments on frame if there are any for sure
discovered by AddressSanitizer
2017-11-16 23:27:51 +01:00
Bernhard Urban 5bc422d733 [interp] end of a clause can point _after_ the last instruction
detected by AddressSanitizer: code generating the offsets for exception
handling would access the array beyond its bound.
2017-11-16 23:27:51 +01:00
Rodrigo Kumpera d416f570bd Merge pull request #6003 from kumpera/profiler-compat-mode
[profiler] Make profiler arg parsing more compatible with previous version.
2017-11-16 14:33:56 -05:00
Ludovic Henry b488cacd50 [corefx] Bump corefx to pick switch of System.Native to C 2017-11-16 14:28:56 -05:00
Alexis Christoforides 0435b2ba16 Merge pull request #6027 from lewurm/fix-DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread
[corlib] fix DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread test
2017-11-16 14:05:47 -05:00
Hugh Bellamy 8a82b292fb Update GdipGetImageDimensions tests to pass against Windows GDI+ (#6008)
Make the image height dimension check more relaxed.
These fail against windows and cause errors when fixed in mono/libgdiplus#121
2017-11-16 18:57:11 +01:00
Neale Ferguson 51a8a45906 Fix big endian build problem 2017-11-16 17:18:11 +01:00
Bernhard Urban ae9cef9103 [corlib] fix DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread test
this test case was broken for an unknown time, but surfaced with a
recent change in nunit-lite (2255c54966)
that runs every test in a new `ExecutionContext`. Previously, the
pre-condition for this test was implicility fulfilled by another test.
The test failed already when executed only on its own. With the change
around `ExecutionContext`, each test is "isolated" regarding said
pre-condition.

The fix is to explicitly fulfil the pre-condition in the test.
2017-11-16 17:11:42 +01:00
Rodrigo Kumpera 375471820c [corlib] Don't capture the execution context when UnsafeRegisterWaitForSingleObject is used. Fixes #60029 (#6013) 2017-11-16 09:29:15 +01:00
Aleksey Kliger c0f6935b45 [sre] Don't warn about duplicate token for MonoArrayMethod
ModuleBuilder::GetArrayMethod returns a fresh MonoArrayMethod instance each
time it's called, even if you ask for the same method multiple times.  On the
other hand, mono_image_get_array_token caches tokens by method signature.
Therefore mono_image_create_token should expect collisions.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60238
2017-11-16 09:15:47 +01:00
Aleksey Kliger 8b7df777bb [test] Regression test for 60238 2017-11-16 09:15:47 +01:00
Zoltan Varga bcaca2dbaf [bcl] Add a Mono.Runtime.Tests assembly which can be used to run the JIT regression tests using nunit. (#6015) 2017-11-15 20:50:43 -05:00
Alexis Christoforides 401ed4d16c [System.Process] Consider open's exit code when using it to start a process. Fixes #19503 (#6010) 2017-11-15 13:53:00 -05:00
Katelyn Gadd 2cc1ae3b29 Provide a special implementation of ReadToEnd for CStreamReader so that it echoes input characters correctly when TermInfoDriver is initialized instead of suppressing them. Fixes bug #40699. 2017-11-15 09:44:10 -08:00
Alexander Kyte ca8b8bd346 [runtime] Add Dedup Support to MkBundle (#5484)
* [runtime] Fix mkbundle compilation on OSX

* [runtime] Add aot arguments to mkbundle

* [runtime] Enable compiling aot with mkbundle

* [runtime] Add new dedup interface to mkbundle

* [runtime] Fix path resolving for mkbundle

* [runtime] Use mkbundle in BCL tests

* [runtime] Skip building System.Security, System.IdentityModel tests on testing_aot_full

* [runtime] Fix in-tree building for mkbundle

* [runtime] Move testing dll into profile

* [runtime] Add target to mkbundle all tests before CI

* [runtime] Build stripper and use with mkbundle

Preliminary linker support ran into dependency-finding bug
with the monolinker.exe binary. Fix postponed until later.

* [runtime] Skip not supported tests with mkbundle

* [runtime] Don't re-aot when running BCL tests

* [runtime] Provide config to mkbundle

* [runtime] Fix mkbundle internationalization test results, build all

* [runtime] Clean up temp mkbundle aot directory

* [runtime] Add mkbundle support for dedup

* [runtime] Fix tracking of dedup module in mkbundle

* [runtime] Document mkbundle AOT options in man pages

* [runtime] Fix CADMessage generic method argument marshalling
2017-11-15 09:56:26 -05:00
Alexander Kyte 50fa04c136 [runtime] Implement runtime support for inflated wrapper and generic dedup (#5349)
* [runtime] Support excluding or choosing to emit only inflated methods

* [runtime] Only write cache if changed, so can be used by Makefiles

* [runtime] Thread state through multiple mono_compile_assembly calls

* [runtime] Emit skipped methods in dedup module

* [runtime] Use AOT attribute to mark dummy dedup module

* [runtime] Expose and use can_dedup for AOT compiler+runtime

* [runtime] Add missing cases to the mangler

* [runtime] Fix direct calls with dedup

* [runtime] Implement runtime support for finding deduped code

* [runtime] Refactor dedup state setup into new function

* [runtime] Add in dedup debugging aid / external visibility

Gives a demo on how to make mangled method names externally visible

* [runtime] Log dedup statistics
2017-11-15 09:55:21 -05:00
Rodrigo Kumpera 115b290143 [runtime/corlib] Improve MissingMethodExceptions by including message… and signature. Fixes #60505
This fix is a bit weird but it's due to some restrictions of the managed API.

MissingMemberException & friends require both ClassName and MemberName to be supplied independently, so the signature
can't simply be applied to MemberName. So we pass it on a separate field.

The next thing is that we want C#'esque signatures, where the return type comes before ClassName.MemberName, so we pass
a format string and apply it in managed.
2017-11-15 09:31:21 +01:00
monojenkins 43a23e71e5 Bump API snapshot submodule 2017-11-15 09:27:21 +01:00
Marek Safar 6910dd4bc0 [System.Data] Add missing Microsoft.SqlServer.Server APIs 2017-11-15 09:27:21 +01:00
Bernhard Urban c58ab6f4cb more readable assignment 2017-11-15 07:28:47 +01:00
Bernhard Urban 93ad6575a5 [metadata] make get_darwin_locale thread-safe
fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59916
2017-11-15 07:28:47 +01:00
Alexis Christoforides 3318b29704 Merge pull request #5985 from YuriyGS/bug60514
[System.Windows.Forms] Proper padding and border width for DataGridViewTextBoxCell. Fixes #60514
2017-11-14 17:03:30 -05:00
Rodrigo Kumpera 67160915c9 [profiler] Restore 'counters' and 'sampling-real' options 2017-11-14 13:04:49 -08:00
Jonathan Chambers 52d836f5e2 Fix icall parameters to use managed boolean type. (#6006) 2017-11-14 15:48:06 -05:00
Bernhard Urban 2255c54966 [external] bump nunit-lite in order to include fix for racy FinallyDelegate 2017-11-14 21:06:22 +01:00
Bernhard Urban 0bba45f06e [interp] fix build on windows (#6000)
it was fine on CI, but developers can run into build errors if they
don't follow a strict order (due to autotools fighting with
`winconfig.h`).

`basic.exe` passes, but everything involving native transitions crashes.
2017-11-14 14:50:37 +01:00
Jonathan Peppers a5248e5e11 [bcl] bringing back InetAccess test category
This partially reverts 9b4b6d6211

Xamarin.Android’s QA team has a need to run on-device tests in cases
where the device does not have an internet connection.

I also marked a few tests with `InetAccess` indicated from a past test
run here:
http://xqa.blob.core.windows.net/gist/log-1481cb7679ce4db0a305a551ff7f4e18.txt
2017-11-14 11:37:12 +01:00
Alexis Christoforides a6c2080c24 Merge pull request #5759 from luhenry/w32process-refactor-mono_w32process_get_fileversion_info
[w32process] Reduce mmap allocation by mapping file only once
2017-11-13 20:45:48 -05:00
Rodrigo Kumpera 26b76cb879 [profiler] Make profiler arg parsing more compatible with previous version.
This introduces the following changes.

By default, enable more events. Exceptions and Counters are on by default.
By default, if alloc or heapshot are enabled, we emit root events as well.

New `nodefaults` argument that disables the above changes to default arg processing.

Added "nocalls" argument for compat only purposes.

Restored "cycles/" prefix to sample frequency argument. It was already a dead argument, but kept for compat.
We restored that as existing clients pass that flag.
2017-11-13 16:56:27 -08:00
Zoltan Varga c445fa3262 [runtime] Initialize the min_align field of ptr classes, since they have the 'inited' field set, so mono_class_init_sizes () might not be called for them. Fixes #60634. (#5999) 2017-11-13 19:46:19 -05:00
Aleksey Kliger (λgeek) 0257dcde58 [tests] Add disabled regression test for #49308 (#5997)
* [tests] Appdomain assembly loading regression test for #49308

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

We try to trick the remoting code into causing an assembly from a bad directory
to be loaded too eagerly into an appdomain.  If we succeed, we call a method
that doesn't exist.  Expected behavior is that the bad assembly is not loaded
and instead we can do an Assembly.LoadFrom of a good assembly.

* [tests] Add appdomain-marshalbyref-assemblyload.exe to KNOWN_FAILING_TESTS

This is a regression test for
https://bugzilla.xamarin.com/show_bug.cgi?id=49308, it should be re-enabled
when the bug is fixed.
2017-11-13 17:06:40 -05:00
Ludovic Henry 33eb71ae07 [System] Fix DeflateStream crash with high concurrency on Read/Write/Close (#5994)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56727
2017-11-13 15:16:03 -05:00
Ludovic Henry bf1b5dced0 [sdks] Remove passing AndroidRunner instance to C# and back (#5988) 2017-11-13 15:05:10 -05:00
Dave Curylo 2f308109e1 Fix path to embedded glob.c implementation.
Was moved in https://github.com/mono/mono/commit/f23f72c9de0cb7d03e5db68623440af9dcb19d6c and LICENSE should reflect where these embedded dependencies are found.
2017-11-13 09:27:12 -08:00
Marek Safar d1ece840fe [mdbdump] Include guid in xml dump 2017-11-13 09:07:18 -08:00
monojenkins 5f35ea4b68 [msvc] Update csproj files (#5995) 2017-11-13 16:48:43 +01:00
Mikhail Filippov 05fae5f1fa Add ignoring features option into genproj 2017-11-13 06:51:50 -08:00
lateralusX 2503f874ca Enable concurrent GC as default mode for Windows MSVC mono sgen builds. 2017-11-13 05:27:39 -08:00
Alexander Köplinger f23ce4f37e [corlib] Add more tests, embed linker descriptor xml in test assembly
This enables us to remove https://github.com/xamarin/xamarin-android/blob/e0c0c2bae53f15f8949bef5eda64d1018455ab59/tests/Xamarin.Android.Bcl-Tests/Resources/LinkerDescription.xml.
2017-11-13 05:19:38 -08:00
Bernhard Urban 9afe9e1445 [interp] disable block_guard_restore_aligment_on_exit.exe on CI (#5991)
there is an about 10% chance that it hangs and thus times out on CI.
2017-11-12 20:00:40 +01:00
Zoltan Varga d59f8a64ae [jit] Avoid nullifying LDADDR instructions in load_simd_vreg_class (), they could have references if explicit-null-checks are enabled. Fixes #60539. (#5979) 2017-11-10 13:35:32 -05:00
Ankit Jain af818a1709 [msbuild] Change the version used in bockbuild to just '15', instead .. (#5986)
.. of 15.x. It doesn't really affect anything and makes it simpler on
wrench to specify directory from which to run the tests!

(cherry picked from commit 3f3b106aca)

# Conflicts:
#	packaging/MacSDK/msbuild.py
2017-11-10 17:49:59 +01:00
YuriyGS 356c5aaef8 Using padding and border width 2017-11-10 18:18:18 +03:00
Manuel de la Pena 4e43805a1e [Tests] Make Mono.Data.Sqlite tests more robust. (#5982)
* [Tests] Make Mono.Data.Sqlite tests more robuts.

There are cases in which the tests are ran in parallel and the files
used for the db are writte/read by several tests at the same time. This
changes ensures that we do have a diff test file per test case to ensure
that we do not have false negatives.
2017-11-10 16:08:47 +01:00
Alexis Christoforides 78be18ab99 Merge pull request #5917 from lambdageek/centrinel-ann
Add Centrinel annotations to object.h and handle.h
2017-11-10 09:58:05 -05:00
Ludovic Henry 295625bbb0 [sdks] Change how we run test suites on the app (#5894)
Instead of using a textbox in the app, we use a file which contains which the name of the dll that contains the tests
2017-11-10 09:02:04 -05:00
Aleksey Kliger 00035e5b68 Include <config.h> in C files that include mono headers
Any translation unit that includes a Mono header should include <config.h>
first to ensure that all of our configuration defines are available.

In particular, config.h defines MONO_INSIDE_RUNTIME which, in mono-publib.h causes
MONO_RT_EXTERNAL_ONLY to be defined to an attribute that causes a compilation
error if you use a function that is internally deprecated for the runtime.

Also change a couple of places that used non-_checked functions.
2017-11-09 22:19:32 -05:00
Aleksey Kliger 70807d5198 [coop handles] Mark handles macros with Centrinel SUPPRESS macros
Handles macro bodies are allowed to operate on raw pointers to managed memory.

The macro arguments must be UNSPUPPRESSed because we want warnings if the
arguments are doing bad things.
2017-11-09 18:06:11 -05:00
Aleksey Kliger 7d3dc331b5 Mark _MonoObject and managed object typedefs with MONO_RT_MANAGED_ATTR 2017-11-09 18:02:48 -05:00
Aleksey Kliger d244f6d2c7 Define MONO_RT_MANAGED_ATTR and MONO_RT_CENTRINEL_SUPPRESS macros
Marking a struct definition or a typedef with MONO_RT_MANAGED_ATTR will cause
Centrinel to treat pointers to the struct as residing in managed memory and to
issue warnings when raw pointers to such managed objects occur in the runtime.

(Also Centrinel knows that if the first field of a struct is a `MonoObject`,
then the struct is definiting a subtype of a managed object and so pointers to
_that_ struct also point into managed memory)
2017-11-09 17:55:03 -05:00
Jonathan Chambers ee20fc0ad9 Remove Boehm specific code path in GC aware hash tables as it can now push/mark roots. 2017-11-09 15:56:06 -05:00
Alexis Christoforides e348c56a01 [coop] Convert ves_icall_System_Environment_GetCommandLineArgs icall to use coop handles 2017-11-09 15:25:46 +01:00
Alexander Köplinger 4b80cb6861 [bcl] Add .NET 4.7.1 reference assemblies (#5974) 2017-11-09 14:28:22 +01:00
Ludovic Henry e45d72f4a8 Merge pull request #5969 from luhenry/backport-master-950ea65c3ba571cd139dc34b48d7101a2e894993
[System] Add missing ConfigureAwait
2017-11-08 18:35:36 -05:00
Aleksey Kliger (λgeek) a9e1c60a63 Merge pull request #5970 from lambdageek/bug-60245
[remoting] Check for transparent proxy in ves_icall_MonoField_{Get,Set}ValueInternal
2017-11-08 17:37:50 -05:00
Bernhard Urban b78e9b5e98 [interp] disable Test.System.Threading.ThreadTest.TestUndivisibleByPageSizeMaxStackSize (#5966)
It fails _sometimes_ in a weird way, which is probably a bug in the
interpreter when executing `nunit`. Disable it until it is fixed.
2017-11-08 17:28:20 +01:00
Aleksey Kliger 69ec805ff3 [test] FieldInfo.{Get,Set}Value tests for ContextBoundObject
Test that passing a transparent proxy to GetValue and SetValue works as expected

Regression tests for https://bugzilla.xamarin.com/show_bug.cgi?id=60245
2017-11-08 11:00:22 -05:00
Aleksey Kliger cd2fd4d81d [remoting] Check for transparent proxy in ves_icall_MonoField_{Get,Set}ValueInternal
Cover the case where System.Reflection.TypeInfo:GetValue or
System.Reflection.TypeInfo:SetValue are passed a transparent proxy as the
object.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60245
2017-11-08 11:00:21 -05:00
Brendan Zagaeski 40be6362c6 [System] Add missing ConfigureAwait (#5963)
This is a candidate fix for:
https://bugzilla.xamarin.com/show_bug.cgi?id=60317

The bug was introduced by 1b5e0f7331.

Preliminary verification
========================

If I make just this _one_ change to a "bad" commit of Mono from after
commit 1b5e0f7, rebuild System.dll in the `xammac` profile, and then
overwrite that file in the MonoBundle directory of a Xamarin.Mac test
app, then I restore the old "good" behavior.  (I started with
38da0b3b49 as the "bad" version for my
tests.)

I believe this confirms that the cause of bug 60317 was the usual
deadlocking issue when awaiting Tasks on the UI thread.  As discussed on
https://blog.stephencleary.com/2012/07/dont-block-on-async-code.html, if
any Tasks awaited anywhere up the call stack are missing
`ConfigureAwait (false)`, then you can run into trouble on the UI
thread.

Additional little checks
========================

1. Do the other `await` statements in commit
1b5e0f7331 all look OK?  Yes, it looks
like this was the only `await` statement that was missing
`ConfigureAwait (false)`:

```
$ git show 1b5e0f7331 | grep await
+				await ProcessOperation (cancellationToken).ConfigureAwait (false);
+				var ret = await InnerRead (cancellationToken).ConfigureAwait (false);
+					await Parent.InnerWrite (RunSynchronously, cancellationToken);
+				var ret = await Parent.InnerRead (RunSynchronously, requestedSize, cancellationToken).ConfigureAwait (false);
+					result = await asyncRequest.StartOperation (CancellationToken.None).ConfigureAwait (false);
+				result = await asyncRequest.StartOperation (cancellationToken).ConfigureAwait (false);
+			var ret = await task.ConfigureAwait (false);
+			await task.ConfigureAwait (false);
```

2. Is it a concern that mcs/class/System did not contain any calls to
`ConfigureAwait ()` until commit 1b5e0f7:

```
$ git grep ConfigureAwait 1b5e0f73316ee7b83c8947bc738015443fabd7af^ -- mcs/class/System || echo 'None'
None
```

I do not think this is a concern.  For example,
System.Net.Http.HttpClient has been using `ConfigureAwait (false)` for
several years, so there is a precedent for it.
2017-11-08 10:12:33 -05:00
Manuel de la Pena ea060b586d [Tests] Fix flaky IO tests due to parrallel execution on Mac bots. (#5965) 2017-11-08 06:37:12 -08:00
Alexander Köplinger a45569fe37 [System] Fix NullReferenceException in Win32EventLog (#5949)
This occasionally happens:

```
System.NullReferenceException : Object reference not set to an instance of an object
  at System.Diagnostics.Win32EventLog.NotifyEventThread (System.Threading.ManualResetEvent resetEvent) [0x00001] in D:\j\workspace\w\mcs\class\System\System.Diagnostics\Win32EventLog.cs:739
  at System.Diagnostics.Win32EventLog.<EnableNotification>b__44_0 () [0x00000] in D:\j\workspace\w\mcs\class\System\System.Diagnostics\Win32EventLog.cs:729
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in D:\j\workspace\w\mcs\class\referencesource\mscorlib\system\threading\thread.cs:68
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in D:\j\workspace\w\mcs\class\referencesource\mscorlib\system\threading\executioncontext.cs:957
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in D:\j\workspace\w\mcs\class\referencesource\mscorlib\system\threading\executioncontext.cs:904
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in D:\j\workspace\w\mcs\class\referencesource\mscorlib\system\threading\executioncontext.cs:893
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in D:\j\workspace\w\mcs\class\referencesource\mscorlib\system\threading\thread.cs:105
```

We'll get it because there's a race as the lamdba capturing
_notifyResetEvent in EnableNotification() is outside of the
_eventLock so _notifyResetEvent can be null by the time it is called.

We need to check for that case in NotifyEventThread().
2017-11-08 14:44:30 +01:00
Bernhard Urban 198481639f [interp] clear stack on resuming into the main loop (#5959)
* [interp] clear stack on resuming into the main loop

fixes `System.Collections.Generic.DictionaryTest.IDictionary_Add3`.

The problem is that resuming into an handler requires the evaluation stack to be emptied, which didn't happen with the new unified exception handling.

The frame layout looks like this in memory:

| sp | vt_sp | locals | ... |
|----|-------|--------|-----|

If we don't empty `sp` properly, we will eventually overflow into the `vt_sp` area (which is the evaluation stack for value types).  So things get funny if `sp == vt_sp` and you do stuff like this:

```c
  sp->data.p = vt_sp;
```

Kind of amazing that it almost passed the whole test suite with that bug.

* [interp] clear eval stack for value types as well when entering a handler

* [interp] disable more tests in corlib suite
2017-11-08 06:13:20 +01:00
Martin Baulig 865e344512 [System]: Override SslStream.FlushAsync () to call the async version on the underlying stream. (#5960)
* [System]: Override `SslStream.FlushAsync ()` to call the async version on the underlying stream.

* Bump API snapshot submodule
2017-11-08 06:10:23 +01:00
Alexander Köplinger a60b50417a [Facades] Use same assembly company/product/copyright attributes as other BCL assemblies (#5961)
* [Facades] Use same assembly company/product/copyright attributes as other BCL assemblies

We can't use Consts.cs since it'd bloat up the facades too much.

Also remove ".dll" suffix from AssemblyTitle/Description to match
what the Facades in the .NET Framework Reference Assemblies pack
are using.

* Bump API snapshot submodule
2017-11-08 06:01:53 +01:00
Bernhard Urban 4e01b276ae [interp] enable it by default in configure (#5925)
* [interp] enable it by default in configure

can be disabled via --enable-minimal=interpreter, like other components in the
runtime.

* [interp] use DISABLE_INTERPRETER in Makefile.am.in so it is closer to what we had before

* [interp] improve handling of interpreter flag and also check if we are on a cross-compile runtime

* [configure] add interpreter to the list of --enable-minimal

* [ci] remove --enable-interpreter from script

* [windows] disable interpreter for now

* [driver] add output about availabilty of interpreter in --version

* [man] add entry to mono.1 about --interpreter

* [driver] update --interpreter handling
2017-11-08 01:03:19 +01:00
Rodrigo Kumpera a62a7e7e96 Merge pull request #5924 from kumpera/wasm-sdk-integration
[sdk] Add wasm interpreter support.
2017-11-07 14:41:09 -05:00
Egor Bogatov a2649fe604 ignore quick syntax to exclude files in removecomments.sh for local-dist (#5958) 2017-11-07 17:59:49 +01:00
Jonathan Chambers e3d3433b76 Detect platform tizen and link profiler statically similar to Android. 2017-11-07 17:09:10 +01:00
lateralusX de771964ee Add missing build dependency to fix correct parallel build order. 2017-11-07 07:59:46 -08:00
Egor Bogatov 3c4b261617 [corlib] corefx tests from System.Threading.* and System.Text.RegularExpressions (#5762) 2017-11-07 07:08:49 -08:00
Alexander Köplinger 3e9c2af62a [profiler] Improve NUnit xml reporting (#5954)
We were only recording whether the tests passed or failed overall,
but not individual results of tests cases.

This adds that capability.
2017-11-07 14:48:40 +01:00
Johan Lorensson 83f9f3a813 Merge pull request #5950 from lateralusX/lateralusX/disable-join-thread-in-detach
Temporary disable adding thread to joinable threads on none Windows platforms.
2017-11-07 08:21:04 +01:00
Zoltan Varga 286e62e84d [runtime] Handle ENOTCONN/EHOSTDOWN in mono_w32error_unix_to_win32 (). Print a warning instead of asserting, there are lots of error codes we don't handle, map them to ERROR_NOT_SUPPORTED for now. Fixes #60422. (#5927) 2017-11-07 02:51:24 +01:00
Rolf Bjarne Kvinge c3be0663c1 [System] Ignore tests that fail on device until the corresponding bugs have been fixed. (#5951)
* [System] Ignore broken test until corresponding bug is fixed.

* [System] Ignore test that randomly hangs on device.
2017-11-07 02:48:17 +01:00
Rodrigo Kumpera 5ed0fab147 [wasm] Fix test driver and mono's JS support library. 2017-11-06 15:46:30 -08:00
monojenkins ec78917e10 Bump API snapshot submodule 2017-11-06 11:31:56 -08:00
Marek Safar c5fa794e98 [bcl] Updates referencesource to 4.7.1 2017-11-06 11:31:56 -08:00
Bernhard Urban e2a7e328d3 [mcs tests] clean up interp target 2017-11-06 20:20:01 +01:00
Bernhard Urban 43f03233f3 [interp] enable Mono.Debugger.Soft tests on CI 2017-11-06 20:20:01 +01:00
lateralusX acf3607795 Temporary disable adding thread to joinable threads on none Windows platforms.
Race only observed on Windows and current solution adds dependency between detach
and finalizer thread. Disable on none Windows platforms until we have an alternative
solution to the race condition. Keep on Windows until we have alternative solution
since race is manifesting itself on Jenkins builds.
2017-11-06 20:10:45 +01:00
Josip Medved 1a79065f8c Ensuring TextBox is properly updated upon setting/clearing password character. (#5947) 2017-11-06 16:43:58 +01:00
Bernhard Urban 035ad2f118 [mcs tests.make] control with TEST_WITH_INTERPRETER if run-test target uses the interpreter 2017-11-06 15:50:32 +01:00
Bernhard Urban 30fd079c90 [mcs make] introduce TEST_RUNTIME_FLAGS, analogously to TEST_RUNTIME vs. RUNTIME 2017-11-06 15:50:32 +01:00
Bernhard Urban 879f4bc60f [corlib] annotate failing tests when running in interpreter 2017-11-06 15:50:32 +01:00
Bernhard Urban 591ab6d34b [interp] properly resolve MonoType of MonoClassField via mono_field_get_type ()
fixes System.Reflection.Emit/TypeBuilderTest.cs:TypeResolveGenericInstances()
2017-11-06 15:50:32 +01:00
Bernhard Urban 6f7025ba00 [interp] check interruption request flag properly after allocating an object 2017-11-06 15:50:32 +01:00
Bernhard Urban 88970711ff [interp] allow MONO_CALL_STDCALL calling convention on cee_calli insn
fixes Test/System.Reflection.Emit/ILGeneratorTest.cs::TestEmitCalliWithNullReturnType()
2017-11-06 15:50:32 +01:00
Bernhard Urban 292f8ac3c5 [interp] use checked variant of method_get_header and throw exception if there is an error 2017-11-06 15:50:32 +01:00
Bernhard Urban dfca26c32f [interp] allow unsigned i8 in pinvoke signature 2017-11-06 15:50:32 +01:00
Jonathan Chambers 9e6c430e5e Have Boehm mark handle stacks rather than using GC tracked memory. Unify handle memory across all GCs. 2017-11-06 15:41:17 +01:00
Zoltan Varga 29826908fc [interp] Make the interpreter use the JIT exception handling code. (#5943)
This removes the duplicate code from the interpreter and makes it possible to support exception debugging.

Also fix the the basic block construction code so CEE_THROW begins a new bblock.
2017-11-06 08:52:25 -05:00
Marek Safar 5a88e085f3 [corlib] Fixes NullFullNameForSpecificGenericTypes for mobile profiles 2017-11-05 14:42:05 -08:00
Jonathan Chambers f58ba94f8c Add g_ptr_array_capacity to retrieve current size of GPtrArray. Allows clients to know if future additions will cause (re)allocations. (#5931) 2017-11-04 21:57:43 -04:00
Alexander Köplinger 733b4a4c9f [ServiceModel.Web] Fix test by adding WebHttpBehavior to WebChannelFactory endpoint on MOBILE
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59909

WebChannelFactory doesn't add the WebHttpBehavior on mobile:
https://github.com/mono/mono/blob/4272b68b769951c221ec39d3e844f8f715e1df62/mcs/class/System.ServiceModel.Web/System.ServiceModel.Web/WebChannelFactory.cs#L87-L90

This makes the WebInvokeAttributeTest.RejectTwoParametersWhenNotWrapped
test fail on mobile since it doesn't reach the normal validation
method where it'd fail with InvalidOperationException, e.g. here''s
the stack on net_4_x profile:

```
System.InvalidOperationException : Operation 'Join' has multiple message body parts. Add parameters to the UriTemplate or change the BodyStyle to 'Wrapped' or 'WrappedRequest' on the WebInvoke/WebGet attribute.
  at System.ServiceModel.Description.WebHttpBehavior.ValidateOperation (System.ServiceModel.Description.OperationDescription operation) [0x000f9] in /Users/alexander/dev/mono/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs:249
  at System.ServiceModel.Description.WebHttpBehavior.Validate (System.ServiceModel.Description.ServiceEndpoint endpoint) [0x00028] in /Users/alexander/dev/mono/mcs/class/System.ServiceModel.Web/System.ServiceModel.Description/WebHttpBehavior.cs:268
  at System.ServiceModel.Description.ServiceEndpoint.Validate () [0x0007f] in /Users/alexander/dev/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceEndpoint.cs:129
  at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel (System.ServiceModel.EndpointAddress address, System.Uri via) [0x0002b] in /Users/alexander/dev/mono/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs:148
  at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel (System.ServiceModel.EndpointAddress address) [0x00000] in /Users/alexander/dev/mono/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs:115
  at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel () [0x00006] in /Users/alexander/dev/mono/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory_1.cs:110
```

We can fix this by adding the WebHttpBehavior in the test manually.

NB: I'm actually not sure why this isn't done by default on MOBILE?
According to MSDN it should.
2017-11-03 21:33:42 -07:00
Katelyn Gadd dc023c2fe0 Fix bug 57938 - FullName not returning null for certain generic types (#5920) 2017-11-03 21:15:28 -07:00
vkargov f6e21efe14 [ci] Coverage-imposed build flags should take top priority (#5940) 2017-11-04 03:22:22 +01:00
Vlad Brezae 4272b68b76 [interp] Throw exception in case of field access failure 2017-11-04 02:01:59 +02:00
Vlad Brezae 8f3a51860d [interp] Enable some tests 2017-11-04 02:01:59 +02:00
Vlad Brezae 14d137029b [interp] Don't sigsegv on field lookup failure
Throw exception instead
2017-11-04 02:01:59 +02:00
Vlad Brezae 36d588d62f [interp] Don't assert on ldtoken failure 2017-11-04 02:01:59 +02:00
Vlad Brezae 5d056c0184 [interp] Fix error propagation from interp invoke 2017-11-04 02:01:59 +02:00
Zoltan Varga 4c8bff917c [interp] Avoid translating methods while holding a low level lock, make a copy of InterMethod instead, do the translation with the copy, and copy the results back inside the lock. (#5935) 2017-11-03 18:45:28 -04:00
Aleksey Kliger 5fffc1b8cf [interp] Change 'class' to 'klass' 2017-11-03 21:52:26 +01:00
Jonathan Chambers 174bea7caf Replace 'class' identifier usage with 'klass' to avoid compile errors in C++ 2017-11-03 21:52:26 +01:00
Jo Shields 81feabe4c6 Consider Facades in Provides: too. Version number challenges remain. (#4874)
rpm-find-provides is a mess, this makes it a bit less of a mess by adding not only stuff from the GAC, but also Facades and 4.5 directories. Doesn't help with version mismatches for facades though.
2017-11-03 21:19:00 +01:00
Yuriy c43d73cfd7 [System.Windows.Forms] Fixes #60435. DataGridViewRow.CreateCellsInstance method is never invoked
This fixes bug #60435, where the DataGridViewRow.CreateCellsInstance method is never invoked. Now value of the Cells property is initialized by calling the CreateCellsInstance method.
2017-11-03 20:46:25 +01:00
Yuriy 151fa5590f Internationalization support for System.Windows.Forms: (#5886)
Removed unused localization resource files.
Added default resources for English locale. Updated makefile and System.Windows.Forms-net_4_x.csproj.
Class Locale now uses ResourceManager.
2017-11-03 20:40:17 +01:00
Zoltan Varga fb0fe43283 [sdb] Make get_this_addr () work with the interpreter. (#5937) 2017-11-03 10:39:32 -04:00
Manuel de la Pena fa898df0fc [Tests] Fix zip tests on iOS devices. (#5939)
The zip tests were not using temp files which created bug #60480 when
trying to read the embeded resources. This also fixes the situation in
which tests are run in parallel for the Mac since we could have tests
that step on each other files.
2017-11-03 15:18:48 +01:00
Manuel de la Pena 5143b5a461 [Test] Fix System.IO.Compression.FileSystem tests on iOS devices. (#5938)
Not using a temp file returns in an exception on iOS devices as per bug
60482.
2017-11-03 15:18:36 +01:00
Vlad Brezae 9b9159cb4a [interp] Use xdomain wrappers as with normal jit
Both on jit and interp, the full corlib message sink path does not work on some testcases. Apparently we rely on the xdomain wrappers for correctness there.
2017-11-03 06:25:08 +01:00
Vlad Brezae 5a1fa0f3df [interp] Don't rethrow current frame exception after an icall 2017-11-03 06:25:08 +01:00
Vlad Brezae e2b59a234f [interp] Set correct stack type for icall return 2017-11-03 06:25:08 +01:00
Vlad Brezae ae8d913b00 [interp] Fix constructor call on transparent proxies (#5934)
The object creation of some types (like ContextBoundObject) can return a transparent proxy. When calling the constructor on the returned object we might need to go through the remoting wrappers.
2017-11-02 23:32:19 -04:00
Rodrigo Kumpera 01e767447b [sdks] Address reviewer suggestion. 2017-11-02 16:08:18 -07:00
Rodrigo Kumpera d1349d274f [wasm] Add test runner that executes the mini test suite. 2017-11-02 15:59:56 -07:00
Rodrigo Kumpera a0687c199c [wasm] Build the wasm profile is it was configured in. 2017-11-02 15:58:48 -07:00
Rodrigo Kumpera db00ae8496 [wasm] Update port to work with master. 2017-11-02 15:25:29 -07:00
Rodrigo Kumpera 675b190455 [wasm] Workaround for emcc 1.37.22 that miscompiles the inline assembly. 2017-11-02 15:25:03 -07:00
Rodrigo Kumpera 6f229c1a1b [sdk] Fix wasm build. 2017-11-02 15:22:55 -07:00
Bernhard Urban 5b118b84e5 [interp] disable appdomain-unload (crashes too often) and add comment (#5922) 2017-11-02 13:22:28 -04:00
Vladimir Kargov fa7623e0f3 [tests] Allow overriding Mono arguments for JIT and AOT scenarios. 2017-11-02 08:20:59 -07:00
Vladimir Kargov 8ed81c060c Revert "[configure] Test AOT+LLVM if mono was configured to support both. (#5880)"
This reverts commit 79ef4d8eef.
2017-11-02 08:20:59 -07:00
Alexander Köplinger 033ccb6635 [System.Security] Simplify monodroid test excludes (#5919)
https://github.com/mono/mono/pull/5916 added !MOBILE ifdefs to the
sources so we can remove the .sources file exclusions.
2017-11-01 22:32:25 +01:00
Alexander Köplinger 3df4b8f7f6 [corlib] Add more Assembly*Attribute tests (#5918)
This should allow us to remove most of the linker exclusions in [1]
since they'd be used and thus not linked away in the tests.

Some of the attributes had existing tests but those were under !MOBILE
since they're using RefEmit. Added additional tests to those as well.

[1] https://github.com/xamarin/xamarin-android/blob/c43c5e671aa57a56f7ba5abc3423e9906af51a83/tests/Xamarin.Android.Bcl-Tests/Resources/LinkerDescription.xml
2017-11-01 22:32:07 +01:00
Rodrigo Kumpera 80a20870af [sdk] Use single : in android target that doesn't get appended to. 2017-11-01 14:16:40 -07:00
Rodrigo Kumpera 55cae500f5 [wasm] Add wasm-interp target to build the wasm interpreter based runtime. 2017-11-01 14:15:28 -07:00
Rodrigo Kumpera f124b4d1b8 Merge pull request #5912 from kumpera/bunch-of-changes-for-sdks
This fixes a bunch of issues I found with mono-sdks plus add a Mono.config override to help doing scoped builds.
2017-11-01 11:54:43 -07:00
Manuel de la Pena b73480af34 [Tests] Ensure that only a subset of the System.Security tests are ran on mobile platforms.
(cherry picked from commit 9f696f0eab)
2017-11-01 03:18:15 +01:00
Johan Lorensson d49e8c32c4 [mkbundle] Enhanced mkbundle cygwin/mingw fallback support. (#5867) 2017-11-01 01:05:58 +01:00
Zoltan Varga e0607c34f0 Debugger support for the interpreter (#5902)
* [interp] Add infrastructure code needed for unified exception handling between the interpreter and the JIT.

* Pass the clause to mono_interp_set_resume_state ().
* Add a mono_interp_run_filter () function to run filter clauses.
* Add a 'ji' field to ExceptionTraceIp which is used to avoid an ip->ji lookup in ves_icall_get_trace ().
* Rename mono_handle_exception_internal_first_pass () to handle_exception_first_pass () and make it return the
  StackFrameInfo for the frame which caught the exception.

This allows the removal of the duplicate and hard to understand interpreter EH code
and makes it easier to add debugger support to the intepreter.

* [sdb] Pass the already computed StackFrameInfo to mono_debugger_agent_handle_exception () so it doesn't have to be recomputed in ss_create (). This approach works both for the JIT and the interpreter.

* [interp] Generate seq points for async methods too.

* [interp] Rename ves_exec_method_with_context () to interp_exec_method_full (), add a interp_exec_method () helper with less arguments.

* [interp] Set ctx->sp for interpreter frames to the address of the InterpFrame structure, code in debugger-agent.c uses it to order frames.

* [sdb] Fix the support for filter clauses in the interpreter by running them in a new interpreter frame.

* [sdb] Add DEBUGGER_INVOKE frames for the interpreter.

* [interp] Add a mono_interp_frame_get_parent () function, use that instead of the 'new_sp' argument to mono_interp_frame_iter_next ().

* [sdb] Run the test code for the ClassLocalReflection () test only for that test since it doesn't work with the interpreter.

* [interp] Fix the build.
2017-10-31 18:39:43 -04:00
Konstantin Safonov 08bb8da2cc [System.Web] Reference source import (#5909)
* [System.Web] Reference source import: DataSourceControlBuilder, DefaultAuthenticationEventHandler, EventEntry, Pair, ServerValidateEventArgs, TreeNodeTypes, WizardStep

* Bump API snapshot submodule
2017-10-31 20:48:41 +01:00
cherusker bea6d82e80 Unlock sgen-fin-weak-hash.c:
- Unlock simple counters
- Unlock the usage of `next_fin_stage_entry` and `fin_stage_entries` within `add_stage_entry ()`
2017-10-31 17:16:38 +02:00
cherusker 2bf3e7e3a9 Prepare unlocked.h for the upcoming changes:
- add the `volatile` qualifier to all pointer parameters
- add `UnlockedWritePointer ()`
2017-10-31 17:16:38 +02:00
Zoltan Varga b259c836ab [jit] Move the code handling the MonoLMFExt structures from exceptions-<ARCH>.c to mini-exceptions.c, its the same on all platforms. (#5907)
* [jit] Move the code handling the MonoLMFExt structures from exceptions-<ARCH>.c to mini-exceptions.c, its the same on all platforms.

* [jit] Remove mono_arch_init_lmf_ext (), it does the same on every platform.
2017-10-31 10:32:20 -04:00
oittaa 35acde58d4 Use getrandom() instead of /dev/urandom on Linux (#5851)
Use getrandom() instead of /dev/urandom on Linux

getrandom() was introduced in version 3.17 of the Linux kernel and glibc has implemented it since version 2.25.
2017-10-31 14:25:07 +01:00
Vlad Brezae 32d2f28518 [sgen] Collect major after user requested minor collections
After a user requested minor collection we need to check if the new size of the heap exceeds the allowance, in which case we need to also do a major collection.

Fixes bug (#60168) where, if user triggers minors repeatedly, we never get to collect the major space (which is normally checked after the nursery is full, which never happens in this case)
2017-10-31 13:47:28 +02:00
Bernhard Urban 9a879a1b11 [interp] disable broken test cases on CI (#5914)
they do not always fail.

exception18.exe fails with:

```
Unhandled Exception:
System.Exception: Exception carried 3 frames along with it when it should have reported one.
-0: 0x00020 throw      in C:Main () () at Main:32 // (TODO: proper stacktrace)
-1: 0x00037 vcall      in (wrapper runtime-invoke) object:runtime_invoke_direct_void (object,intptr,intptr,intptr) ([0x0] [0x7fff5907bab0] [0x0] [0x7ffdf8e05308] ) at runtime_invoke_direct_void:55 // (TODO: proper stacktrace)
```

bug-48015.exe fails with:

```
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
-0: 0x00063 vcallvirt  in System.Runtime.Remoting.Proxies.RemotingProxy:Invoke (System.Runtime.Remoting.Messaging.IMessage) ([0x10e407930] [0x10e4081d0] ) at Invoke:99 // (TODO: proper stacktrace)
-1: 0x00077 callvirt   in System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy,System.Runtime.Remoting.Messaging.IMessage,System.Exception&,object[]&) ([0x10e407930] [0x10e4081d0] [0x7fff522b36e8] [0x7fff522b36e0] ) at PrivateInvoke:119 // (TODO: proper stacktrace)
-2: 0x00034 call       in (wrapper runtime-invoke) <Module>:runtime_invoke_direct_object_RealProxy_IMessage_Exception&_object[]& (object,intptr,intptr,intptr) ([0x0] [0x7fff522b3640] [0x7fff522b36e8] [0x7fd8dc85ff28] ) at runtime_invoke_direct_object_RealProxy_IMessage_Exception&_object[]&:52 // (TODO: proper stacktrace)
-3: 0x00000            in (wrapper remoting-invoke) object:Equals (object) ([0x10e4081a8] [0x10e4081a8] )
-4: 0x0000d callvirt   in Driver:Main (string[]) ([0x10e4003e8] ) at Main:13 // (TODO: proper stacktrace)
-5: 0x0003d vcall      in (wrapper runtime-invoke) <Module>:runtime_invoke_direct_void_string[] (object,intptr,intptr,intptr) ([0x0] [0x7fff522b5ab0] [0x0] [0x7fd8da40d408] ) at runtime_invoke_direct_void_string[]:61 // (TODO: proper stacktrace)
```

partial revert of: https://github.com/mono/mono/pull/5861
2017-10-31 12:46:46 +01:00
Alexander Köplinger 0dbdcf2e77 [Mono.Posix] Fix some socket tests on monodroid (#5915)
d9922895d4 removed Mono.Unix.Native/SocketTest.cs
from the exclude list on the monodroid profile.

It turns out that some tests don't work there however,
they fail with an ArgumentOutOfRangeException on some socket options.
2017-10-31 02:31:43 +01:00
Zoltan Varga 8992f0fd05 [runtime] Remove the no_raise argument from mono_register_jit_icall_full (), no icalls call mono_raise_exception () anymore. Rename the 'is_save' argument to 'no_wrapper'. Allow inlining wrappers for all icalls. (#5897) 2017-10-30 19:08:13 -04:00
Zoltan Varga 92477b9583 [jit] Remove unused mono_interruption_checkpoint_from_trampoline_deprecated () JIT icall. (#5895) 2017-10-30 19:04:31 -04:00
Rodrigo Kumpera 82579ce9ce Merge pull request #5879 from kumpera/wasm-work-p6
[wasm] Add missing tramp and fix compilation
2017-10-30 18:10:21 -04:00
Rodrigo Kumpera d208927a5f [sdks] Add notes for the BCL build. 2017-10-30 15:08:27 -07:00
Rodrigo Kumpera c133304b95 [android] Fix compilation with recent ndk and sdk target < 16. 2017-10-30 15:08:25 -07:00
Rodrigo Kumpera 6b3e68486a [sdks] Update bcl target to include wasm profile. 2017-10-30 15:08:06 -07:00
Rodrigo Kumpera cc9cb3f6d7 [sdks] Fix autogen invocation and respect Make.config options.
Not all systems will have brew's libtool force linked, so we probe for glibtool to ensure we got it.

Respect DISABLE_ options.

Added DISABLED_BCL.
2017-10-30 15:08:01 -07:00
vkargov 79ef4d8eef [configure] Test AOT+LLVM if mono was configured to support both. (#5880) 2017-10-30 17:28:36 -04:00
Ludovic Henry 110888fd66 [interp] Enable more runtime tests for interpreter 2017-10-30 20:08:24 +01:00
Rodrigo Kumpera d5028868d3 Merge pull request #5685 from urisimchoni/callspec-ut
Callspec unit testing and a bugfix
2017-10-30 14:04:45 -04:00
Zoltan Varga da53cb0e08 [runtime] Rename mono_raise_exception_with_context_deprecated () back to mono_raise_exception_with_context (), its ok to use since it starts unwinding from the CTX argument which points into managed code. (#5896) 2017-10-30 11:19:48 -04:00
Zoltan Varga fdcf7da3f4 [amd64] Remove the unused MonoLMF.rip field. (#5904) 2017-10-30 11:17:35 -04:00
Ludovic Henry ff078951a5 [w32process] Reduce mmap allocation by mapping file only once 2017-10-30 10:50:29 -04:00
Zoltan Varga 9fdc0045ad [runtime] Avoid creating callbacks.interp_get_remoting_invoke if the interpreter is not enabled at runtime. (#5905) 2017-10-29 21:50:54 -04:00
Zoltan Varga 96361e3913 [arm64] Throw OverflowException instead of the more general ArithmeticException. 2017-10-29 12:06:40 +01:00
Konstantin Safonov / kasthack ddd07a749f [System.Web] LoginTextLayout from reference source 2017-10-28 09:59:36 +02:00
Jonathan Chambers dd033ae341 Duplicate friend assembly names and add needed null terminator. 2017-10-28 09:58:59 +02:00
Neale Ferguson 1c15c3ebd3 Match amd64/arm64 in the way of handling exceptions within trampolines (#5891) 2017-10-28 02:02:25 -04:00
Rodrigo Kumpera f5915baa5d [sdks] Fix android configure with latests NDK
The latest NDK doesn't support platform 9 anymore, the minimum it accepted was 14 thus I changed both arm and x86 to it.
This is harmless as 14 covers all but gingerbread which XA plans on stopping to support.

Added a android-toolchain target that configure all android toolchains.
2017-10-27 16:43:25 -07:00
Rolf Bjarne Kvinge cfba305b7e [corlib][Test] Ignore FileTest.SymLinkLoop until bug #59239 is fixed. (#5889)
https://bugzilla.xamarin.com/show_bug.cgi?id=59239
2017-10-28 01:12:06 +02:00
Konstantin Safonov a043b26831 [System.Web] EmptyControlCollection from reference source (#5884)
* [System.Web] EmptyControlCollection from reference source

* Bump API snapshot submodule
2017-10-28 01:10:33 +02:00
Rodrigo Kumpera f871b90d5e [sdks] Fix Android build.
The generated project.properties file is required by build.xml.
Fix the clean target to work on a clean tree and to remove those generated files.
2017-10-27 15:50:22 -07:00
Rodrigo Kumpera ac4095a1ea [sdks] Improve path handling and include local conf file
On my system, XS installs android sdk/ndk on different places.
This patch probe the default places and fallback to the places I got.

It does verify if the paths are bad and fail building ASAP.

Finally, in includes sdks/Make.config that will include defines to trim what things you actually want to build.
2017-10-27 15:49:31 -07:00
Rodrigo Kumpera 2856f523f6 [wasm] Add missing tramp 2017-10-27 14:49:45 -07:00
Uri Simchoni 4a28d3595c [runtime] fix prev commit build for Linux x64 2017-10-27 22:22:02 +03:00
Rodrigo Kumpera 6b8b32b6fc [runtime] Fix unit test. 2017-10-27 22:07:21 +03:00
robotrovsky e1b75723d7 Bugfix: 1.5 stop bits for serial port should set the posix stop bit flag (#5873)
1.5 stop bits have not been handled at all.
According to this documentation of the 8250 UART:
http://stanislavs.org/helppc/8250.html

a set bit 2 in the LCR register means stop bits = 1.5 for 5 bit words or 2 for 6, 7 or 8 bit words.
That is the reason why pyserial also sets the bit:
https://github.com/pyserial/pyserial/blob/92d101613be41ecb2f2054c3f43a006fbe6f9966/serial/serialposix.py#L377
2017-10-27 19:59:13 +02:00
Marek Safar f2e658cdca [build] Add wasm profile 2017-10-27 19:48:59 +02:00
Konstantin Safonov 6d9d804d62 [System.Web] TableFooterRow from reference source (#5882)
* [System.Web] TableFooterRow from reference source

* Bump API snapshot submodule
2017-10-27 19:38:24 +02:00
Zoltan Varga 0a320dbb95 [aot] Error out when using the coverage profiler + aot, its not supported. Fixes #60175. (#5881) 2017-10-27 19:08:41 +02:00
Konstantin Safonov adbf98b977 [System.Web] CompilationMode from reference source (#5878) 2017-10-27 12:23:28 +02:00
Konstantin Safonov 1f1a1574c2 [System.Web] ScrollBars from reference source (#5869) 2017-10-27 12:23:00 +02:00
Konstantin Safonov 6e529aafcc [System.Web] ObjectDataSourceEventHandler from reference source (#5868) 2017-10-27 12:22:42 +02:00
Konstantin Safonov 5802f03926 [System.Web] WizardStepType from reference source (#5870) 2017-10-27 12:21:44 +02:00
Konstantin Safonov 8e617d38da [System.Web] TableHeaderRow from reference source (#5866)
* [System.Web] TableHeaderRow from reference source

* Bump API snapshot submodule
2017-10-27 12:16:55 +02:00
Konstantin Safonov aa39bf69f2 [System.Web] IndexedString from reference source (#5872)
* [System.Web] IndexedString from reference source

* Bump API snapshot submodule
2017-10-27 12:14:16 +02:00
Konstantin Safonov c17cc609da [System.Web] ImageClickEventArgs from reference source (#5871)
* [System.Web] ImageClickEventArgs from reference source

* Bump API snapshot submodule
2017-10-27 12:09:07 +02:00
Uri Simchoni 59c42eacf4 [mono/unit-tests] add callspec unit tests for different classs same prefix
Add a test that covers the case where a callspec method
descriptor has a class whose name is a prefix of the matched
class.
2017-10-27 10:01:45 +03:00
Uri Simchoni e4b94aa495 [metadata] Avoid matching class with prefix name
When matching a class in match_class() debug helper, avoid maching the class
if the matched-against descriptor's class name is only
a prefix of the class name, but the class name is actually
longer (e.g. don't match Foo2 against Foo).
2017-10-27 10:01:45 +03:00
Uri Simchoni ec038ebb76 [mono/unit-tests] callspec unit testing
Add a unit test for callspec parsing and evaluation.

call specifications are being  used with the --trace command line
argument and with the log profiler 'callspec' parameter. This test
suite verifies that call specifications are correctly parsed and matched
against methods at runtime.
2017-10-27 10:01:45 +03:00
Marek Safar c14b08013c [Microsoft.CSharp] Adds more tests 2017-10-26 23:33:17 +02:00
Ludovic Henry b0919d93f9 [sdks] Source drop from xamarin/mono-sdks (#5876)
```
commit dcd3ed4930fbfa19df1a34c17bc17f5a57badb83
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 6 15:53:36 2017 -0700

    switch mono to 2017-04.

 external/mono | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit cbff024be0d2ed30efda0ee228c339e4e2dce866
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 6 15:53:13 2017 -0700

    Update readme with xtc specifics.

 README.md | 13 +++++++++++++
 1 file changed, 13 insertions(+)

commit b385e6ce4ee7ffb92cdb39cdf8bbdb82355d909f
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 6 15:34:18 2017 -0700

    Add makefile to build & submit to xtc.

 android/xtc/Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

commit 09ca3773ac25d8415c537f063d057aa471bb1eae
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 6 15:08:29 2017 -0700

    UITest based runner.

 android/xtc/RuntimeTests.csproj | 43 +++++++++++++++++++++
 android/xtc/RuntimeTests.sln    | 17 +++++++++
 android/xtc/Tests.cs            | 84 +++++++++++++++++++++++++++++++++++++++++
 android/xtc/packages.config     |  5 +++
 4 files changed, 149 insertions(+)

commit bc20ebfeb58ee9d876e2f675651bdb9afa07fdeb
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 6 15:05:39 2017 -0700

    Finish x86 support.

 android/Makefile           | 4 ++++
 android/jni/Application.mk | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

commit dcec00c4ef9240324ef3c4b9a4d5ab7c670c1984
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 6 13:49:55 2017 -0700

    Add new redeploy target plus fix bcl staging.

 android/Makefile         | 4 ++++
 android/managed/Makefile | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

commit 5d6db27c2a3039271138f9f8c58a72262211793d
Author: Bernhard Urban <[email protected]>
Date:   Thu Mar 30 18:26:24 2017 -0400

    [readme] add todo item for android

 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 9ebd7bed3a5e66ccae2819e4c1045a1714a4274b
Author: Bernhard Urban <[email protected]>
Date:   Thu Mar 30 17:39:49 2017 -0400

    fix default make target

 Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

commit f307dd3ef39733f528f1ef816741d2a9f4017f7a
Author: Bernhard Urban <[email protected]>
Date:   Thu Mar 30 17:37:11 2017 -0400

    [sdks] use $(NDK_DIR) from paths.mk

 sdks/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 83f470fcd7b039fd7945ec939c314bc18d2829ad
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Mar 30 16:58:45 2017 -0400

    More todos

 README.md | 1 +
 1 file changed, 1 insertion(+)

commit d5a3d38a848860f5c4ba320c0ca6d26d52eff635
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Mar 30 16:58:28 2017 -0400

    Add x86 and x86_64

 android/jni/Application.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 3c51f005173a021d1bf6e8ecea22bc3b5fda08ba
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Mar 30 16:55:45 2017 -0400

    Fix the mono submodule.

 external/mono | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit e293d61090c9e8eb3a113a0d34be7ddd1e2c3597
Author: Bernhard Urban <[email protected]>
Date:   Wed Mar 29 18:36:29 2017 -0400

    [readme] add links to specific NDK

 README.md | 6 ++++++
 1 file changed, 6 insertions(+)

commit 0985f1c448641484de6eac249f9cb9af1f1973b5
Author: Rodrigo Kumpera <[email protected]>
Date:   Wed Mar 29 16:32:47 2017 -0400

    fix x86/x86_64 packaging.

 README.md        |  1 +
 sdks/Makefile    | 13 +++----------
 sdks/android.erb | 13 +++++++++++++
 3 files changed, 17 insertions(+), 10 deletions(-)

commit c0b9498d9afdaea48f474d31358a284b31d621e5
Author: Rodrigo Kumpera <[email protected]>
Date:   Wed Mar 29 15:31:37 2017 -0400

    Add x86 and x86-84 to sdks.

 sdks/Makefile            | 15 +++++++++++++--
 sdks/android-template.rb | 33 +++++++++++++++++++++++++++++++++
 sdks/android.erb         |  4 ++--
 3 files changed, 48 insertions(+), 4 deletions(-)

commit 53778f4d473798123cf06896ffd2082517afc08d
Author: Rodrigo Kumpera <[email protected]>
Date:   Wed Mar 29 11:40:18 2017 -0400

    small updates

 Makefile  | 7 ++++++-
 README.md | 5 +++++
 2 files changed, 11 insertions(+), 1 deletion(-)

commit 531603b66b630f3a46d1173124e202867f22460b
Author: Rodrigo Kumpera <[email protected]>
Date:   Wed Mar 29 11:33:08 2017 -0400

    Add Android app.

 android/AndroidManifest.xml                        |  17 +
 android/Makefile                                   |  56 ++
 android/build.xml                                  |  92 ++++
 android/jni/Android.mk                             |  36 ++
 android/jni/Application.mk                         |   2 +
 android/jni/runtime-bootstrap.c                    | 588 +++++++++++++++++++++
 android/res/layout/main.xml                        |  22 +
 android/res/values/strings.xml                     |   4 +
 .../src/org/mono/android/main/AndroidRunner.java   | 136 +++++
 9 files changed, 953 insertions(+)

commit 2ae7f04e5fec696c83e47e8d938d9c9a3804beb8
Author: Rodrigo Kumpera <[email protected]>
Date:   Wed Mar 29 11:05:30 2017 -0400

    Add C# test runner, build scripts and the needed machine.config.

 Makefile                            |  55 +------
 android/machine.config              | 278 ++++++++++++++++++++++++++++++++++++
 android/managed/Makefile            |  80 +++++++++++
 android/managed/fake-monodroid.cs   |  80 +++++++++++
 android/managed/main.cs             | 106 ++++++++++++++
 android/managed/mini-test-runner.cs |  74 ++++++++++
 6 files changed, 621 insertions(+), 52 deletions(-)

commit ded22bbf4a496e5e4a5fc9feb1f615698101718b
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue Mar 28 13:59:42 2017 -0400

    update readme

 README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

commit f32b490b520da12a68f14ca6adfb00cb06b6733e
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue Mar 28 00:26:00 2017 -0400

    Initial set of scripts to build Android runtimes.

 .gitmodules              |  4 +++
 Makefile                 | 57 +++++++++++++++++++++++++++++++
 README.md                | 23 +++++++++++++
 external/mono            |  1 +
 paths.mk                 |  5 +++
 sdks/Makefile            | 83 +++++++++++++++++++++++++++++++++++++++++++++
 sdks/android-template.rb | 58 +++++++++++++++++++++++++++++++
 sdks/android.erb         | 88 ++++++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 319 insertions(+)

commit c61c02f2f30e513c3f2c471892158958e9a042ca
Author: Rodrigo Kumpera <[email protected]>
Date:   Wed May 3 12:22:18 2017 -0700

    Build offsets & cross compilers, requires tip of kumpera/mono/naked-mono-goes-ios. Ready for cleanup-a-ton.

 sdks/ios.mk | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

commit 9b0f4522b96f7f9f91837859ad422e7a5c4300fb
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue May 2 19:56:22 2017 -0700

    add cross64.

 sdks/ios.mk | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

commit 1b03dc6552dd08b1690374e6b73d89a085b59a2e
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue May 2 19:55:30 2017 -0700

    add cross compilers. cross offset generation missing.

 sdks/ios.mk | 52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 48 insertions(+), 4 deletions(-)

commit 1697337e706220185568eedf52b73e236521576a
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue May 2 17:38:52 2017 -0700

    add device64

 sdks/ios.mk | 115 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 92 insertions(+), 23 deletions(-)

commit 39f5ce7332d2d2cb7f9ca187f5d88f092f030d3c
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue May 2 13:18:15 2017 -0700

    missing files.

 ios/MonoTestRunner/main.cs | 106 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)

commit e3acb9682de0cf11ceda0ab38649c39fc7518b41
Author: Rodrigo Kumpera <[email protected]>
Date:   Tue May 2 13:15:53 2017 -0700

    some IO stuff

 ios/MonoTestRunner/Makefile                        | 15 ++++--
 .../MonoTestRunner/Base.lproj/Main.storyboard      | 41 +++++++++++++++--
 ios/MonoTestRunner/MonoTestRunner/ViewController.m | 18 ++++++++
 .../MonoTestRunner/runtime-bootstrap.c             | 12 +++--
 .../MonoTestRunner/runtime-bootstrap.h             |  1 +
 .../MonoTestRunner/runtime-objc-helpers.m          | 53 +++++++++++++++++++++-
 6 files changed, 129 insertions(+), 11 deletions(-)

commit 5c83e9bb5bfdae13ff632d620b4d2a9896c83be3
Author: Rodrigo Kumpera <[email protected]>
Date:   Thu Apr 20 15:41:43 2017 -0700

    Skeleton support for iOS. Sim only, not part of regular build.

 ios/MonoTestRunner/Makefile                        |  32 ++
 .../MonoTestRunner.xcodeproj/project.pbxproj       | 373 +++++++++++++++++++++
 ios/MonoTestRunner/MonoTestRunner/AppDelegate.h    |  17 +
 ios/MonoTestRunner/MonoTestRunner/AppDelegate.m    |  51 +++
 .../AppIcon.appiconset/Contents.json               |  93 +++++
 .../MonoTestRunner/Assets.xcassets/Contents.json   |   6 +
 .../Base.lproj/LaunchScreen.storyboard             |  27 ++
 .../MonoTestRunner/Base.lproj/Main.storyboard      |  26 ++
 ios/MonoTestRunner/MonoTestRunner/Info.plist       |  45 +++
 ios/MonoTestRunner/MonoTestRunner/ViewController.h |  15 +
 ios/MonoTestRunner/MonoTestRunner/ViewController.m |  32 ++
 ios/MonoTestRunner/MonoTestRunner/main.m           |  16 +
 .../MonoTestRunner/runtime-bootstrap.c             | 269 +++++++++++++++
 .../MonoTestRunner/runtime-bootstrap.h             |  16 +
 .../MonoTestRunner/runtime-objc-helpers.m          |  44 +++
 sdks/Makefile                                      |  10 +-
 sdks/ios.mk                                        | 177 ++++++++++
 17 files changed, 1245 insertions(+), 4 deletions(-)
 ```
2017-10-26 15:15:56 -04:00
Rodrigo Kumpera 55df935275 Merge pull request #5874 from vargaz/fix-60255
[jit] Throw the more specific OverflowException instead of ArithmeticException in the ldiv/lrem emulation functions. Fixes #60255.
2017-10-26 10:21:07 -07:00
Zoltan Varga eb9238c05e [jit] Throw the more specific OverflowException instead of ArithmeticException in the ldiv/lrem emulation functions. Fixes #60255. 2017-10-26 10:12:31 -04:00
Alexander Kyte df86ddf49b [dontmerge/forjenkins] Always enable jemalloc, so CI builds with enabled for pkg 2017-10-26 03:01:12 -04:00
Alexander Kyte 27d68cef08 [runtime] Bring jemalloc to mono
Jemalloc is known to have much better performance than system memory
allocators, and is safe in concurrent/re-entrant situations.

To use, provide the following options to configure:

--with-jemalloc to enable optionally. To use at runtime,
export MONO_USE_JEMALLOC to the environment.

--with-jemalloc-always to enable and make the default

--with-jemalloc-assert to enable with assertions to catch memory
unsafety. It adds overhead, but an overhead that's much less than
valgrind or asan.

If you export
MONO_JEMALLOC_CONF="stats_print:true"

You will see detailed memory statistics for mono at exit.

Now note that jemalloc is used through an explicit registration, so
C libraries called through pinvoke calls will not use jemalloc unless
they configure themselves to do so separately.

To understand the build work, I'm statically linking jemalloc.a into
the compilation unit for mono/utils/mono-jemalloc.c, which is
responsible for registering it with mono at startup. No further
copying out of the submodule is necessary at installation time.
2017-10-26 03:01:11 -04:00
Katelyn Gadd 067809c50e Add an automated test that will fail if the list of feature names in CompilerServices.RuntimeFeature is changed (#5854) 2017-10-25 23:13:50 +02:00
Marek Safar a348c12719 Bump roslyn 2017-10-25 21:38:44 +02:00
Rodrigo Kumpera 5c75f593de Merge pull request #5764 from Unity-Technologies/save-resume-tramp-amd64-xmm-arg-regs
Save and resume full 128-bits of xmm argument registers in trampoline…
2017-10-25 10:11:08 -07:00
Rodrigo Kumpera 13a9fb6c7a Merge pull request #5844 from vargaz/fix-60288
[runtime] Allow valuetypes larger than 1MB created by csc. Fixes #60288.
2017-10-25 10:07:43 -07:00
Marek Safar b0983b83cd [mono] Update denied assemblies list 2017-10-25 18:37:23 +02:00
lateralusX 82e2421819 Build fixes for none Windows desktop platforms.
* Exclude a couple of sources currently not building anything useful on Windows.
* Added MONO_EMTPY_SOURCE_FILE to a couple of source files ending up empty by default.
* Excluded API's not included on UWP targets.
* Explicitly declared import project paths in target files.
* Added support to define x64 MASM build outside default targets file.
2017-10-25 16:44:19 +02:00
Zoltan Varga e3c239ccdc [arm] Add support for unlimited size/number of arguments to the dyn call code. Part of the fix for #59184. (#5840) 2017-10-25 10:08:12 -04:00
Egor Bogatov 0f045b1ded [System.Data] Cleanup after #4893 (PR) (#5841)
* [System.Data] cleanup

* Remove DataProviderTests
2017-10-25 11:34:22 +02:00
Jon Purdy 00af82567c Bump corlib version for MonoIO coop handle changes. 2017-10-24 10:37:29 -07:00
Jon Purdy 1ba4211147 [coop-handles] System.IO.MonoIO.Read 2017-10-24 10:37:29 -07:00
Jon Purdy 498eb7dc58 [coop-handles] System.IO.MonoIO.GetCurrentDirectory 2017-10-24 10:37:29 -07:00
Jon Purdy 72b5a0e99e [coop-handles] System.IO.MonoIO.get_InvalidPathChars 2017-10-24 10:37:29 -07:00
Jon Purdy 6cdc5531dc [coop-handles] System.IO.MonoIO.FindNextFile 2017-10-24 10:37:29 -07:00
Jon Purdy b73d5302b1 [coop-handles] System.IO.MonoIO.FindFirstFile 2017-10-24 10:37:29 -07:00
Jon Purdy 52786872cd [coop-handles] System.IO.MonoIO.Write 2017-10-24 10:37:29 -07:00
Jon Purdy 77fd6e0846 [coop-handles] System.IO.MonoIO.SetFileAttributes 2017-10-24 10:37:29 -07:00
Jon Purdy 16ebef70ed [coop-handles] System.IO.MonoIO.SetCurrentDirectory 2017-10-24 10:37:29 -07:00
Jon Purdy 85f4b5b167 [coop-handles] System.IO.MonoIO.ReplaceFile 2017-10-24 10:37:29 -07:00
Jon Purdy 8ea394429c [coop-handles] System.IO.MonoIO.RemoveDirectory 2017-10-24 10:37:29 -07:00
Jon Purdy 847aec7167 [coop-handles] System.IO.MonoIO.Open 2017-10-24 10:37:29 -07:00
Jon Purdy 0de5f20375 [coop-handles] System.IO.MonoIO.MoveFile 2017-10-24 10:37:29 -07:00
Jon Purdy e57d26ebaf [coop-handles] System.IO.MonoIO.GetFileStat 2017-10-24 10:37:29 -07:00
Jon Purdy 794f17ef8b [coop-handles] System.IO.MonoIO.GetFileAttributes 2017-10-24 10:37:29 -07:00
Jon Purdy 89647e4d20 [coop-handles] System.IO.MonoIO.DeleteFile 2017-10-24 10:37:29 -07:00
Jon Purdy 26aaf7617d [coop-handles] System.IO.MonoIO.CreateDirectory 2017-10-24 10:37:29 -07:00
Jon Purdy 477d5f3f70 [coop-handles] System.IO.MonoIO.CopyFile 2017-10-24 10:37:29 -07:00
Ankit Jain 26ccf75f06 [msbuild] Add symlink to csc.exe in msbuild bin dir
Roslyn looks only inside `$msbuild_bin/Roslyn/` and does not fallback to
the framework path. msbuild worked around this by setting `CscToolPath`:

https://github.com/mono/msbuild/commit/157a0f4d1a7aadd4e561e3ca8c784cbc2529926f

But this kicks in only if the default msbuild target files are imported!
If the `Csc` task is being used without importing them, then we fail
with

	`error MSB3082: Task failed because "csc.exe" was not found.`

`Microsoft.CodeAnalysis.VisualBasic.dll` is the only file not being
symlinked, after this change. So, instead we will symlink all the files.

Fixes bxc #60340 .
2017-10-24 17:09:03 +02:00
Alexander Köplinger 2b15f1e6b2 [runtime] Fix Windows build break due to renamed mono_error_raise_exception (#5849)
It was renamed in 91a10ffd01
but some places which are only used on Windows were missed.
2017-10-24 16:32:24 +02:00
Radek Doulik 4b702c8d6a [corlib] Updated LinkerDescriptor
Preserve
`System.Runtime.Remoting.Activation.ActivationServices.CreateProxyForType`. It
is called from `object.c:mono_object_new_specific_checked` when
constructing remoting or com objects.

I didn't add `feature="remoting"` because it is used also for com
objects.

Added linker test. Without the LinkerDescriptor addition, it fails
like this:

    Unhandled Exception:
    System.NotSupportedException: Linked away.
      at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_object_new_specific(intptr)
      at C.Main () [0x00001] in /Users/rodo/git/mono/mcs/tools/linker/Tests/mscorlib/test-remoting.cs:11
    [ERROR] FATAL UNHANDLED EXCEPTION: System.NotSupportedException: Linked away.
      at (wrapper managed-to-native) System.Object.__icall_wrapper_ves_icall_object_new_specific(intptr)
      at C.Main () [0x00001] in /Users/rodo/git/mono/mcs/tools/linker/Tests/mscorlib/test-remoting.cs:11
2017-10-24 16:14:56 +02:00
Alexis Christoforides 9502de7852 Merge pull request #5846 from kumpera/wasm-work-p5
[interpreter] Fix the DISABLE_REMOTING build.
2017-10-24 01:07:39 -07:00
Alexis Christoforides 14a6854c79 [scripts] Build 64-bit package by default 2017-10-24 00:36:56 -07:00
Zoltan Varga bc3ba3cb5d [arm] Make the generic trampoline call mono_thread_force_interruption_checkpoint_noraise () and throw the exception itself instead of calling the obsolete mono_interruption_checkpoint_from_trampoline (). (#5838) 2017-10-24 01:46:29 -04:00
vinogradniy 79d96a5a8d Fix WCF Windows Linux cross WCF-comunication via NetTcpBinding (without any security Transport|Message). (#5842)
See also:
 * https://stackoverflow.com/questions/37813752/wcf-and-data-contract-with-template
 * https://bugzilla.xamarin.com/show_bug.cgi?id=58261
2017-10-24 00:40:51 +02:00
Zoltan Varga 03ea90cf1f [bcl] Optimize Process.GetCurrentProcess ().MainModule. (#5843) 2017-10-24 00:32:31 +02:00
Zoltan Varga cc67bfdcfc [runtime] Allow valuetypes larger than 1MB created by csc/mcs. Fixes #60288. 2017-10-23 18:08:11 -04:00
Rodrigo Kumpera f2e1f58a80 [interpreter] Fix the DISABLE_REMOTING build. 2017-10-23 14:40:19 -07:00
Jonathan Chambers 77b4cd11d1 Only null check target for delegate if method is not static. (#5833)
* Only null check target for delegate if method is not static. Fixes regression introduced by 1cfd52452a.

* [interp] pass first stack arg to transform, so we get the correct delegate wrapper

the wrapper logic detects if the target method of a delegate is a static
method with an argument bound, and handles it properly in the generated
code.

fixes mono/tests/delegate14.cs
2017-10-23 15:53:20 -04:00
Zoltan Varga 91a10ffd01 [runtime] Mark mono_raise_exception()/mono_reraise_exception() as external only. Add new _deprecated internal versions. (#5839) 2017-10-23 15:50:59 -04:00
Rolf Bjarne Kvinge 5edb2a54db [runtime] Improve diagnostics about methods that failed to LLVM-compile by including the typename in the message. (#5706) 2017-10-21 12:25:23 -04:00
Alexander Köplinger d60877b0f3 Fix tarball build
corefx.unix.sources wasn't included in the tarball so it failed.
2017-10-21 00:44:56 +02:00
Alexis Christoforides 2124bda984 Merge pull request #5830 from alexischr/wrench-tests
Add MacSDK test script
2017-10-20 10:16:55 -07:00
Rodrigo Kumpera 7cde4806fd Merge pull request #5632 from luhenry/threads-rework-shutdown
[threads] Guarantee we abort all threads before shutdown
2017-10-20 10:06:20 -07:00
Vlad Brezae 299ad0f1fd Merge pull request #5825 from BrzVlad/fix-interp-appdomain
[interp] Interp fixes
2017-10-20 20:03:02 +03:00
Alexis Christoforides f5ee4a398c Add MacSDK test script 2017-10-20 09:22:31 -07:00
Zoltan Varga dc732f0166 [jit] Fix #59182 for the coop case as well. (#5824) 2017-10-20 09:54:02 -04:00
Vlad Brezae e9899e4bb1 [interp] Enable appdomain tests 2017-10-20 16:53:48 +03:00
Vlad Brezae 70cff6b6b0 [interp] Rethrow abort exceptions at end of catch 2017-10-20 16:51:54 +03:00
Vlad Brezae 043ee9f13d [interp] Interruption checkpoint during branches
This makes aborts work when interp is stuck in a loop.
2017-10-20 11:12:46 +02:00
Vlad Brezae 7483082d9a [interp] Handle remoting calls in delegates 2017-10-20 11:12:45 +02:00
Vlad Brezae ea73165ca8 [interp] Add lmf when doing icalls
So we can unwind when exceptions are directly thrown from unmanaged.
2017-10-20 11:12:45 +02:00
Vlad Brezae ee98142c15 [interp] Don't generate remoting wrapper for normal calls
Remoting calls should be virtual only.
2017-10-20 11:04:39 +02:00
Vlad Brezae 111a6ed2ff [interp] Fix tls jit pointer fetch 2017-10-20 11:04:39 +02:00
Katelyn Gadd 44b21bca28 Fix bug #58400 - incorrect implementation of LocalPath for file URLs (#5779) 2017-10-20 10:53:25 +02:00
Bernhard Urban c26e069703 [interp] remove setjmp/longjmp unwinding machinery 2017-10-20 10:52:25 +02:00
Bernhard Urban 5e6893ad48 [interp] remove unused ves_exec_method 2017-10-20 10:52:25 +02:00
Vlad Brezae 15bb34e6d6 Merge pull request #5785 from BrzVlad/fix-59153
[mini] Don't attempt to compile method of open generic class
2017-10-20 10:53:40 +03:00
Ludovic Henry 30b5ea7cd9 [MonoError] Add goto_if_nok to reduce duplicated code (#5834) 2017-10-19 21:52:58 -04:00
Alexander Köplinger f5aca1da30 [tests.make] Filter out comments from test.dll.sources for TEST_FILES
This broke "make dist" after 61559965a1
because comments were added to System.Data_test.dll.sources
and they weren't stripped when TEST_FILES was computed so it tried
to include them in the tarball as files.
2017-10-20 01:32:26 +02:00
Bernhard Urban a8dab358d9 [interp] do not attempt to transform method of open generic class 2017-10-19 21:02:06 +03:00
Ludovic Henry 1df82c2d51 [threads] Also abort background threads on shutdown
We count on the fact no threads are created or switched to foreground between the time we waited for all foreground threads to exit and the time we abort all running threads (except for the finalizer and DONT_MANAGED threads). This is racy and we should suspend all threads, them being foreground or background.
2017-10-19 13:40:49 -04:00
Ludovic Henry 0b40428d59 [threads] Let mono_thread_detach_internal remove thread from threads
Removing the thread from the `threads` array in `remove_and_abort_threads` goes against the lifetime expectation that a thread is removed from `threads` when it is being detached. This 2 ways of having the thread removed complicates the lifetime management and expectations of the thread.
2017-10-19 13:34:31 -04:00
Alexis Christoforides 1538798867 Merge pull request #5778 from alexischr/bug-56003
[System.URI] Don't reset host string processing on Unicode paths. Fix…
2017-10-19 09:46:13 -07:00
Egor Bogatov 61559965a1 [System.Data] move to corefx (#4893)
* [System.Data] move to corefx

* [System.Data] Missing API: SqlTypesSchemaImporters

* [System.Data] Missing API: SqlNotification*

* [System.Data] Missing API: SqlDataSourceEnumerator

* [System.Data] Missing API: SQLDebugging

* [System.Data] fix build

* [System.Data] remove public API from different assemblies

* Apply corefx changes

* Hide some PropertiesTest (missing API in corefx)

* Missing API: TypedDataSetGenerator*, etc

* Missing API: SqlClientMetaDataCollectionNames

* Missing API: SqlCredential

* SqlMetaDataFactory.cs is actually sqlmetadatafactory.cs (case sensitive)

* Missing API: PoolBlockingPeriod

* Fix case-sensitive issues

* Odbc support (requires changes in corefx)

* ODBC support

* Re-enable ODBC ProviderTests

* Apply corefx changes

* temp commit: fix build

* Missing API: Microsoft.SqlServer.Server.*

* Missing API: DBDataPermission, OdbcPermission, SqlClientPermission

* Missing API: DbProviderFactoriesConfigurationHandler, DbProviderConfigurationHandler, DbProviderFactory.CreatePermission

* Missing API: DbProviderFactories

* Missing API: SqlCommand BeginXXX methods, SqlException.Message, OdbcFactory.CreatePermission

* Add System.Data.SqlClient.SqlMetaData.xml (embedded resource)

* reorganize *.sources files for win32, macos and linux

* bump corefx

* [System.Data] API: SqlDataSourceEnumerator, SqlClientFactory, SqlParameter, SqlMetaData

* [System.Data] cleanup

* [System.Data] mobile profile, cleanup

* [System.Data] Fix few odbc tests (changes are in corefx PR)

* [System.Data] fix Open_ConnectionString_DatabaseInvalid test

* [System.Data] enable all tests

* Add AsynchronousProcessing and ConnectionReset to SqlConnectionStringBuilder

* [System.Data] fix build

* fix all ProvierTests

* fix tests (files several issues against the corefx)

* system-data code cleanup

* system-data code cleanup

* add SqlTypesSchemaImporters

* remove corefx/RuntimeInformation.cs, add OleDbPermission stub

* OleDbPermission should be serializable (fixing tests)

* remove ODBC from mobile profile

* fix linux build - add 619 (obsolete) to nowarn list.

* temp commit

* fix a few api diff issues

* add OleDbType type (currently exists even in mobile profiles)

* add stubs

* Add stubs for OleDb

* improve oledb stubs

* improve oledb stubs

* improve oledb stubs

* more oledb stubs

* add xunit tests from corefx

* Add SqlClient corefx tests

* use corefx sources for System.Data.DataSetExtensions

* Remove [InternalsVisibleTo ("System.Data.DataSetExtensions")] from System.Data

* [System.Data] sync with external/corefx

* fix linux\macOS builds

* Fix xunit tests

* System.Data/Makefile cleanup

* tabify System.Data

* Rollback changes in System.Web & SqlSharpCli

* small cleanup

* [System.Data] Remove redundant .sources files

* [System.Data] update odbc Res.cs

* [System.Data] Remove redundant .sources files

* fix System.Data.dll.sources (add a blank line)

* remove TypeForwarder for DBNull and register xunit tests for System.Data

* Bump API snapshot submodule
2017-10-19 18:20:03 +02:00
Jonathan Chambers ce596ec25c Save and resume full 128-bits of xmm argument registers in trampoline. Add definition of MonoContextSimdReg on amd64 for Windows platform and use for size/offset calculations. 2017-10-19 12:10:07 -04:00
monojenkins c50b4ef9c7 [msvc] Update csproj files (#5832) 2017-10-19 17:49:07 +02:00
Rodrigo Kumpera 5a7d6e3d9a Fix spiller when the dest membase optimization intereferes with lvreg caching. Fixes #20562 (#5747)
* [mini] Fix spiller when the dest membase optimization intereferes with lvreg caching. Fixes #20562

Given this IR sequence:
	int_add R18 <- R18 R18
	move R37 <- R18

The spiller would use the dest membase optimization and change the `add` to `add_membase_reg` and assume that the value in R18 would still be valid afterwards. This was the case cuz the code handling sreg2 won't check whether R18 would be mutated but not kept in a register.

The fix is to disable lvreg caching if the dest membase optimization is used. It forces later uses to reload from memory, which is not great, but it's correct.

* [mini] Add regression test for #20562 and re-enable ratests.cs.
2017-10-19 11:24:41 -04:00
Johan Lorensson 0f9bbb90fb [runtime] Rename atomic functions from the win32 style naming to mono_atomic_<op>_<type>, with a consistent signature on all platforms, including Windows implementation. (#5767)
* [runtime] Rename atomic functions from the win32 style naming to mono_atomic_<op>_<type>, with a consistent signature on all platforms. This fixes a large number of warnings on windows.

* Add Windows implementaiton of mono_atomic_*.

* Windows implementation of mono_atomic_* inline functions.
* Changed naming typo in mono_atomic_xchg_i32Add and mono_atomic_xchg_i32Add64.
* Fixed some additional signed/unsigned/volatile warnings when using mono_atomic_*
* Fixed some smaller additionl warnings.

* Fix Interlocked* to mono_atomic_* name change in signal.c

* Additional name adjustment of atomics.

Aligning more towards C11/C++11 standard namings:

mono_atomic_xchg_add_i32|i64 -> mono_atomic_fetch_add_i32|i64

Changed from mono_atomic_add to mono_atomic_fetch_add in cases when return
type is not used.

Also includes small mingw build fix on Windows.

* Aligned loads with C++11 implementation using explicit compiler barrier.

On x86/x64 Windows, reading a properly aligned 8,16,32 bit volatile variable
(using /volatile:ms extension) should have acquire semantics. On x64
this also includes 64-bit properly aligned volatile variables.

The C++11 implementation does however include an explicit _ReadWriteBarrier in
its sequentially consistent implementation to instruct compiler to not reorder
load/stores. Since compiler supports two modes of volatile behavior (ms/iso)
this additional barrier is probably there for consistency, independent of the
behavior of volatile keyword.

NOTE, the x86/x64 CPU architecture has strong guarantees regarding load/store of
memory operations, so issuing a CPU memory barrier for loads should not be needed
(and is not done in C++11 atomics implementation).

This commit also adds a couple of optimizations for 32-bit loads and for x64,
64-bits loads. The C++11 implementation uses the same pattern loading them as 8
and 16 bits variables, so no need for Interlocked* calls to load 32-bit and for x64
64-bit variables.
2017-10-19 10:43:03 -04:00
Alexander Köplinger 1e29ed0d7e [System.Core] Remove duplicated test classes (#5829)
These tests classes are already included in the corlib test assembly.
Having them duplicated in System.Core causes issues in XA because
both test assemblies are in the same process.

To solve this we introduce abstract *TestBase classes that we can
share between the test assemblies and only mark the concrete test
class implementations with [TestFixture]
2017-10-19 16:34:35 +02:00
Egor Bogatov 8af88bd0e6 Update root gitignore (#5831)
".idea" - folder generated by jetBrains Rider IDE (it's possible to open, compile and debug net_4_x.sln solution in it)
2017-10-19 16:18:46 +02:00
Zoltan Varga ceec5e9786 [coverage] Fix the printing of nested generic instances. Fixes #60224. 2017-10-19 15:45:59 +02:00
Marek Safar 9cce09b0a2 [runtime] Workaround for verifier bug #59967 2017-10-19 15:30:07 +02:00
Marek Safar c763b4a250 Bump Roslyn 2017-10-19 15:30:07 +02:00
Alexander Köplinger 6caf00b09c [bcl] Remove AssertExtensions helper classes (#5828)
* [bcl] Remove AssertExtensions helper classes

Since we're on nunitlite now we can use the proper `Assert.Throws<>()`
instead and remove the helper class (which we actually duplicated!)
2017-10-19 12:38:33 +02:00
EgorBo cfedbd7aa2 replace min with MIN 2017-10-19 10:54:03 +02:00
EgorBo eb5fa1fced fix code-style issues 2017-10-19 10:54:03 +02:00
EgorBo bbb109bd03 limit max possible threads in ThreadPool (SetMaxThreads). Fixes bug-60027 2017-10-19 10:54:03 +02:00
Marek Safar dbb0872f49 [corlib] Adds ValueTuple tests 2017-10-19 10:04:37 +02:00
Alexis Christoforides 0ccfa87a91 [System.URI] Don't reset host string processing on Unicode paths. Fixes #56003
This may not be the final fix; the Mono-only workaround was introduced in b5dc9a4951 to fix a crash with Unicode paths in TryCreate. However the test case for that issue now succeeds without the workaround.
2017-10-18 16:33:56 -07:00
Vlad Brezae df37bb7a7c [mini] Don't attempt to compile method of open generic class
It requires creating a vtable for the class, which is not supported.
2017-10-19 00:16:16 +03:00
Bernhard Urban 0b60a62ee7 [interp] use POP_VT macro 2017-10-18 21:23:42 +02:00
Bernhard Urban 6684e29f7a [interp] check stack_type in cee_ldobj
fixes test-580.cs
2017-10-18 21:23:42 +02:00
Bernhard Urban 7777d78b16 [System.Net] Tweak tests for watchOS 2017-10-18 19:59:55 +02:00
Zoltan Varga 71997d296f [llvm] Fix the returning of vtypes using a hidden argument in bitcode, in some cases, we forgot to generate the code to return the value, causing random data to be returned. Fixes #59956. (#5786) 2017-10-18 13:29:02 -04:00
monojenkins 17d86bd264 [msvc] Update csproj files (#5823) 2017-10-18 18:52:00 +02:00
Zoltan Varga 5440d5718b [runtime] Avoid an assertion in mono_profiler_get_coverage_data () if the method doesn't have a body. (#5777) 2017-10-18 09:27:40 -04:00
Zoltan Varga e7736ca5cc [ppdb] Add a log message when an assembly has no ppdb debug directory. (#5795) 2017-10-18 09:04:04 -04:00
Marek Safar 1d0e803fbb [runtime] Don't crash when method/assembly with no code coverage does not have debug symbols 2017-10-18 14:26:51 +02:00
Aleksey Kliger (λgeek) 3d00ea31a7 [sre] Register a canonical reflected method for a methodspec token. (Fixes #60233) (#5813)
* [test] ILGenerator test for duplicate methodspec tokens

Regression test for [Bugzilla #60233](https://bugzilla.xamarin.com/show_bug.cgi?id=60233)

* [sre] mono_dynamic_image_register_token: Change asserts to warnings

This partly relaxes the changes in 792b5367cd
which added the assertions.

In practice the assertions introduced a crash in heavy uses of
System.Reflection.Emit such as unit testing frameworks and dynamic languages.
We still want to know if there are surprising uses of
mono_dynamic_image_register_token, but we don't need a crash.  SRE used to work
before 792b5367cd, so no need to break it.

* [sre] Register a canonical reflected method for a methodspec token (Fixes #60233)

This is like the fix for [bugzilla
59364](https://bugzilla.xamarin.com/show_bug.cgi?id=59364) but this time it's a
methodspec token, not a memberref token.
2017-10-18 08:11:51 -04:00
Marek Safar 4bd3aa2158 [bcl] Update PlatformDetection helpers 2017-10-18 13:07:47 +02:00
Marek Safar e87cc4822c Bump xunit dependency 2017-10-18 09:01:18 +02:00
Bernhard Urban 618ef61ae9 [eglib] check if result is set
quote from the darwin man page:

> The functions getpwnam_r(), getpwuid_r(), and getpwuuid_r()
> return 0 if no error occurred, or an error number to indicate
> failure.  It is not an error if a matching entry is not found.
> (Thus, if result is NULL and the return value is 0, no
> matching entry exists.)
2017-10-18 08:55:52 +02:00
Alexander Köplinger 464c5916d5 [bcl] Fix test assembly build for monodroid profile (#5808)
* [System.IdentityModel] Add excludes for tests that don't compile on monodroid profile

Also add a new test for X509CertificateValidator so the assembly
isn't empty on monodroid.

* [System.ServiceModel] Add excludes for tests that don't compile on monodroid profile

* [System.Security] Add excludes for tests that don't compile on monodroid profile

Also reduce duplication between common.sources and System.Security.dll.sources

* [System.Web.Services] Add excludes for tests that don't compile on monodroid profile

* [System.ComponentModel.DataAnnotations] Make tests compile on monodroid profile
2017-10-18 02:20:07 +02:00
Vlad Brezae afb822af07 Merge pull request #5803 from BrzVlad/fix-small-warning
[sgen] Fix warning
2017-10-18 00:51:49 +03:00
Alexander Köplinger bdababe715 [bcl] Add dependency on .exclude.sources to test assembly (#5804)
Otherwise the assembly won't get rebuilt when you modify .exclude.sources
which can be quite confusing.
2017-10-17 22:06:53 +02:00
Bernhard Urban 9c2a4ff286 [mini regressions] enable aot-tests.cs & gshared.cs on more configurations (#5791)
* [mini regressions] enable aot-tests.cs also on non-fullaot

* [interp] handle Nullable in cee_unbox

* [interp] fix cee_ldobj when top of stack is a value type

fixes test_0_dyncall_nullable

* [mini] require aot-tests regression tests to run only with OPT_INTRINS
2017-10-17 15:47:32 -04:00
Bernhard Urban 2a294c432e [interp] do not run mcs/tests on ARM on CI
an issue [1] is blocking it on that architecture.

https://github.com/mono/mono/pull/5806
2017-10-17 21:26:41 +02:00
Bernhard Urban 87694b9ed0 [mcs/tests] make test harness output more verbose on V=1 2017-10-17 21:26:41 +02:00
Bernhard Urban d12dda34e4 [mcs/tests] add interp target 2017-10-17 21:26:41 +02:00
Bernhard Urban f2bab1910d [linker] update referenced source files 2017-10-17 19:04:42 +02:00
Bernhard Urban 8e3867013a Bump linker 2017-10-17 19:04:42 +02:00
monojenkins 9ff18d1dca [msvc] Update csproj files (#5805) 2017-10-17 18:22:28 +02:00
Bernhard Urban 2d63c93d06 [interp] use correct code base pointer and set native_offset
frame->ip points into generated code MINT bytecode, while hd->code
points into the original CIL code buffer.

il_offset is calculated by exception handling:
https://github.com/mono/mono/blob/8593149b0be0f58a98d798b42aef10c58cdc8069/mono/mini/mini-exceptions.c#L1150
2017-10-17 17:43:55 +02:00
Bernhard Urban acb5f68e3e [interp] avoid leaking MonoMethodHeader data structure by freeing or avoiding it 2017-10-17 17:43:55 +02:00
Bernhard Urban d055f9e21f [interp] fix minor leaks around wrappers 2017-10-17 17:43:55 +02:00
Marek Habersack d9922895d4 [monodroid] Enable a number of tests (#5799)
Just over a year ago Xamarin.Android switched to running BCL tests straight
from the Mono sources but at the time we decided we didn't want to enable
a number of "new" tests (in the sense - never previously ran on XA) to avoid
introducing new failures in time which required focusing on more important
goals.

Currently, Xamarin.Android no longer uses Mono **sources** to build its tests
but, rather, it uses test **assemblies** built by Mono. This commit restores
the previously excluded tests in preparation for full BCL test coverage in
the near future.
2017-10-17 14:47:53 +02:00
Vlad Brezae d8d4307293 [sgen] Fix warning 2017-10-17 15:44:42 +03:00
Alexander Köplinger c399c787c8 [I18N] Add more encoding tests
There was very little test coverage of the I18N encodings before.

This adds a bunch of tests based on Latin1EncodingTest.cs since
latin1 is quite similar to these encodings.

A few of the added tests fail in some encodings due to what looks
like bugs in the implementation, disabled those temporarily, see FIXME's.
(filed https://bugzilla.xamarin.com/show_bug.cgi?id=60216 for tracking)
2017-10-17 14:12:24 +02:00
Alexander Köplinger 25ad948e02 [corlib] Add corefx System.Text.Encoding tests
This adds about 9800 Encoding related tests from corefx, all passing
after the latest fixes.
2017-10-17 14:12:24 +02:00
Alexander Köplinger 83af047720 [corlib] Add tests for EncoderFallback
Also remove some debug spew.
2017-10-17 14:12:24 +02:00
Alexander Köplinger e8ad2487f3 [corlib] Use Latin1Encoding from referencesource
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=53296
2017-10-17 14:12:24 +02:00
Alexander Köplinger 4c4d3dcdc5 [I18N] Remove commented code from ucm2cp.c
This is just confusing in the final output.
2017-10-17 14:12:24 +02:00
Alexander Köplinger 73eed5d415 [I18N] Fix wrong charIndex in encoder fallback
We need to modify charIndex/charCount _after_ we called
the fallback encoder otherwise it'll get the wrong index.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=45893
2017-10-17 14:12:24 +02:00
Marek Safar 8593149b0b [build] Add code coverage mode (#5789) 2017-10-17 12:22:55 +02:00
Alexander Köplinger 606f40e708 [corlib] Fix SRE.SaveTest error during teardown on Windows
When I added temp dir handling to SaveTest in https://github.com/mono/mono/pull/5727
I copied the Setup/TearDown from TypeBuilderTest.

However that class doesn't actually save+load the assemblies so
it doesn't run into the issue on Windows where assemblies can't
be deleted because they're still loaded in the AppDomain.

To fix this follow CustomAttributeBuilderTest and ModuleBuilderTest,
i.e. just catch all Exception's in teardown...
2017-10-17 09:24:48 +02:00
Alexis Christoforides 66f11a1699 Merge pull request #5715 from BrzVlad/fix-alpine-context
[amd64] Get xmm registers only when on glibc
2017-10-17 03:00:02 -04:00
Vlad Brezae dd1a39dbc6 [amd64] Get xmm registers only when on glibc
Other libc's like on alpine, have different ucontext_t format.
2017-10-17 02:19:01 +03:00
Alexander Köplinger c89a3e55b7 [Mono.Posix] Use TestHelper code from monodroid repo (#5793)
We need this because XA is now starting to use the test assemblies
we build in the Mono repo instead of using the .cs source directly
and this would conflict.
2017-10-17 00:07:35 +02:00
Vlad Brezae a1cc4dfedb Merge pull request #5788 from BrzVlad/fix-handle-track-sp
[coop handles] Fix handle track_sp
2017-10-17 00:33:16 +03:00
Alexis Christoforides 23d2615f3d Merge pull request #5782 from YuriyGS/bug60115
[System.Windows.Forms]  In MonthCalendar added validation on acceptable date interval. Fixes #60115
2017-10-16 11:03:00 -04:00
Johan Lorensson 3a8e4fcfd4 Merge pull request #5781 from lateralusX/lateralusX/fix-thread-suspend-windows
[Windows] Fix random failures in sgen stress tests on Windows due to mono_thread_is_gc_unsafe_mode assert.
2017-10-16 08:43:57 +02:00
Vlad Brezae d4b2024871 [coop handles] Add comment to prevent hard to debug bugs 2017-10-15 01:20:37 +03:00
Vlad Brezae 69b9f11b6f [coop handles] Fix monotonic handle check race with stw in mono_handle_new 2017-10-15 01:20:28 +03:00
Vlad Brezae 1f1edce576 [coop handles] Add log entry about successor handle 2017-10-15 01:20:20 +03:00
Vlad Brezae dc2d1c291f [coop handles] Fix monotonic check
Stack grows downwards so we expect handle->alloc_sp to be smaller than previously allocated handles.
2017-10-15 01:20:08 +03:00
Alex Rønne Petersen 23d2ee726d Merge pull request #5753 from alexrp/wsl-fixes
[runtime] Some WSL fixes.
2017-10-13 19:54:44 +02:00
YuriyGS 1dcaf8fddc Added validation on acceptable date interval when update SelectionRange property. Fixed loss of focus when the user presses the arrow buttons and shift. 2017-10-13 17:22:46 +03:00
Bernhard Urban efdf035cfb [arm64] use DMB ISH barrier instead of undefined barrier option
ARMv8 ARM [cf. C6.2.65] says:

> All other encodings of CRm that are not listed above are reserved, and can
> be encoded using the # syntax. It is IMPLEMENTATION DEFINED whether options
> other than SY are implemented. All unsupported and reserved options must
> execute as a full system barrier operation, but software must not rely on
> this behavior

That means, before we would rely that chip implementations fall back to
SY, which is explicitly stated that software must not rely on. Also, ISH
is enough, as a "inner shareability domain" contains all PEs controlled
by a single hypervisor or operating system. That is what GCC, linux
kernel and so forth do as well.
2017-10-13 16:09:30 +02:00
Bernhard Urban 8dead2a644 [arm64] update definitions for barrier option of DMB
according to C6.2.65 of ARMv8 ARM (Printed on: September 25, 2017)
2017-10-13 16:09:30 +02:00
Alex Rønne Petersen 959eb46e17 [mono-context] Work around a WSL bug when fetching XMM registers.
Some broken versions of WSL don't set the mcontext_t::fregs field to a valid
pointer. We work around this by checking if the pointer is NULL, and if so,
not making the fpstate available. This is not ideal as we won't scan XMM
registers on these broken WSL versions, but accessing the
ucontext_t::__fpregs_mem layout is more complicated than it seems, so this
workaround will have to do.
2017-10-13 14:45:23 +02:00
Marek Safar d73e8be1de [mcs] Fixes parsing tuple name inside generic type in method header block 2017-10-13 12:48:16 +02:00
lateralusX f53ce8e180 Fix random failures in sgen stress tests on Windows due to `mono_thread_is_gc_unsafe_mode assert.
Random failures in Jenkins tests, more frequent in sgen stress test due to the following assert:

Assertion at ..\mono\mini\mini-trampolines.c:842, condition `mono_thread_is_gc_unsafe_mode ()' not met

When investigating this a little deeper revealed a race when switching thread states from ASYNC_SUSPENDED
to RUNNING. The assert would fire on a running thread due to having a ASYNC_SUSPENDED state, but when thread
state was inspected in debugger it was showing correct RUNNING state.

Looking through the code indicated that this should not be possible, since caller would suspend thread before
setting ASYNC_SUSPENDED using atomic ops and set back to RUNNING before thread was resumed using atomic ops.

So based on this the only way to get wrong state and fire assert would be if the thread was not immediately
suspended when Win32 SuspendThread API returned, and read the ASYNC_SUSPEND value before really suspended by
the kernel. Nothing in the API documentation indicates that the SuspendThread actually behaves this way, but
current implementation assumes that SuspendThread actually suspends the thread and only return when no more
user mode code is executed by the thread.

Turns out that this is not 100% accurate and SuspendThread is just a suspend request to the scheduler, so when
SuspendThread call returns the “suspended” thread might still execute user mode code and that breaks the assumption
in current implementation opening up for the observed race condition triggering the assert. This behavior of SuspendThread
has been described in this article, https://blogs.msdn.microsoft.com/oldnewthing/20150205-00/?p=44743/.

The fix is to make sure thread is really suspended before continue executing. The way to do so is by requesting the threads
context right away after SuspendThread call returns. This will force the kernel to wait until thread has really been suspended
since it need to return back a valid context record to the caller.

Fix also includes a smaller optimization. Since we retrieved the context later in the execution of mono_threads_suspend_begin_async_suspend,
the fix opens the possibility to pass a sigctx to thread_state_init_from_handle and then the implementation of thread_state_init_from_handle
could use passed sigctx in its work instead of request it again (if passed in). Since we need to get the context early on Windows, we could
reuse that, passing it into thread_state_init_from_handle aving us from several unnecessary kernel mode context switches otherwise needed
to open thread and get thread context. NOTE, this optimization is only used on Windows and other platforms will use default behavior.
2017-10-13 12:39:44 +02:00
Alexander Köplinger 8eb2c02d7e [acceptance-tests] Reenable ms-test-suite test after Mono bug was fixed (#5776)
Fix went in with https://github.com/mono/mono/pull/5751
2017-10-12 22:10:35 +02:00
Vincent Povirk 1c4d741a02 [corlib/Test] Check for "Israel Standard Time" zone on Windows. 2017-10-12 11:29:31 +02:00
Vincent Povirk ce19b84529 [corlib] Remove a broad try/catch.
This was hiding a bug reading registry info for some timezones.
2017-10-12 11:29:31 +02:00
Vincent Povirk b86c084cbc [corlib] Use full years for transition rule start/end ranges.
This fixes creation of TimeZoneInfo for some time zones on Wine (such
as Israel Standard Time) and probably also Windows.
2017-10-12 11:29:31 +02:00
EgorBo 6d4821b282 fix formatting issues 2017-10-12 10:33:07 +02:00
EgorBo 55fb7bcda1 fix bug-60031 Thread doesn't throw ThreadStateException when it should 2017-10-12 10:33:07 +02:00
Alexander Köplinger 308ce3f5c3 [tests] Remove test from runtime-invoke.cs
It was added in a54603a604
but fails on ARM FullAOT at the moment:
https://jenkins.mono-project.com/job/test-mono-mainline-fullaot/label=debian-8-armhf/461/testReport/MonoTests/runtime/runtime_invoke_exe/

According to Zoltan the test doesn't run on all platforms yet
so we should just revert it.
2017-10-12 08:53:37 +02:00
Ludovic Henry 7a452797f1 [tests] Re-enable appdomain-thread-abort.exe (#5736)
* [tests] Re-enable appdomain-thread-abort.exe

* [tests] Refactor appdomain-thread-abort.exe
2017-10-11 22:09:02 -04:00
Ludovic Henry db8183c9d8 [debugger] Fix LineNumbers test (#5744) 2017-10-11 22:07:47 -04:00
Alexander Köplinger 43757d67ef [msvc] Fix MONO_CORLIB_VERSION to match configure.ac (#5770)
When I simplified MONO_CORLIB_VERSION to only include major.minor
instead of major.minor.build in https://github.com/mono/mono/pull/5449
I forgot to apply the same change to the msvc copy of that logic.
2017-10-12 02:33:58 +02:00
Alexis Christoforides 81f7d591d7 Merge pull request #5741 from alexischr/bug-60028
[corlib] Throw exception on using disposed Timer object. Fixes #60028
2017-10-11 15:55:39 -04:00
Bernhard Urban 663754bf46 [mini helpers] fix disassembly on aarch64
the disassembler inserts metadata to show everything as data.
2017-10-11 21:24:03 +02:00
Marek Safar 4fe87bd820 [corlib] Adds more tests 2017-10-11 20:57:37 +02:00
Stephen C. Wills 03474ba9e2 Fixed unhandled exceptions in EndPointListener.cs (#5724)
Application hosting self-hosted website over https crashes when attempting to access a webpage over http. The patch described in the bug report below resolves the crash, and the commit in this pull request implements the fix.

https://bugzilla.xamarin.com/show_bug.cgi?id=52675
2017-10-11 19:36:37 +02:00
Rodrigo Kumpera abd4a6a57b Merge pull request #5746 from kumpera/fix_56194
[runtime] Ensure the field type is resolved before using it in RuntimeHelpers::InitializeArray. Fixes #56194
2017-10-11 09:53:11 -07:00
Bernhard Urban 286aa03847 [interp] remove wrong checks, as cee_mkrefany and cee_refanyval only take one argument on the stack
if the stack is only of height one at this point, the access is out of
bounds as well.
2017-10-11 14:01:11 +02:00
Bernhard Urban d8bd874fe4 [interp] assume `this' always to be platform pointer size
this query is wrong for builtin value types such as float.

fixes gtest-etree-01.exe
2017-10-11 14:01:11 +02:00
Bernhard Urban 49b29bfce8 [interp] flag mint_box instruction if value type stack should be popped too
in some scenarios the reference could be loaded via some unsafe
constructs (i.e., it doesn't live on `vt_sp`), so we have to
distinguish that use case, otherwise we could underflow `vt_sp`.

fixes test-301.cs and test-305.cs
2017-10-11 14:01:11 +02:00
Bernhard Urban 1f580e17b8 [interp] bail out on __arglist and propagate MonoError properly in transformer
thus, we do not assert at least on test-269.exe
2017-10-11 14:01:11 +02:00
Bernhard Urban 3468d54fbb [interp] set stack type properly for ldelem_vt
fixes gtest-112.cs
2017-10-11 14:01:11 +02:00
Bernhard Urban b05f478376 [interp] add i1, i2 & r8 support for CEE_STELEM
fixes test-async-11.exe
2017-10-11 14:01:11 +02:00
Bernhard Urban 34592c5233 [interp] resolve generic types properly in mint_box, mint_ldobj and mint_cpobj
fixes crash in gtest-065.cs and gtest-072.cs
2017-10-11 14:01:11 +02:00
Bernhard Urban 6c60d2fce0 [interp] pass field instead of pre-calculated size for ld*fld.vt 2017-10-11 14:01:11 +02:00
Bernhard Urban 373ebd547d [tramps] add missing fp reg and check for the future 2017-10-11 13:59:58 +02:00
Bernhard Urban fa92fa86c2 [interp] fix offsets in switch insn dump (only affects debug output) 2017-10-11 13:59:58 +02:00
Bernhard Urban 3a8cb50b07 [interp] fix compiler warning
> interp/interp.c: In function ‘ves_exec_method_with_context’:
> interp/interp.c:4553:4: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
>     MonoDomain *tls_domain = (MonoDomain *) ((gpointer (*)()) mono_tls_get_tls_getter (TLS_KEY_DOMAIN, FALSE)) ();
2017-10-11 13:59:58 +02:00
Bernhard Urban ed10891d9b [interp] replace printf with g_print 2017-10-11 13:59:58 +02:00
Bernhard Urban d071235ffa [lldb] update expression in script 2017-10-11 13:59:58 +02:00
Johan Lorensson 16a67c6f6e Merge pull request #5689 from lateralusX/lateralusX/windows-native-unwind-codeview-support
[Windows] Windows x64 full AOT native unwind info support.
2017-10-11 13:04:07 +02:00
Zoltan Varga e47b1865c2 [runtime] Allow throwing pending exceptions from protected wrappers. 2017-10-11 12:32:41 +02:00
Zoltan Varga 0ae4504681 [runtime] Remove a mono_error_raise_exception () call from mono_remoting_wrapper (), its not needed since mono_remoting_wrapper () is called through a wrapper. 2017-10-11 12:32:41 +02:00
Zoltan Varga 12ca539f85 [jit] Call mono_llvm_raise_exception () directly from a bitcode jit icall. (#5752) 2017-10-11 09:57:16 +02:00
Bernhard Urban 42816aaa92 [interp] fix offset calculation for exvar slots in locals
otherwise we off-by-one overflow and smash other things
2017-10-11 09:19:08 +02:00
Aleksey Kliger ad4ed79c9a [test] Add Type.GetType("", ...) tests 2017-10-11 08:57:50 +02:00
Aleksey Kliger 0c61eb1b12 [reflection] Throw TLE for Type.GetType("", true) (Fixes #59664)
In the C parser check for empty at the outset.
In the managed parser, copy an empty string component to the built-up TypeSpec
and handle it in the Type.GetType (..., asmResolver, typeResolver) implementation
2017-10-11 08:57:50 +02:00
Aleksey Kliger e004f1ed5e [reflection] Use MonoError for mono_reflection_parse_type_checked
Mark mono_reflection_parse_type as external only.  Runtime should use the
_checked version.
2017-10-11 08:57:50 +02:00
Rodrigo Kumpera 95ab8ab08f [runtime] Ensure the field type is resolved before using it in RuntimeHelpers::InitializeArray. Fixes #56194
Field types are now lazily resolved and this breaks the RuntimeHelpers::InitializeArray icall.

The solution is to use mono_field_get_type_checked to ensure the type is there.
2017-10-10 15:55:54 -07:00
Bernhard Urban 8f324cdfc2 [ASan] introduce MONO_NO_SANITIZE_ADDRESS macro and mark sgen pin object scanning function as such
ASan has very few false-positives, quoting the ASan documentation
(https://github.com/google/sanitizers/wiki/AddressSanitizer#turning-off-instrumentation):

> In some cases a particular function should be ignored (not instrumented)
> by AddressSanitizer:
>
>  [...]
>
> * Ignore a function that does some low-level magic (e.g. walking through
>   the thread's stack bypassing the frame boundaries).
>
>  [...]
2017-10-10 23:25:30 +02:00
Zoltan Varga 8cf8b32972 [runtime] Use mono_set_pending_exception () in ves_icall_System_Threading_Thread_Sleep_internal (). (#5748) 2017-10-10 21:44:34 +02:00
Zoltan Varga f02e158d3c [runtime] Remove unused mono_gc_out_of_memory () function. (#5750) 2017-10-10 17:25:30 +02:00
Marek Safar 4718035ee6 [mcs] Adds workaround for compiled enum types used as fields of other types. Fixes #59080 2017-10-10 17:08:38 +02:00
Bernhard Urban 1c9cf1f1c0 [interp] fix LMF popping during exception handling
Assume you have something like this:

```
$ cat invokecrasher.cs
using System;
using System.Reflection;

public class InvokeCrasher {
        readonly static object[] default_args = new object[1] { new string[] {} };
        public static void Main (string []args) {
                Assembly assembly = Assembly.LoadFile ("crasher.exe");
                try {
                        assembly.EntryPoint.Invoke (null, default_args);
                } catch {
                }

                assembly.EntryPoint.Invoke (null, default_args);
        }
}
```

```
$  cat crasher.cs
using System;

public class Crasher {
        unsafe public static void Main (string []args) {
                int i = 1337;
                CrashMe (&i);
                throw new Exception ();
        }

        unsafe static void CrashMe (int *p) {
                // p = (int *) 0;
                *p = 0;
        }
}
```

On the first `Invoke ()` the interpreter goes through `ves_pinvoke_method`:

```
      interp_push_lmf (&ext, frame);

      mono_interp_enter_icall_trampoline (addr, margs);

      interp_pop_lmf (&ext);
```

The LMF is needed for unwinding by mini. In this situation though,
`Crasher` throws an exception and goes through the exception handling machinery
of the interpreter which leads to missing out of the `interp_pop_lmf ()` call.

On the second `Invoke` we would therefore push the same address as an LMF
again, which leads to a LMF that points to itself as `previous_lmf`. If we
encounter a native crash in this state (as hinted with `p = (int *) 0; *p = 0;`),
the unwinding machinery would end up in an infinite loop.
2017-10-10 15:14:31 +02:00
Bernhard Urban 8e9c90b37e [interp] remove InterpMethod entry in hash table on free_method callback 2017-10-10 15:13:39 +02:00
Yuriy 428d0606ab [System.Windows.Forms] Proper operation order. Fixes #59393. (#5734) 2017-10-10 15:12:48 +02:00
Bernhard Urban 344a3ec4e1 [interp] use GC aware memcpy for storing value types to fields
value types can contain references, and therefore GC write barriers are
required.
2017-10-10 14:35:49 +02:00
Alexander Köplinger 75415afa76 [bcl] Fix csi to work on Mono (#5737)
It'd fail to find System.Runtime.dll and System.ValueTuple.dll.
Changed the csi.rsp to include those from the Facades/ dir and added a test.

Workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=58965
2017-10-10 13:41:34 +02:00
monojenkins c4bee6af4d Merge pull request #5726 from alexrp/master
[profiler] Clean up the makefile and address some issues with it.

* Don't link the profilers to libmono, except on mobile.
* The coverage profiler doesn't use zlib. Don't link to it.
* Fix the LIBADD variable for the VTune profiler.
* Add some comments for certain non-obvious aspects.
* Some style cleanup.

Also introduce a HOST_IOS variable in the build system which covers iOS, watchOS, and tvOS.
2017-10-10 12:45:06 +02:00
Alex Rønne Petersen 8e9ae0cb07 [w32socket] Ignore errors for IP_MTU_DISCOVER on WSL.
WSL, being Linux, declares IP_MTU_DISCOVER in its headers, but does not
actually support it. This is fixed in newer (preview) builds of WSL, but add
this workaround so Mono will work on older (stable) WSL versions.
2017-10-10 08:01:52 +02:00
Alexis Christoforides 15c0640201 Merge pull request #5714 from alexischr/update_bockbuild
Update Bockbuild
2017-10-09 20:05:45 -04:00
Alexander Köplinger 4058c2be43 [utils] Add check for ANDROID_UNIFIED_HEADERS to mono-compiler.h (#5742)
https://github.com/mono/mono/pull/5680 added mmap/sendfile prototypes
but we should only use those when ANDROID_UNIFIED_HEADERS is defined
to avoid getting errors like:

```
/Users/alexander/dev/xamarin-android/external/mono/mono/utils/mono-compiler.h:157:7: error: conflicting types for 'mmap'
void* mmap (void*, size_t, int, int, int, __mono_off32_t);
        ^
/Users/alexander/android-toolchain/toolchains/arm-linux-androideabi-clang/bin/../sysroot/usr/include/sys/mman.h:47:15: note: previous declaration is here
extern void*  mmap(void *, size_t, int, int, int, off_t);
                ^

/Users/alexander/dev/xamarin-android/external/mono/mono/utils/mono-compiler.h:166:9: error: conflicting types for 'sendfile'
ssize_t sendfile (int out_fd, int in_fd, __mono_off32_t* offset, size_t count);
        ^
/Users/alexander/android-toolchain/toolchains/arm-linux-androideabi-clang/bin/../sysroot/usr/include/sys/sendfile.h:36:16: note: previous declaration is here
extern ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
```
2017-10-10 01:08:17 +02:00
monojenkins d2e60f48b6 [msvc] Update csproj files (#5745) 2017-10-09 21:40:39 +02:00
Alexander Köplinger c9fc371e31 [corlib] Use temp directory for assemblies in SaveTest.Save() (#5727)
It was writing to the current working directory before which
doesn't work on platforms where that directory is read-only.

Using the same setup/teardown methods as TypeBuilderTest we
instead create a directory in the temporary location and put
the files there.
2017-10-09 20:08:25 +02:00
Alexis Christoforides 64b4a63a87 [corlib] Throw exception on using disposed Timer object. Fixes #60028 2017-10-09 13:37:07 -04:00
Marek Safar 90a68e6591 [corlib] Fixes make dist (#5735) 2017-10-09 15:44:11 +02:00
lateralusX aef03761fa Updated with review feedback. 2017-10-09 08:55:34 +02:00
Alex Rønne Petersen 70abfb795a [profiler] Clean up the makefile and address some issues with it.
* Don't link the profilers to libmono, except on mobile.
* The coverage profiler doesn't use zlib. Don't link to it.
* Fix the LIBADD variable for the VTune profiler.
* Add some comments for certain non-obvious aspects.
* Some style cleanup.

Also introduce a HOST_IOS variable in the build system which covers iOS,
watchOS, and tvOS.
2017-10-08 06:56:55 +02:00
vkargov 56b3c007f4 [runtime] Don't insta-fail when a faulty COM type is encountered. (#5616)
* [jit] Don't insta-fail on faulty cominterop invocations.

* [runtime] New test for bug 8477.

* [jit] Implement mono_error_get_exception_name() and mono_mb_emit_exception_for_error()

* [jit] Throw an exception when a static method on a ComImport class is called.
2017-10-06 16:07:33 -04:00
Alexis Christoforides 9eed0cb99e Update Bockbuild 2017-10-06 13:34:46 -04:00
lateralusX e77153a623 Adding basic codeview support on Windows x64 full AOT builds.
Emit very basic codeview information into full AOT builds on Windows x64. The codeview information is far from complete and
is currently just initial work needed to get function symbol names to appear in native callstack that includes managed functions.
Described functions does not include parameters, local variables or line info at the moment, but could be extended in the future.

Fix also make sure linker will emit PDB files including information that can be picked up by debuggers. It is possible to disable
codeview info by passing "nodebug" to AOT compiler, this will also disable the generation of PDB files, if a DLL would have been build.
2017-10-06 17:16:18 +02:00
lateralusX 925c2dc632 Adding native unwind info support in Windows x64 full AOT builds.
Emit needed sections when building Windows x64 full AOT targeting Clang for MS codegen in order for linker to
include entries in process unwind tables for full AOT:ed managed functions and trampolines. Implementation also includes
a cache used to minimize the number of duplicated unwind data section in each object file, reducing final image size.
2017-10-06 17:16:17 +02:00
Marek Safar 72c86fe6cc [corlib] Makes GetReferencedAssemblies test more reliable 2017-10-06 16:09:00 +02:00
Marek Safar f0ce7bc289 Merge pull request #5327 from marek-safar/corefx-bump
Bump corefx
2017-10-06 12:07:58 +02:00
Alexander Kyte 410bb8a57e [runtime] Fix Empty generic enumerator equality
On the CLR, two enumerators containing zero elements will
have reference equality if they are inflated with the same
generic type.

If comparing two enumerators which are not inflated (Array.Empty, for
instance), they are not equal when they contain zero elements.

This reference equality behavior is not compatible with treating
the enumerators as structs, as value types will not have reference
equality.
2017-10-06 11:35:17 +02:00
monojenkins f165a0dc3f Bump API snapshot submodule 2017-10-06 06:45:43 +00:00
Rolf Bjarne Kvinge 74a87af7f5 [appletls] Trust SecTrustResult.Proceed as well. Fixes #58411.
Apple states clearly in their documentation about SecTrustResult.Proceed [1]:

    The user explicitly chose to trust a certificate in the chain (usually by
    clicking a button in a certificate trust panel).

    Your app should trust the chain.

This fixes bug #[58411][2], where SecTrustEvaluate returns
SecTrustResult.Proceed starting with iOS 11.

[1]: https://developer.apple.com/documentation/security/1394363-sectrustevaluate
[2]: https://bugzilla.xamarin.com/show_bug.cgi?id=58411
2017-10-05 23:43:34 +02:00
Aleksey Kliger (λgeek) a984f20e23 Initial set of Ward sgen annotations (#5705)
* [ward] Expand MONO_PERMIT to empty string when not running Ward
  See https://github.com/evincarofautumn/Ward#annotating-your-code for the Ward
  permissions syntax
* sgen_gc_locked
* sgen_world_stopped
* sgen_lock_gc
* sgen_stop_world
2017-10-05 17:31:11 -04:00
Marek Safar 411a37af27 Bump corefx 2017-10-05 22:43:54 +02:00
Marek Safar 3e9d7d6e9c [mcs] Fixes codegen for pattern probing with value-type variables 2017-10-05 22:42:07 +02:00
Zoltan Varga caa9ed689f [aot] Don't error out if a method fails to JIT in full-aot mode. This was a regression caused by 9302c31f81. Fixes #59832. (#5686) 2017-10-05 17:54:16 +02:00
Zoltan Varga baac94e4b7 [runtime] Coverage profiler fixes (#5698)
* [runtime] Avoid collecting coverage data for wrappers.

* [runtime] Return sensible information for methods which have no coverage info in mono_profiler_get_coverage_data ().

* [profiler] Emit coverage info for uncovered methods as well.
2017-10-05 17:15:36 +02:00
Marek Safar 44e0631618 [corlib] Fixes array enumerator to match .net behaviour 2017-10-05 16:51:56 +02:00
Zoltan Varga 012f861023 [jit] In native-to-managed wrappers, emit the initlocals code for vtypes after the code for CEE_JIT_ATTACH, since the init code can make calls to methods like memset () which can go through the trampoline code. Fixes #59182. (#5678) 2017-10-05 14:10:20 +02:00
Alexander Köplinger b2a11ac756 Add new profile for monodroid tools (#5699)
* Add new profile for monodroid tools

This allows the XA build to use these instead of needing to build net_4_x.
We build the assemblies against the .NET 4.6 reference assemblies.

* Skip monodroid_tools in verify (aka mcs-compileall)

Exclude it from the test_profiles since running tests makes no sense there.

Also refactor to exclude binary_reference_assemblies as well,
it was already excluded manually in mcs-compileall before.
2017-10-05 02:37:24 +02:00
Marek Habersack f77270c633 [monodroid] Fix Mono.Posix tests build (#5697)
TestHelper was previously excluded because the XA tests weren't built
as part of Mono but rather as part of XA test suite which included
its own version of the helper. Now, however (https://github.com/xamarin/xamarin-android/commit/e9daf5ea35709ce1bc6ba81c7c37d72d385bace2),
XA uses BCL+friends test assemblies built by Mono itself and so
we need to restore TestHelper in the build.
2017-10-04 19:18:32 +02:00
Marek Safar 135dbb9c6d [mcs] Allows shadowing of probing pattern variables 2017-10-04 14:49:36 +02:00
Alexander Köplinger b683b3dc74 [System] Ignore FtpWebRequestTest.DownloadFile2_v6 test when IPv6 isn't available (#5695)
It fails on some systems otherwise. The other tests already had this check.
2017-10-04 11:51:48 +02:00
Johan Lorensson dbf70d1083 Merge pull request #5693 from lateralusX/lateralusX/disable-stack-overflow-win-x64
[Windows] Temporary disable none-working stack overflow implementation on Windows x64 full AOT.
2017-10-04 10:21:02 +02:00
Zoltan Varga f0f4a22ae1 [coverage-profiler] Collect coverage data at IL seq point locations. (#5667)
* [coverage-profiler] Collect coverage data at IL seq point locations.

* [coverage-profiler] Emit IL offsets instead of offsets between IL offsets. Bump format version.
2017-10-04 08:34:31 +02:00
Johan Lorensson f86145e558 Merge pull request #5664 from lateralusX/lateralusX/mkbundle-windows-toolchains
[Windows] Major improvement of Visual Studio toolchain and Windows SDK support in mkbundle.
2017-10-04 08:22:29 +02:00
Ludovic Henry d7c22488d7 Bump version to 5.9.0 (#5692) 2017-10-03 22:52:32 +02:00
Marek Habersack ef7a4c0620 Prepare Mono for Android NDK with unified headers (#5680)
Up until NDK release 14 Android SDK included a separate set of C header
files for each supported platform. NDK 14 introduced a new set of those
headers (they are NOT the same as the old ones) which unifies support
for all of the platforms so that bug fixes are available for all the
API levels without having to backport etc. With NDK 15 the unified headers
become the default ones (including when creating standalone toolchains)
and with NDK 16 (in beta currently) the old per-platform headers are removed.

Unfortunately, the new headers introduce breaking changes which made it
impossible to build Mono with NDK configured to use them. This commit makes
a handful of changes to Mono which make it build with unified headers.
2017-10-03 20:17:26 +02:00
Marek Safar 4f673eac74 [System.Net.Http] Updates range check from 3741d16503 2017-10-03 18:32:59 +02:00
Vlad Brezae 66205238fc Merge pull request #5636 from BrzVlad/fix-xmm-scan
[sgen] Scan simd registers on linux amd64 + apple arm64
2017-10-03 18:51:20 +03:00
Marek Safar 1004d95b6b [mcs] Implements C# 7.2 readonly structs 2017-10-03 17:01:58 +02:00
lateralusX 4db06151be Disable none-working stack overflow implementation on Windows x64 full AOT.
Temporary disable stack overflow implementation on Windows x64 full AOT until
we have a proper fix for:

https://bugzilla.xamarin.com/show_bug.cgi?id=59913
2017-10-03 17:01:43 +02:00
Ludovic Henry 1bcf21e048 [w32file] Push win32 specific error to win32 specific implementation (#5665)
ERROR_SHARING_VIOLATION can only happen on win32, so pushing the code to deal with this error to w32file-win32.c file.
2017-10-03 10:38:09 -04:00
Marek Safar abcca89bd4 [mcs] Adds minor langversion support 2017-10-03 15:24:12 +02:00
Johan Lorensson 56247cecbd Merge pull request #5656 from lateralusX/lateralusX/dynamic-static-windows-build
[Windows] Mono build project restructure dropping .def file enabling full static and dynamic mono builds.
2017-10-03 14:20:14 +02:00
Bernhard Urban 3d47b20c62 [interp] fix using conv.u with string 2017-10-03 12:17:44 +02:00
Rodrigo Kumpera 3aeeae6230 [jit] Fix using conv.u with string. 2017-10-03 12:17:44 +02:00
Marek Safar adaf7fd65b [mcs] Allow properties and indexers of by-ref values to be set without setter 2017-10-03 11:23:18 +02:00
Zoltan Varga 9369ed6e23 [runtime] Store implmap_idx as a guint32 to avoid overflows if the implmap table has more than 64k rows. Fixes #59881. 2017-10-03 10:40:26 +02:00
lateralusX 199d4da9ac Merged changes in master libmonoruntime into PR. 2017-10-03 09:26:11 +02:00
lateralusX 216b92db17 Updated with review feedback. 2017-10-03 09:20:12 +02:00
lateralusX 0f3ca07b42 Update msvc README file. 2017-10-03 09:20:11 +02:00
lateralusX 8ae01a69f2 Add missing dependency for libmini. 2017-10-03 09:20:11 +02:00
lateralusX 4c144cfacf Align libgc vcxproj with makefile. 2017-10-03 09:20:11 +02:00
lateralusX 1091bd94fd Align libgcmonosgen vcxproj with makefile. 2017-10-03 09:20:11 +02:00
lateralusX 8d22c47199 Align eglib vcxproj with makefile. 2017-10-03 09:20:11 +02:00
lateralusX 975d820a75 Align libmonoruntime vcxproj with makefile. 2017-10-03 09:20:11 +02:00
lateralusX df03eb3fac Align libmonoutils vcxproj with makefile. 2017-10-03 09:20:11 +02:00
lateralusX 6cb544f91d Fix libmini targets and filters. 2017-10-03 09:20:11 +02:00
lateralusX 17392d380c Added labels to eglib and libmonoutils. 2017-10-03 09:20:10 +02:00
lateralusX 05a3f528f7 Fix libmonoruntime targets and filters. 2017-10-03 09:20:10 +02:00
lateralusX fde8978893 Fix libmonoutils targets and filters. 2017-10-03 09:20:10 +02:00
lateralusX 43e9ddc1fc Fix eglib targets and filters. 2017-10-03 09:20:10 +02:00
lateralusX 52418d713f Drop use of def files for x86, x64 mono-2.0-sgen|boehm.dll Windows build. 2017-10-03 09:20:10 +02:00
lateralusX 52e98abd6e Restructure of mono.sln and build properties to better fix static/dynamic library support. 2017-10-03 09:20:10 +02:00
lateralusX 92576e31d2 Merge all static runtime libs into libmono-static.
Make libmono-static lib file include all needed runtime libs making it easier to
link and distribute as part of Mono SDK.

Commit also updates linking of vcxprojs in mono.sln to use merged static lib.
2017-10-03 09:12:14 +02:00
lateralusX 233bbcaaa3 Review feedback + drop VS2013 support. 2017-10-03 08:56:07 +02:00
Rodrigo Kumpera 098e88f3a8 Merge pull request #5668 from kumpera/wasm-work-p4
More WASM fixes.
2017-10-02 16:36:39 -07:00
vkargov 02a9ceaebb [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.
2017-10-03 00:16:39 +02:00
Alexander Kyte 4b2d74f1a1 [runtime] Remove overridable allocator flag 2017-10-02 16:11:29 -04:00
Alexis Christoforides edbc5c2334 Merge pull request #5675 from mono/glib-debug-symbols
Add glib to the list of packages with debugging symbols.
2017-10-02 13:46:14 -04:00
Alexander Köplinger 7751545573 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
2017-10-02 19:45:13 +02:00
Ankit Jain d8be089964 Bump NuGet.BuildTasks to get new updates and switch to dev branch (#5566) 2017-10-02 12:18:08 -04:00
Cody Russell f99b88b812 Add glib to the list of packages with debugging symbols. 2017-10-02 10:08:47 -05:00
Uri Simchoni bfc76bafbf [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.
2017-10-02 16:29:49 +02:00
Zoltan Varga 30cddad5fb [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) 2017-10-02 16:26:17 +02:00
Marek Safar 34866ac4c2 [mcs] Initial by ref returns and variables support 2017-10-02 16:23:04 +02:00
Marek Habersack 120574de19 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.
2017-10-02 16:15:45 +02:00
Hugh Bellamy 177fca4917 Fix LinearGradientMode parameter validation to match corefx (#5672) 2017-10-02 16:15:28 +02:00
lateralusX 56779410e8 Major improvement of Visual Studio toolchain and Windows SDK support in mkbundle.
Current implementation of Windows builds in mkbundle is not supporting
Visual Studio toolchains and Windows SDK's in a working way. Windows version
of mkbundle also lacked support for 64-bit builds together with a dependency on
GCC assembler etc.

This commit improves things in many different areas. The following toolchains
are intended to work together with this commit:

VS2013, VS2015, VS2017.

NOTE, default Mono SDK distribution is build targeting VS2015/VS2017 and static
version of libmono-static.lib won’t work with VS2013. If static use case is needed
with VS2013, a custom build mono under VS2013 must be used.  Dynamic use case is
working as expected for all three versions.

The commit also improves the support for Cygwin GCC compatible toolchains on Windows.

The commit adds support to use installed versions of both Windows 8.1 as well
as Windows 10 SDK's together with all above VS toolchains.

The commit extends support to include 64-bit mkbundle builds (using all supported
Windows toolchains). The target is decided based on mkbundle process type, 32-bit
mono builds 32-bit bundle and 64-bit mono builds 64-bit bundle.

mkbundle might still need to have a working GCC as.exe when running, but this commit
also adds support for Clang for VS CodeGen as assembler available in VS2015 Update3
and VS2017 (separate option in VS setup). When using this option there is no needed
for available GCC toolchains when running mkbundle on Windows.

A recommended way of running mkbundle on Windows is by using one of the targeted toolchains
development consoles. This way mkbundle will get all needed paths and installation folders
directly from the development consoles environment, matching a predefined setup.

Old mkbundle environment variables on Windows will continue to work. There are also a number
of new variables that can be set (or are set by the VS development consoles). The important ones
are:

VisualStudioVersion: set to pick a specific VS version, like 12.0, 14.0 or 15.0. If a none existing
version is specified, mkbundle will fallback to latest installed version.

WindowsSdkVersion: set to pick a specific Windows SDK version, like 8.1, 10.0.10240.0, 10.0.15063.0 etc.
If a none existing version is specified, mkbundle will fallback to latest installed version.

AS: If Clang for VS CodeGen is not installed this must point to a working as.exe assembler.

MONOPREFIX: set to pick a custom Mono SDK install root directory (need to match the architecture of mkbundle
process running). If not set, mkbundle will look for installed Mono SDK’s matching targeted architecture.

MONOLIB: if a different library name is used, it can be specified here. It is also possible to add an absolute
path to the mono library used in linking. NOTE, correct library needs to be supplied for static/dynamic use cases.

INCLUDE: override all custom include path handling, normally set by VS developer consoles.

LIB: override all custom lib path handling, normally set by VS developer consoles.

VCCRT: Gives possibility to use static or dynamic C-Runtime linking. By default mkbundle will use dynamic C-Runtime
linking on Windows to be compatible with default Mono SDK distribution. If a custom build Mono
using static C-Runtime linkage is used, setting this variable to MT (default MD), will link using static
C-Runtime.

VCSUBSYSTEM: mkbundle will by default use windows subsystem. If console subsystem is preferred this variable
can be set to console.

Should resolve:

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

and partial resolves (needs https://github.com/mono/mono/pull/5656 as well):

https://bugzilla.xamarin.com/show_bug.cgi?id=57892
2017-10-02 12:50:02 +02:00
Steffen Kieß 7c6607a000 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.
2017-10-02 10:39:19 +02:00
Hugh Bellamy 5825342717 Remove invalid tests for image palettes in GdiPlusTest (#5671)
C.r. https://github.com/mono/libgdiplus/pull/112
2017-10-02 02:28:25 +02:00
Alexander Köplinger 813c1308fe [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
2017-09-30 21:51:42 +02:00
Rodrigo Kumpera 2b2fbe074a Merge pull request #5659 from kumpera/fix_59824
[runtime] Synthesize IList and IReadOnlyList for the element type of enum errays. Fixes #59824
2017-09-29 16:17:03 -07:00
Rodrigo Kumpera fe1eeb0724 [wasm] We can't free memory in wasm as it uses the malloc mmap backend. 2017-09-29 16:14:22 -07:00
Rodrigo Kumpera 22187e8df1 [wasm] Add new missing signature. 2017-09-29 15:45:00 -07:00
Rodrigo Kumpera 6f20e306e0 [wasm] Disable test that doesn't work with WASM 2017-09-29 15:44:41 -07:00
Marek Safar 3741d16503 [System.Net.Http] HttpClient timeout range checks. Fixes #25755 2017-09-29 23:45:47 +02:00
Marek Safar c6d92b9983 codeowners update 2017-09-29 13:07:19 +02:00
Ludovic Henry ab0b591ca5 [w32file] Move MonoIO.Find{First,Next,Close} to managed 2017-09-29 11:24:22 +02:00
Ludovic Henry 87b1ca3bd8 [w32file] Remove dead code 2017-09-29 11:24:22 +02:00
Aleksey Kliger 391dca5988 [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
2017-09-29 11:01:31 +02:00
Aleksey Kliger b451434168 [sre] Expect a new token for MonoArrayMethod and SignatureHelper 2017-09-29 11:01:31 +02:00
Aleksey Kliger e27b73e000 [sre] Remove MonoDynamicImage:handleref_managed field
It's now unused.
2017-09-29 11:01:31 +02:00
Aleksey Kliger 651161fa9d [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.
2017-09-29 11:01:31 +02:00
Aleksey Kliger c8627b39d1 [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.
2017-09-29 11:01:31 +02:00
Aleksey Kliger d0ad7e2df9 [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.
2017-09-29 11:01:31 +02:00
Alexander Köplinger e3685c4c9a [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.
2017-09-29 01:19:09 +02:00
Ankit Jain a17ae9ec74 [msbuild] Bump msbuild to fix test failures on wrench (#5660) 2017-09-29 00:55:07 +02:00
Rodrigo Kumpera 919a03d17d 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.
2017-09-28 18:06:02 -04:00
Rodrigo Kumpera 01df432af4 Merge pull request #5567 from kumpera/fix_59334
[runtime] Handle RuntimeWrappedException and dynamic methods. Fixes #59334
2017-09-28 16:50:07 -04:00
Rodrigo Kumpera ac1d494270 [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.
2017-09-28 13:45:54 -07:00
Rodrigo Kumpera b4e3c6b5fe [mini] Fix test compiling when running !MOBILE 2017-09-28 10:11:19 -07:00
Rodrigo Kumpera 24e97e5c52 [runtime] Fix icall signature and change comment to fixme. 2017-09-28 10:01:11 -07:00
Rodrigo Kumpera a7c9e39f0f [wasm] Implement GC support. Embedder must provide main loop pumping function request_gc_cycle. 2017-09-27 17:30:49 -07:00
Rodrigo Kumpera 45d6da52ce [runtime] Fix DISABLE_REFLECTION_EMIT build. 2017-09-27 15:06:23 -07:00
Vlad Brezae f84533a8de [amd64] Save missing register 2017-09-27 21:30:43 +03:00
Vlad Brezae c334db5e2c [arm64] Scan simd registers on apple
Fix for #50190
2017-09-27 21:30:42 +03:00
Vlad Brezae ef8bc5028e [runtime] Avoid indirection when building MonoContext on darwin 2017-09-27 21:30:42 +03:00
Vlad Brezae c889057d64 [arm64] Add the full neon regs to the context
The full regs are still not handled in the trampolines. Only the lower half is saved.
2017-09-27 21:30:40 +03:00
Vlad Brezae 161c807083 [amd64] Add XMM registers to MonoContext on linux
Fix for #50189
2017-09-27 21:27:59 +03:00
Alexander Köplinger 5728865725 [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.
2017-09-27 11:15:12 +02:00
Zoltan Varga a54603a604 [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.
2017-09-27 03:23:56 +02:00
Zoltan Varga 52b96a9233 [[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) 2017-09-27 02:08:31 +02:00
Rodrigo Kumpera 925bf36f4c [mini] Add my test suite to the list of magic type assemblies. 2017-09-26 15:03:18 -07:00
Rodrigo Kumpera 707231e1b4 [mini] Adjust some test suites to work under mobile. 2017-09-26 14:57:45 -07:00
Marius Ungureanu 98e4187cf0 [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
2017-09-26 22:34:07 +02:00
Aleksey Kliger b586119cb9 [test] Add gparam Type.IsAssignableFrom and Type.BaseType tests
Lock down .NET Framework documented behavior
2017-09-26 15:59:46 -04:00
Aleksey Kliger fa62f916a3 [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
2017-09-26 15:59:46 -04:00
Aleksey Kliger 8540b4c9fe [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.
2017-09-26 15:59:46 -04:00
Ludovic Henry 1d763c4dc6 [w32process] Fix inverted kernel and user ticks (#5641) 2017-09-26 13:51:54 -04:00
Johan Lorensson ed1884bb9b 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.
2017-09-26 13:25:23 -04:00
Alex Rønne Petersen 8c0645dab9 Merge pull request #5640 from alexrp/master
[profiler] Fix some buffer size calculations.
2017-09-26 16:38:51 +02:00
Alex Rønne Petersen 21932198d7 [profiler] Fix some buffer size calculations. 2017-09-26 13:43:28 +02:00
Ludovic Henry 2aace5b6ee [Tests] Fail with message in case symlink fails 2017-09-26 13:33:25 +02:00
Johan Lorensson f0cb764a7e Merge pull request #5433 from lateralusX/lateralusX/windows-mono-debugger-soft-hang
Fix sporadic hang in Mono.Debugger.Soft test suite on Windows.
2017-09-26 08:33:40 +02:00
Ludovic Henry 932a58ea40 [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
2017-09-25 23:05:58 -04:00
Rodrigo Kumpera 981f6d1a1f [wasm] Disable test due to emcc bug. 2017-09-25 17:37:52 -07:00
Rodrigo Kumpera 023046395b [wasm] Fix test_0_conv_i under interp. 2017-09-25 17:01:37 -07:00
Rodrigo Kumpera 7f6370f849 [mini] Fix bug categories. 2017-09-25 16:35:05 -07:00
Rodrigo Kumpera 7f5efea2d7 [wasm] Add ff signature 2017-09-25 16:33:11 -07:00
Rodrigo Kumpera 1575348f10 [interp] Don't inline empty calls that take vt arguments. 2017-09-25 16:32:51 -07:00
Rodrigo Kumpera 02155d6ceb [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.
2017-09-25 15:35:41 -07:00
Aleksey Kliger 2d7b258eb9 [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).
2017-09-25 16:57:17 -04:00
Aleksey Kliger 3cfd40ccce [class] Mark mono_class_from_generic_parameter external only
Runtime should use mono_class_from_generic_parameter_internal
2017-09-25 16:57:17 -04:00
Rodrigo Kumpera 446728b335 [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.
2017-09-25 13:23:16 -07:00
Ludovic Henry 5b681a16bd [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
2017-09-25 12:27:47 -04:00
Bernhard Urban fc6f7e7921 [ppc64] add instructions needed for builtin types 2017-09-25 18:01:15 +02:00
Bernhard Urban 499e5ea2b2 [ppc] add native type support for float 2017-09-25 18:01:15 +02:00
Bernhard Urban d295ab6618 [ppc] add native type support for integer 2017-09-25 18:01:15 +02:00
Egor Bogatov be99d5f32c Add test projects (optional) to net_4_x.sln (#5633)
* add tests to net_4_x.sln

* remove redundant string.Format
2017-09-25 16:02:36 +02:00
lateralusX 1df9fdf613 Updated with review feedback. 2017-09-25 15:41:32 +02:00
lateralusX a2f2649d60 Added file license header and updated comments. 2017-09-25 15:41:32 +02:00
lateralusX f94c5b8d8f Fixed typo in call to SignalObjectAndWait. 2017-09-25 15:41:32 +02:00
lateralusX 76640001eb 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.
2017-09-25 15:41:32 +02:00
Zoltan Varga 878b260edc [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) 2017-09-23 00:44:10 +02:00
Vlad Brezae 01142a1091 Merge pull request #5594 from BrzVlad/fix-domain-abort-hang
[runtime] AppDomain fixes
2017-09-23 01:04:03 +03:00
Vlad Brezae 8b959c6a57 [tests] Add tests for AppDomainUnloadedException handling
As described on https://msdn.microsoft.com/en-us/library/system.appdomainunloadedexception(v=vs.110).aspx#Anchor_6
2017-09-22 22:14:42 +03:00
Alexander Köplinger 83bc0165f7 [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)
2017-09-22 12:13:15 +02:00
Radek Doulik a494d83eff [linker-analyzer] added documentation 2017-09-22 10:28:45 +02:00
Vlad Brezae 6eef0e52df [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.
2017-09-22 11:08:50 +03:00
Vlad Brezae b2cf114902 [runtime] Don't terminate application on unhandled AppDomainUnloadedException
Except for threads started by unmanaged code (like the main thread).
2017-09-22 11:08:50 +03:00
Vlad Brezae 5c4a14a9e2 [runtime] Throw DomainUnloadedException exception when aborting appdomain thread
Before we were propagating the abort exception down in the calling domain.
2017-09-22 11:08:50 +03:00
Vlad Brezae ba77af38ed [remoting] Refactor xdispatch wrapper to use icall for exception conversion 2017-09-22 11:08:49 +03:00
Vlad Brezae 20eef073b5 [runtime] Ignore ResetAbort when the current appdomain is unloading
Fixes #5804
2017-09-22 11:08:49 +03:00
Alexis Christoforides aae84ac64b Merge pull request #5620 from mono/bump-bockbuild
Bump bockbuild to get gtk Japanese IME fixes
2017-09-21 16:18:01 -04:00
Cody Russell bd45f9846a Bump bockbuild to get gtk Japanese IME fixes 2017-09-21 10:56:53 -05:00
Alexis Christoforides 9a46a6d946 Merge pull request #5608 from mono/xcode9_bockbuild_fix
Update bockbuild for XCode 9 build fix
2017-09-21 11:30:29 -04:00
Ludovic Henry 96ace09a50 [threads] Keep the tid after the thread has finished (#5615) 2017-09-21 09:03:18 -04:00
Alex Rønne Petersen 50e2ecc773 Merge pull request #5614 from alexrp/master
[runtime] Fix shared-only build.
2017-09-21 14:21:33 +02:00
Armin Hasitzka 5d97d9b6c9 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
2017-09-21 14:04:33 +02:00
Egor Bogatov ccb1921b7b [corlib] Fix 44255: Inconsistent results in the serialization of TimeZoneInfo. (#5576) 2017-09-21 07:57:35 +02:00
Rolf Bjarne Kvinge e90147646f [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
2017-09-21 07:25:20 +02:00
Alex Rønne Petersen 917eb0586c [runtime] Fix shared-only build. 2017-09-20 22:17:43 +02:00
Armin Hasitzka 5b483a6820 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.
2017-09-20 22:01:03 +02:00
Armin Hasitzka c7e322d704 [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.
2017-09-20 21:51:18 +02:00
Alex Rønne Petersen 700b4be883 Merge pull request #5610 from alexrp/master
[Mono.Profiler.Log] Some performance improvements.
2017-09-20 18:57:16 +02:00
EgorBo d0c98fab56 fix for DSA 2017-09-20 14:34:13 +02:00
Egor Bogatov d0cf2c890a fix-38054 2017-09-20 14:34:13 +02:00
Alex Rønne Petersen 4e608fb8f2 [Mono.Profiler.Log] Use null references to indicate the absence of names. 2017-09-20 14:33:46 +02:00
Alex Rønne Petersen a6aa45cc94 [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.
2017-09-20 14:32:07 +02:00
Alex Rønne Petersen dcbbe94d4e [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...
2017-09-20 14:17:26 +02:00
Alex Rønne Petersen ef2f4f2de2 Merge pull request #5528 from rodrmoya/fix-mono-profiler-lib
[Mono.Profiler.Log] Support MLPD version 13
2017-09-20 00:06:16 +02:00
Rodrigo Moya b6bfa9f26d [Mono.Profiler.Log] Styling fixes 2017-09-19 20:29:55 +02:00
Alexis Christoforides 7a86a5f22f Update bockbuild for XCode 9 build fix 2017-09-19 13:15:07 -04:00
Rodrigo Kumpera 470b6bb77d [verifier] Allow byref in PropertySig blobs. Fixes #59180 2017-09-19 13:54:28 +02:00
Alexander Köplinger 8d17a32927 [WindowsBase] Fix exception type in *ValueSerializer.ConvertFromString with null parameter
ArgumentNullException was introduced by https://github.com/mono/mono/pull/5593
but it should be NotSupportedException instead to match with Windows .NET.

Similar change to what was noticed during review of https://github.com/mono/mono/pull/5343#discussion_r132166426.
2017-09-19 10:58:58 +02:00
Alexander Köplinger 8efc784bd9 [WindowsBase] Use InvariantCulture for ConvertTo/ToString tests
They'd fail on locales such as de-DE before which uses ';' as separator.
2017-09-19 10:58:58 +02:00
Johan Lorensson 6e2db26f5e Merge pull request #5573 from lateralusX/lateralusX/windows-invalid-socket-error
Fix sporadic failures in MonoTests.System.Net.HttpRequestStreamTest on x64 Windows.
2017-09-19 08:40:04 +02:00
Marek Safar 7cec5b7123 Merge pull request #5589 from marek-safar/tests
Update tests network helper to be reliable in multi-threaded tests
2017-09-19 08:25:45 +02:00
Bernhard Urban 44fee4ff97 [w32error] Add ENXIO -> ERROR_DEV_NOT_EXIST error translation
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=58738
2017-09-18 21:01:05 +02:00
Marek Safar 842a983bed [System.Runtime.Remoting] Adds System.Core reference for tests 2017-09-18 19:28:07 +02:00
Marek Safar eaea54ed54 Update tests network helper to be reliable in multi-threaded tests 2017-09-18 19:10:00 +02:00
monojenkins 1e3585a07b [msvc] Update csproj files (#5602) 2017-09-18 17:39:55 +02:00
Mikhail Filippov f74ecea14e Multi-culture implementation ValueSerializers, Parse and ToString for types from WindowsBase. (#5593) 2017-09-18 16:56:44 +02:00
Armin Hasitzka afe5ec7ce1 [CI] Update Clang's ThreadSanitizer blacklist (#5558)
* Update clang-thread-sanitizer-blacklist based on races that can occur with commit 20bbf32086

* Add functions that came up in:
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/23/
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/24/
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/25/
- https://jenkins.mono-project.com/job/test-mono-pull-request-clang-sanitizer/26/
2017-09-18 15:31:09 +02:00
Jason Imison f3e9c849be Install Microsoft.FSharp.NetSdk.props and targets (#5581)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57771
2017-09-18 15:30:37 +02:00
Rolf Bjarne Kvinge b387155197 [mono-api-html] Add solution.
It makes running mono-api-html from an IDE easier.
2017-09-18 15:09:07 +02:00
Zoltan Varga 7348e275ff [llvm] Map byref types to the same type as the this argument so they are called using the same signature if the this argument is passed explicitly. Fixes #59436. (#5572) 2017-09-16 03:44:05 -04:00
Aleksey Kliger (λgeek) e88f9c11f1 [loader] Init MonoClass:sizes.element_size lazily (Fixes #43563) (#5559)
* [loader] If signaling recursive type initialize, don't double free

If we detect that a recursive type initialization is happening, we should leave
without removing the class from the init_pending_tld_id list.  Otherwise we get
a double-free when the outer recursive call finally finishes and tries to
remove the same element.

Also re-load the init_list from TLS since a recursive call to mono_class_init could
have modified it between the time the current mono_class_init call started and
when it is finishing.

* [loader] Improve error message when a field's type is a failed class

Add the class failure to the field failure error message.

* [tests] Check that runtime can represent recursive structs

Regression tests for https://bugzilla.xamarin.com/show_bug.cgi?id=43563

* [loader] Init MonoClass:sizes.element_size lazily (Fixes #43563)

Originally mono_bounded_array_class_get () would populate
MonoClass:sizes.element_size as soon as the MonoClass for the array was needed.
This is a problem because we cannot call mono_class_array_element_size () on
the element class on a valuetype until mono_class_layout_fields () finishes
initializing it.

That means that structs which contain an array of themselves would hit the
recursive initialization check in mono_class_setup_fields and the MonoClass for
the element class would be marked as failed to load.

Instead we rely on the MonoClass:size_inited bit to tell us whether the array
class has been initialized and if not, we set the array element size in
mono_class_layout_fields.

This is possible because MonoClass:sizes.element_size is only really needed to
know how to allocate space for an array.  When laying out a class that contains
an array we don't need the element size - they array is just a reference type.

Example:
```csharp
struct S {
    static S[][] foo;
}
```

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=43563
2017-09-15 18:32:04 -04:00
Bernhard Urban 99f2c2a103 [interp] disable assemblyresolve_event6.exe
needs working appdomains in the interpreter.
2017-09-15 19:33:46 +02:00
Ankit Jain cdcfd715f8 [msbuild] Bump to get workaround for bxc #55697 . (#5591)
https://github.com/mono/msbuild/commit/8b76a1d2b9ffc493349a861962e44540ea14eaac
2017-09-15 10:06:48 -04:00
Eberhard Beilharz 66b85dc9ad [SWF] Allow to compile without X11 installed (Xamarin-59496)
This change fixes a crash we get in resgen when building without
X11 installed. The bug got introduced when fixing Xamarin-395.

Change-Id: If81a4a3ca4db7a1b0156480ad49bd61610ecebf0
2017-09-15 10:33:22 +02:00
lateralusX 5205fc9ff3 Update filters for new files added to Visual Studio projects. 2017-09-15 09:39:02 +02:00
monojenkins 9300c086e0 Bump API snapshot submodule 2017-09-14 23:11:23 +02:00
Martin Baulig 56c2802ff9 [System]: SslStream.Flush() now flushes the underlying stream. Bug #57528. (#5569)
* Mono.Security.Interface.IMonoSslStream: removed Flush().

* Mono.Net.Security.MobileAuthenticatedStream: Flush() now calls `InnerStream.Flush ()'.

* System.Net.Security.SslStream: Flush() now calls `InnerStream.Flush ()'.

* System.Net.Security.SslStream: fix `CanRead`, `CanWrite` and `CanTimeout` logic.
2017-09-14 13:17:19 -04:00
Martin Baulig 002fcd5835 [Mono.Security]: Add internal 'MonoTlsProviderFactory.InternalVersion' constant. (#5568)
Internal version number (not in any way related to the TLS Version).

Used by the web-tests to check whether the current Mono contains certain
features or bug fixes.

Negative version numbers are reserved for martin work branches.
2017-09-14 13:16:13 -04:00
Rodrigo Moya de1633042b [Mono.Profiler.Log] Check MLPD version when reading header
Right now, when reading a MLPD of an old version, it just silently fails, so
throw an exception when the version is unsuported.
2017-09-14 12:49:27 +02:00
Rodrigo Moya 1616de091b [Mono.Profiler.Log] Reverse managed backtrace in SampleHitEvent's
This comes in reverse order, compared to other backtraces in the MLPD, so
reverse it before sending it to visitors, so that it comes in the same
format as the rest of backtraces.
2017-09-14 12:49:22 +02:00
lateralusX 110b6f1617 Invalid handle exception during WSACleanup on shutdown.
Running the MonoTests.System.Net.HttpRequestStreamTest under debugger reveals this
problem. WSACleanup is freeing an invalid handle as part of network shutdown.

This happens since mono_w32socket_close calls incorrect win32 API when closing sockets.
It currently calls CloseHandle, while it should call closesocket. This probably cause
problems in winsock book keeping of active sockets, and when closing the network layer,
winsock will try to close handles that it still open, but since the handles have already been closed
by incorrect call to CloseHandle, it will close an “invalid handle” either causing the exception
or even worse, close a different handle currently in use, causing undefined behavior
during the rest of mono shutdown.

Fix is to switch to correct API when closing sockets on Windows, closesocket instread of CloseHandle.
2017-09-14 11:20:27 +02:00
lateralusX d378fc8ede Fix sporadic failures in MonoTests.System.Net.HttpRequestStreamTest on x64 Windows.
MonoTests.System.Net.HttpRequestStreamTest suite has sporadic failures on Windows x64
with following exception:

System.Net.Sockets.SocketException : An operation was attempted on something that is not a socket.

This happens due to a data type and constant size mismatch. w32socket.h defines
INVALID_SOCKET and SOCKET_ERROR for all platforms. On Windows x64, SOCKET is defined
by winsock2.h as 64-bit type as well as INVALID_SOCKET constant, but above code will
define INVALID_SOCKET as a 32-bit constant value. This will in turn cause code to sporadically
fail to detect invalid sockets as returned by win32 API's. This will in turn cause the socket
exception when code continues to use socket as argument to win32 socket API’s.

Current “invalid” x64 codegen for expression:

if (sock == INVALID_SOCKET)

mov         eax,0FFFFFFFFh
cmp         rsi,rax

and with fixed defines, correct 64-bit cmp instruction:

cmp         rsi,0FFFFFFFFFFFFFFFFh

Fix makes sure we get the defines of INVALID_SOCKET and SOCKET_ERROR from winsock2.h
on Windows platforms to be consistent with define of SOCKET type.
2017-09-14 11:06:38 +02:00
Jon Purdy 47b285eac9 Fix bug 4786 test.
The fix in #5501 had a scoping error causing `make check` to fail.
2017-09-13 22:53:38 -07:00
Rodrigo Moya 05bd5d3004 [Mono.Profiler.Log] Support MLPD version 13
The differences from v14 are small, and given it is the current "stable"
MLPD version, it's worth supporting it. The differences are:

* ImagePointer field not present in v13 Assembly*Event's
* In MonitorEvent, LogMonitorEvent is not in a separate field, but included
  as a flag in the extType field.
* SampleHitEvent's have a type field in v13, which was removed in v14, because
  only cycles samples are emitted.
* MONO_GC_EVENT_{MARK,RECLAIM}_{START,END} were removed in v14
* SampleUnmanagedBinary's SegmentPointer is not based on ptr_base in v13
* In v13, HeapRootsEvent's Attributes is (wrongly) a byte, in v14 this was
  fixed and changed back to a uleb128
2017-09-14 01:20:13 +02:00
Alex Rønne Petersen 2709ca7625 Merge pull request #5562 from alexrp/master
[profiler] Revert the root_type field back to uleb128.
2017-09-13 21:49:08 +02:00
Rodrigo Kumpera be9821f888 Merge pull request #5550 from Cry-Miron/patch-1
Fix issue where loaded global modules aren't freed
2017-09-13 13:07:34 -04:00
Marek Safar c13138725d Bump ikdasm 2017-09-13 13:44:01 +02:00
Marek Safar 3d7573adce [corlib] Update negative symbol for all cultures. Fixes #57496 2017-09-13 11:30:17 +02:00
Cry-Miron 4b51f5d3ed Changed indentation to K&R indentation 2017-09-13 10:44:59 +02:00
Alex Rønne Petersen e7a5358094 [Mono.Profiler.Log] Read root type field as uleb128. 2017-09-13 09:17:45 +02:00
Alex Rønne Petersen 0c5291144f [profiler] Revert the root_type field back to uleb128.
It's actually a 32-bit value.
2017-09-13 09:16:40 +02:00
Rodrigo Kumpera f79c0b5c03 [wasm] Disable tests that crashes the runtime for now 2017-09-12 16:12:58 -07:00
Rodrigo Kumpera fb48a088ce [wasm] Don't try mini_get_delegate_arg if the interpreter is in use. 2017-09-12 16:11:32 -07:00
Rodrigo Kumpera 3e268fb9de Merge pull request #5544 from kumpera/verify_byref_return
Implement verification of safe byref returns
2017-09-12 17:13:56 -04:00
Ankit Jain 2b15ada1a1 [msbuild] Bump msbuild to pick up SDK updates (#5548) 2017-09-12 16:44:48 -04:00
Rodrigo Kumpera 77fb4aee81 [wasm] Add one more wasm_invoke entry. 2017-09-12 13:12:06 -07:00
Rodrigo Kumpera 04cbe795fa [interp] Add some error handling to the interpreter 2017-09-12 13:04:46 -07:00
Alexander Kyte 260ce80d70 [runtime] Use no-op for SufficientExecutionStack on Linux (#5543)
We had previously responded to bad performance on android by stubbing out
ves_icall_System_Runtime_CompilerServices_RuntimeHelpers_SufficientExecutionStack
on android. This was necessary because the call to pthread_attr_getstack ()
will read /proc/self/maps. When used inside of a hot function, the performance is terrible.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58911
2017-09-12 15:46:18 -04:00
Rodrigo Kumpera 2cfc55117a [wasm] Don't use capture_context fast path that requires function tramps. 2017-09-12 11:52:50 -07:00
Rodrigo Kumpera f59b99f22c [mini] Add MONO_ prefix to RETURN_ADDRESS macro. 2017-09-12 11:12:08 -07:00
Rodrigo Kumpera 41be53b107 [verifier] Add test for structs. 2017-09-12 10:39:38 -07:00
Katelyn Gadd 78e9f064e1 Fix bug 57918:
Async Socket reads that need to perform multiple underlying read operations fail to return a correct total # of bytes read
2017-09-12 10:37:39 -07:00
cherusker 20bbf32086 Mark operations on shutting_down as known and accepted data races 2017-09-12 19:25:31 +02:00
Aleksey Kliger 764a78ba45 [coop handles] Record backtrace when allocating handles when MONO_HANDLE_TRACK_OWNER is defined
A backtrace that leads to the allocation site is helpful for debugging.
2017-09-12 13:11:20 -04:00
Aleksey Kliger 278f533546 [appdomain] Catch exceptions when invoking AppDomain.DoAssemblyResolve
Otherwise we may leak a coop handle for the requesting assembly, which may
lead to an assertion when we unload the current domain.
2017-09-12 13:11:20 -04:00
Aleksey Kliger 698f6e6f2f [test] Regression test for #58950
If a reflection only assembly resolve event handler throws an exception, catch
the exception in the runtime to ensure that no coop handles leak.
2017-09-12 13:11:20 -04:00
Cry-Miron e0fd280828 Fix assert in module cleanup if nothing is cached 2017-09-12 15:28:34 +02:00
Cry-Miron 5a26d60113 Fix issue where loaded global modules aren't freed
Globally loaded modules would previously call LoadLibrary on Windows, but never FreeLibrary. This would result in said library keeping an internal reference counter of 1 until the application exited its entry-point, resulting in possible shutdown issues.

This commit makes sure that we correctly free modules (and unload them in the platform-specific APIs) whenever Mono itself is shutting down, ensuring the expected result of Mono-loaded libraries being correctly freed.
2017-09-12 11:45:03 +02:00
Rodrigo Kumpera b46e9cf985 [verifier] Fail to merge stacks with different safe byref'ness. 2017-09-11 16:35:54 -07:00
Rodrigo Kumpera 8493513ad3 [verifier] Implement verification of byref returns.
The verification algorithm is inspired on internal specs by the Roslyn team but adapted to what it generates today.
Here's how this patch works:

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

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

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

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

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

This algorithm makes sure we don't mix safe and unsafe byref and side with safety in case of control-flow dependent values.
2017-09-11 15:53:14 -07:00
Jonathan Chambers 4a20e930af Implement stack overflow handling on Win64. Call _resetstkoflw to restore stack protection before calling handler, and then jump to handler via a cached MonoContext. (#5472) 2017-09-11 13:27:00 -04:00
Armin Hasitzka cf9dff4bb8 [TSan] Interlock and unlock MonoJitStats (#5437)
[TSan] Interlock and unlock MonoJitStats

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

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

More (technical) details can be found in the commit messages.
2017-09-11 16:35:03 +02:00
Alexander Köplinger 2d238eeb11 [System.Xaml] Fix deadlock on exception in XamlBackgroundReader
The ManualResetEvent wouldn't be signaled when an exception happens
in the reader loop so we'd deadlock in Read().

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

https://bugzilla.xamarin.com/show_bug.cgi?id=46683
2017-09-11 11:31:42 +02:00
Niklas Therning f98d0799d8 Merge pull request #5504 from ntherning/wait-for-native-thread-to-die-in-Thread-Join
Wait for the native thread to die in Thread.Join() on Windows
2017-09-11 11:07:53 +02:00
Bernhard Urban 5a758bd714 Update CONTRIBUTING.md (#5542) 2017-09-11 10:59:14 +02:00
Jason Imison d7609da34c [F#] Reinstate _DebugFileExt as it's needed for mobile debugging. (#5534)
Also added a mechanism for users to override DebugType
2017-09-09 00:07:07 +02:00
Rodrigo Kumpera 098f6e8aa8 Merge pull request #5428 from kumpera/wasm-support-p2
Mono Wasm support
2017-09-08 14:55:38 -04:00
Ludovic Henry d96de323da [threads] Fix "[threads] Fix leaking threads: SGen Worker and Finalizer (#5284)" (#5532)
* Revert "[threads] Fix leaking threads: SGen Worker and Finalizer (#5284)"

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

This reverts commit 7db0fb0c88.

* [threads] Make sure we do not leak the finalizer and sgen threadpool threads
2017-09-08 14:07:00 -04:00
Jason Imison 65106878d5 F# portable debugging (#5531)
* Switch F# builds over to portable pdb

* Add portable pdb metadata fix from https://github.com/Microsoft/visualfsharp/pull/3553
2017-09-08 14:38:29 +02:00
Manuel de la Pena a09b912b86 [Tests] Fix Mono.Data.Tds tests on iOS (#5501)
* [Tests] Fix Mono.Data.Tds tests on iOS

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

* Close Listener when done.
2017-09-08 13:05:48 +02:00
Armin Hasitzka 91149fb1e5 [TSan] Tackle MonoPerfCounters (#5413)
[TSan] Tackle MonoPerfCounters

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

Furthermore, a few details:

* updated all fields to signed types as `Interlocked* ()` functions exist for these types already
* upgraded a few values to `64-bit` as other `64-bit` values are assigned to them
* fixed a few `FIXME`s in `predef_writable_update ()` that were connected to `Interlocked* ()` functions
2017-09-08 11:20:28 +02:00
Miguel de Icaza bbb0a58f15 Update man page 2017-09-08 07:22:45 +02:00
Miguel de Icaza eefe01a655 Shorter 2017-09-08 07:22:45 +02:00
Miguel de Icaza 7d68dc8e71 Toggle the turbo button 2017-09-08 07:22:45 +02:00
Miguel de Icaza 0253b65888 Remove lingering bits from removed prj2make tool (#5526) 2017-09-07 23:57:53 +02:00
Marek Safar 443c85784f Bump Roslyn 2017-09-07 17:45:34 +02:00
monojenkins 4f3dde8e57 [msvc] Update csproj files (#5524) 2017-09-07 17:42:30 +02:00
Armin Hasitzka 5d36f305a5 Use Unlocked* () to mark racy counters (#5500)
[TSan] Mark racy counters in metadata.c

- using `gint32` instead of `int` should not be an issue
- `img_set_count` is interlocked by `image_sets_lock ()` - `UnlockedIncrement ()` is just used for completeness / documentation
- `++img_set_cache_(hit|miss)` is called quite often and is connected to caching: it seems to me as if interlocking these counters would be a bad idea (at least for cache hits)
2017-09-07 14:50:49 +02:00
Armin Hasitzka 7db0fb0c88 [threads] Fix leaking threads: SGen Worker and Finalizer (#5284)
* Fix leaking threads: SGen Worker and Finalizer
- https://bugzilla.xamarin.com/show_bug.cgi?id=58317
- stop SGen workers before the finalizer stops
- clean up SGen workers with the Finalizer
- remove `mono_thread_join (GUINT_TO_POINTER (gc_thread->tid));` as we detach the Finalizer with `mono_threads_join_threads ()` within `mono_gc_cleanup ()`

* [fixup!] Move counting variable into the loop initialiser and add a `(gpointer)` cast
2017-09-07 12:23:07 +02:00
Armin Hasitzka bcf0ad5860 [TSan] Reorganise / clean up counters logic in mini-generic-sharing.c (#5502)
* Reorganise counters:
- use `Interlocked* ()` and `Unlocked* ()` to fix / mark (possible) races
- change the initialisation location and the visbility of some counters
- fix a few typos

* Extend the warning when re-registering counters

* also print counter address if we have a duplicate
2017-09-07 12:19:23 +02:00
Marek Safar 5b22c773bd Updates for CODEOWNERS 2017-09-07 11:49:21 +02:00
Alexander Köplinger 9864e28ebc Update reference-assemblies (#5519) 2017-09-07 11:24:35 +02:00
Marek Safar d76f8cf1cd Bump roslyn to 2.3.2 2017-09-07 10:12:46 +02:00
Alex Rønne Petersen 645a261f9a Merge pull request #5512 from rodrmoya/fix-mono-profiler-lib
[Mono.Profiler.Log] Initialize LogEvent's properties
2017-09-07 01:01:57 +02:00
Rodrigo Moya daf47bd258 [Mono.Profiler.Log] Initialize LogEvent's properties
Make sure all events have all fields initialized. This was missing setting
Buffer and Timestamp properties when creating the different LogEvent* subclasses.
2017-09-06 22:37:43 +02:00
Alexander Köplinger a243301ee4 [WinForms/Drawing] Remove some leftover test scripts (#5518)
They're no longer used.
2017-09-06 22:24:07 +02:00
Martin Baulig 2f61cd998f [Mono.Security]: Remove some unused Mono.Security.Interface classes. (#5509)
* [Mono.Security]: Remove some unused `Mono.Security.Interface` classes.

* Mono.Security.Interface: removed `IBufferOffsetSize` and `BufferOffsetSize`
  (these were not general-purpose BOS APIs, but depend on the internal
  `SecretParameters` class).

* Mono.Security.Interface: removed `SecretParameters`, `SecureBuffer`,
  `IMonoTlsEventSink`, `TlsBuffer` and `TlsMultiBuffer`.

* Bump API snapshot submodule
2017-09-06 20:56:11 +02:00
Bernhard Urban 79e94c43dc [amd64] fix tailcall insn size (#5483)
commit
https://github.com/mono/mono/commit/9a634c1810aad46d30a674f3a97ab263dcd4272e
introduces a regression for
https://github.com/mono/coreclr/blob/mono/tests/src/JIT/Methodical/Invoke/25params/25param1c.il

```
Testing method of 25 parameters, all of int data type, tail.call
mono-sgen(46435,0x7fff9d34b3c0) malloc: *** error for object 0x101045400: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Process 46435 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x00007fff945c915f libsystem_malloc.dylib`malloc_error_break
libsystem_malloc.dylib`malloc_error_break:
->  0x7fff945c915f <+0>: pushq  %rbp
    0x7fff945c9160 <+1>: movq   %rsp, %rbp
    0x7fff945c9163 <+4>: nop
    0x7fff945c9164 <+5>: nopl   (%rax)
(lldb) mbt
* thread #1
  * frame #0: 0x00007fff945c915f libsystem_malloc.dylib`malloc_error_break
    frame #1: 0x00007fff945c5e81 libsystem_malloc.dylib`szone_error + 406
    frame #2: 0x00007fff945c7925 libsystem_malloc.dylib`small_free_list_remove_ptr_no_clear + 766
    frame #3: 0x00007fff945c7cb2 libsystem_malloc.dylib`free_small + 881
    frame #4: 0x00000001004d2110 mono-sgen`monoeg_g_free(ptr=0x0000000101083c00) at gmem.c:66
    frame #5: 0x0000000100007b64 mono-sgen`mono_codegen(cfg=0x000000010108c800) at mini.c:2300
    frame #6: 0x000000010000aedf mono-sgen`mini_method_compile(method=0x0000000100910310, opts=370239999, domain=0x000000010090ebd0, flags=JIT_FLAG_RUN_CCTORS, parts=0, aot_method_index=-1) at mini.c:3829
    frame #7: 0x000000010000edd0 mono-sgen`mono_jit_compile_method_inner(method=0x0000000100910310, target_domain=0x000000010090ebd0, opt=370239999, error=0x00007fff5fbfe048) at mini.c:4156
    frame #8: 0x000000010001459e mono-sgen`mono_jit_compile_method_with_opt(method=0x0000000100910310, opt=370239999, jit_only=0, error=0x00007fff5fbfe048) at mini-runtime.c:2127
    frame #9: 0x0000000100013e6d mono-sgen`mono_jit_compile_method(method=0x0000000100910310, error=0x00007fff5fbfe048) at mini-runtime.c:2173
    frame #10: 0x0000000100131eea mono-sgen`common_call_trampoline(regs=0x00007fff5fbfe128, code="H\x8bй\x01", m=0x0000000100910310, vt=0x0000000000000000, vtable_slot=0x0000000000000000, error=0x00007fff5fbfe048) at mini-trampolines.c:704
    frame #11: 0x00000001001313b7 mono-sgen`mono_magic_trampoline(regs=0x00007fff5fbfe128, code="H\x8bй\x01", arg=0x0000000100910310, tramp="����\b\x10\x03\x91") at mini-trampolines.c:835
```

turns out we smashed our code buffer.

Also, transform this comparison:

```
if (G_UNLIKELY (offset > (cfg->code_size - max_len - EXTRA_CODE_SPACE))) {

if (G_UNLIKELY ((offset + max_len + EXTRA_CODE_SPACE) > cfg->code_size)) {
```

we deal with unsigned values here, and if `max_len` is bigger then
`cfg->code_size`, we won't resize the buffer.
2017-09-06 14:28:20 +02:00
Armin Hasitzka fc524c4756 Interlock inflated_signatures_size, memberref_sig_cache_size, methods_size and signatures_size (#5489)
[TSan] Interlocking loader.c

`loader.c` contains four statistics counters and all of them are invovled in data races. This PR focuses on dealing with them:

- All of them can be `gint32` as they are registered as `MONO_COUNTER_INT` anyways.
- Since there is already a lot of locking involved in `loader.c` (including an approved usage of `Interlocked* ()` with with `mono_stats`), I think that `Interlocked* ()` can be used here instead of `Unlocked* ()`. If this assumption is wrong, I would kindly ask to correct me by commenting the affected rows and I will change it to `Unlocked* ()`.
2017-09-06 14:16:02 +02:00
Zoltan Varga 586d10d3ab [bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of … (#5511)
* [bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of the delegate target to avoid calling user defined hash code implementations which can throw exceptions. Fixes a regression introduced by a48bc43985.

* add test for #59235

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

* [fixup] RuntimeHelpers.GetHashCode handles null
2017-09-06 13:56:37 +02:00
Zoltan Varga a78a103fcb [sdb] Don't set tls->context when interrupting a thread, it could race with the thread processing a breakpoint at the same time. Fixes #58612. 2017-09-06 13:56:02 +02:00
Neale Ferguson 1cba9d8748 Add z14 support and extend z13 support 2017-09-06 12:09:13 +02:00
Rodrigo Kumpera 0f0b9c2913 [utils] Fix inet_pton fallback. 2017-09-05 14:28:37 -07:00
Niklas Therning 95f0800520 Wait for the native thread to die in Thread.Join() on Windows
This is the behavior of .NET. After this patch the code on Mono for Windows
will make sure the underlying native thread of a managed thread has died
before Thread.Join() returns.

This PR builds on PR #5454 but makes it Windows specific. PR #5454 was
reverted since it caused crashes on some Unix platforms.
2017-09-05 11:18:59 +02:00
Vladimir Kargov 90450cc148 [ci] Add the coverage collection script. 2017-09-04 16:34:30 -07:00
Marek Safar 6a95fac6d3 More codeowners update 2017-09-04 19:20:03 +02:00
cherusker e2a86a54f1 Use Unlocked* () for operations on joinable_thread_count
- mark the (harmless) data race of the fastpath
2017-09-04 14:06:01 +02:00
cherusker 57ae02b1c5 Fix racy counter and unify the styles 2017-09-04 11:30:11 +02:00
HinTak 9cba093c63 Clarifying the usage of the --library option
I found that multiple libraries need to be specified in dependency order. That was not obvious from the man page. Make it explicit.

See https://bugzilla.xamarin.com/show_bug.cgi?id=59154
2017-09-02 00:24:40 +02:00
Alexander Köplinger 29017b48d3 [ci] Retry flaky tests only on PRs (#5492)
So we can still see failures in master and release branches.
2017-09-02 00:10:40 +02:00
Rodrigo Kumpera aaf5672018 [wasm][sgen] Introduce DEFAULT_SWEEP_MODE, move DEFAULT_MAJOR to sgen-config.h and make wasm defaults serial. 2017-09-01 14:52:55 -07:00
Rodrigo Kumpera dbf3a44282 [wasm] Wasm actually has inet_pton but configure doesn't detect it. 2017-09-01 14:52:54 -07:00
Rodrigo Kumpera 4eafc3169f [wasm] Make sure we don't use the posix dl backend with wasm 2017-09-01 14:52:54 -07:00
Rodrigo Kumpera 06fcf41eae [wasm] Disable posix threading backend and fix wasm's. 2017-09-01 14:52:53 -07:00
Rodrigo Kumpera 770ea93292 [wasm] Move RETURN_ADDRESS macros to mini.h, use them in mini-exceptions.h and add wasm version. 2017-09-01 14:52:52 -07:00
Rodrigo Kumpera 13486d308d [runtime] Replace a mono_class_vtable with mono_class_vtable_full. 2017-09-01 14:52:51 -07:00
Rodrigo Kumpera cfed4f7710 [wasm] Fix eglib issues with WASM. 2017-09-01 14:52:28 -07:00
Rodrigo Kumpera 9df8e7db13 Merge pull request #5486 from kumpera/fix_array_dispatch_perf
[mini] Handle magic interfaces in common_trampoline as if they were variant.
2017-09-01 16:50:40 -04:00
Ludovic Henry fcf0cfbe75 [mini] Remove never defined MONO_ARCH_STACK_GROWS_UP (#5491) 2017-09-01 13:49:29 -04:00
Rodrigo Kumpera e64e3dbaca [mini] Handle magic interfaces in common_trampoline as if they were variant.
With the introduction of magic array interfaces, they must be handled as if they
were variant if they are being dispatched against an array.

This was not being done in common_trampoline and resulted in the IMT thunk never
getting rebuilt and getting decent perf.

With this patch, dispatch to simple methods such as Array::Count over a magic interface
in a covariant case (such as IList<object> dispatch onto string[]) will accrue gvi's.

On a trivial benchmark of executing Count 1M times, perf goes from 760ms to 50ms.
2017-09-01 09:06:53 -07:00
Armin Hasitzka 78ef7aea9a Improve class.c for TSan instrumentation: (#5485)
- use `Unlocked* ()` for `class_gparam_count`, `classes_size` and `inflated_methods_size`
- dead code: `class_ext_size`
- fix a typo: "the the" -> "let the"
2017-09-01 09:44:25 -04:00
Zoltan Varga 55dce78066 [bockbuild] Blacklist more llvm libraries/binaries. (#5488) 2017-09-01 09:42:25 -04:00
Alexander Köplinger 8d1bacae0d [ci] Reenable xunit tests on Windows (#5487)
Should be fixed now that https://github.com/mono/mono/pull/5477 was merged.
2017-09-01 14:51:43 +02:00
Egor Bogatov bc83d048ba Merge pull request #5444 from hifi/fix-tds-inputoutput
[System] Fix TDS 7.0 prepared InputOutput parameter info
2017-09-01 11:41:49 +03:00
HinTak df92047580 mkbundle: add console confirmations of actions (#5457)
Almost all the other "maker.Add()" are accompanied by console messages, except these two. User might worry about why they are missing. (I did!)
2017-09-01 10:29:25 +02:00
HinTak 2852d49c3b Fixing another confusing typo
The file being added is the config of the last assembly read, not the runtime name.
2017-09-01 10:27:17 +02:00
EgorBo 0e0c7b33f0 update comment 2017-09-01 10:26:08 +02:00
EgorBo 3686ea4022 xunit on windows doesn't like ln to xunit.execution.desktop.dll, provide a copy 2017-09-01 10:26:08 +02:00
Aleksey Kliger 7b759ee9d3 [w32file] Add 'kbfuse' filesystem type to known drive types array.
It's the https://keybase.io desktop client filesystem
2017-08-31 18:28:47 -04:00
Ludovic Henry 078463fa1f [socket] Reduce handle manipulations in native (#5378) 2017-08-31 13:21:29 -04:00
Marek Safar 118a5c70ed Merge pull request #5479 from marek-safar/cecil-bump
Bump cecil and linker
2017-08-31 19:13:04 +02:00
monojenkins 5a25467be0 Bump API snapshot submodule 2017-08-31 17:10:57 +00:00
Alexander Köplinger 7455e7cffc Add retrying of failed tests by default to reduce flaky tests (#5461)
Whenever a test fails we retry it five times and then decide the
overall result based on that. If three or more of the five retries
fail too then the overall result is FAIL, two or lower means PASS.

We're modifying nunitlite here so this only works for those tests
right now, we'd need to add it to the other test runners too.
2017-08-31 17:04:23 +02:00
Aleksey Kliger 0eb6e77c84 [cominterop] Get function ptr from interface before switching to blocking
The cominterop_get_function_pointer icall has a wrapper which has a
trampoline.  When we enter the trampoline mono_marshal_emit_native_wrapper
already switched us to blocking.
2017-08-31 10:42:19 -04:00
Aleksey Kliger 0270871238 [marshal] Don't use a wrapper for mono_marshal_set_last_error
This fixes assertions due to d0e103fcb4 in
cooperative GC mode.

mono_marshal_set_last_error is called from a P/Invoke wrapper just after the
pinvoked method returns before we transition the thread state back to running
from blocking.  If mono_marshal_set_last_error had a wrapper, we would invoke
the trampoline (mono_magic_trampoline) to JIT the wrapper while in blocking
mode, which would trigger the assertion.
2017-08-31 10:42:19 -04:00
Zoltan Varga a7f706251b [llvm] Add support for building with more recent versions of the mono llvm branch, in particular https://github.com/mono/llvm/tree/2017-07-06-5a1ffa96376e8a3ee895b782790591e5e7814ccf, which is based on llvm 5.0. (#5474) 2017-08-31 08:51:47 -04:00
Marek Safar 5179bbe40c Bump cecil and linker 2017-08-31 14:34:11 +02:00
Zoltan Varga 1904650288 [sdb] Fix support for async debugging in optimized mode, roslyn generates valuetype IAsyncStateMethod implementations. Fixes #58728. (#5476) 2017-08-31 07:17:02 -04:00
Alexander Köplinger e7a2d94f75 [bcl] Fix a few hardcoded socket ports in tests (#5471)
* [System] Fix a few hardcoded socket ports in tests

Those could've shown up as "address already in use" in CI.

* [System.Runtime.Remoting] Fix a few hardcoded socket ports in tests

Those could've shown up as "address already in use" in CI.

Additionally remove a copy of RemotingServicesTest.cs from corlib
which also exists in System.Runtime.Remoting in updated form.

* [System.ServiceModel] Fix a few hardcoded socket ports in tests

Those could've shown up as "address already in use" in CI.

* [System.Net.Http] Fix a few hardcoded socket ports in tests

Those could've shown up as "address already in use" in CI.

The additional "keep-alive" header in Send_Complete_NoContent() and
Send_Transfer_Encoding_Chunked() is because we were using the same
port for all tests before so other tests would clear the header.
This doesn't happen now that we use distinct test ports.

* [System.ServiceModel.Web] Fix a few hardcoded socket ports in tests

Those could've shown up as "address already in use" in CI.
2017-08-31 10:53:35 +02:00
Rodrigo Kumpera 55316a442f [wasm] Hack around AC_CHECK_SIZEOF bug and don't hardcode -Os in CFLAGS 2017-08-30 16:30:36 -07:00
Alexander Köplinger 2439f17bef Revert "Merge pull request #5330 from alexanderkyte/dedup_mkbundle"
This reverts commit 9a287c0412, reversing
changes made to 4a79280b3b.

It breaks tons of tests.
2017-08-31 00:41:53 +02:00
Alexander Kyte 9a287c0412 Merge pull request #5330 from alexanderkyte/dedup_mkbundle
[runtime] Add Dedup Support to MkBundle
2017-08-30 15:59:18 -04:00
Martin Baulig 4a79280b3b [Mono.Security]: Add 'MonoTlsProvider.SupportsCleanShutdown' and 'MonoTlsSettings.SendCloseNotify'. (#5465)
Only send close_notify when using BTLS and explicitly requested via 'MonoTlsSettings.SendCloseNotify'.
2017-08-30 13:43:36 -04:00
Alexander Kyte 6f270b372a [runtime] Document mkbundle AOT options in man pages 2017-08-30 12:55:35 -04:00
Alexander Kyte 2691372e86 [runtime] Fix tracking of dedup module in mkbundle 2017-08-30 12:55:24 -04:00
Alexander Kyte 9a5b75e2ba [runtime] Add mkbundle support for dedup 2017-08-30 12:55:11 -04:00
Alexander Kyte f36b03e6f0 [runtime] Clean up temp mkbundle aot directory 2017-08-30 12:55:03 -04:00
Alexander Kyte 780ef740ed [runtime] Fix mkbundle internationalization test results, build all 2017-08-30 12:54:51 -04:00
Alexander Kyte 15332a240a [runtime] Provide config to mkbundle 2017-08-30 12:54:50 -04:00
Alexander Kyte b07d50c929 [runtime] Don't re-aot when running BCL tests 2017-08-30 12:54:49 -04:00
Alexander Kyte 3802e3de1b [runtime] Skip not supported tests with mkbundle 2017-08-30 12:54:49 -04:00
Alexander Kyte ac1ce7eb4d [runtime] Build stripper and use with mkbundle
Preliminary linker support ran into dependency-finding bug
with the monolinker.exe binary. Fix postponed until later.
2017-08-30 12:54:48 -04:00
Alexander Kyte 0b0905f4de [runtime] Add target to mkbundle all tests before CI 2017-08-30 12:54:48 -04:00
Alexander Kyte a4edbde01e [runtime] Move testing dll into profile 2017-08-30 12:54:47 -04:00
Alexander Kyte c872e0a100 [runtime] Fix in-tree building for mkbundle 2017-08-30 12:54:47 -04:00
Alexander Kyte 2c71963d23 [runtime] Skip building System.Security, System.IdentityModel tests on testing_aot_full 2017-08-30 12:53:00 -04:00
Alexander Kyte f915204116 [runtime] Use mkbundle in BCL tests 2017-08-30 12:52:51 -04:00
Alexander Kyte a7154726a3 [runtime] Fix path resolving for mkbundle 2017-08-30 12:52:42 -04:00
Alexander Kyte c7046b9e9e [runtime] Add new dedup interface to mkbundle 2017-08-30 12:52:33 -04:00
Alexander Kyte 63b369e735 [runtime] Fix mkbundle compilation on OSX 2017-08-30 12:52:23 -04:00
Alexander Kyte ca29da6e2b [runtime] Enable compiling aot with mkbundle 2017-08-30 12:52:14 -04:00
Alexander Kyte b81693d648 [runtime] Add aot arguments to mkbundle 2017-08-30 12:52:03 -04:00
Armin Hasitzka d278834cd7 Update Clang's ThreadSanitizer blacklist (#5467) 2017-08-30 12:16:20 +02:00
Alexander Köplinger 687cb5d680 Bump api-snapshot 2017-08-30 12:00:12 +02:00
Joshua Peterson ee6f89642d Call g_utf8_to_utf16 with a proper argument (#5470)
* The sizes of `glong` and `gsize` differ on 64-bit Windows.
* In order to avoid uninitialized data in the high four bytes of the `bytes` argument to `mono_unicode_from_external`, call `g_utf8_to_utf16` with a `glong`, then copy the result.
2017-08-30 05:59:57 -04:00
Marek Safar 6649f23b27 Merge pull request #5469 from marek-safar/ilasm
[ilasm] Adds AggressiveInlining support
2017-08-29 23:04:53 +02:00
Alexander Köplinger c603a69e7d Revert "[runtime] Wait for the thread to really exit in Thread.Join (). (#5454)"
This reverts commit ec30afd9dc.

It causes test failures on s390x.
2017-08-29 22:05:12 +02:00
Alexander Köplinger c05d7a78f8 Revert "[llvm] Add support for building with more recent versions of the mono llvm branch, in particular https://github.com/mono/llvm/tree/2017-07-06-5a1ffa96376e8a3ee895b782790591e5e7814ccf, which is based on llvm 5.0. (#5408)"
This reverts commit f01f854818.

It broke a bunch of tests with llvm.
2017-08-29 21:45:59 +02:00
Marek Safar 5b612c5dc5 [PEAPI] Don't add mscorlib reference when no type needs it 2017-08-29 19:51:08 +02:00
Marek Safar 50490aaa7f [ilasm] Adds noautoinherit option 2017-08-29 19:51:08 +02:00
Marek Safar 0290d19c83 [ilasm] Adds AggressiveInlining support 2017-08-29 15:51:55 +02:00
Alexander Köplinger 5479e0669f Remove leftover targets from Makefile.am (#5466)
win32getdeps and win32setup don't apply anymore.
2017-08-29 09:18:43 +02:00
Zoltan Varga f01f854818 [llvm] Add support for building with more recent versions of the mono llvm branch, in particular https://github.com/mono/llvm/tree/2017-07-06-5a1ffa96376e8a3ee895b782790591e5e7814ccf, which is based on llvm 5.0. (#5408) 2017-08-28 21:42:39 -04:00
Zoltan Varga ec30afd9dc [runtime] Wait for the thread to really exit in Thread.Join (). (#5454) 2017-08-28 21:38:29 -04:00
Zoltan Varga 1a5ddd80ed [sgen] Move the mono_gchandle_ functions to sgen-mono.c for consistency, add sgen_gchandle () functions instead. (#5460) 2017-08-28 21:37:08 -04:00
Zoltan Varga 3fc452230d [sdb] Make the IL in dtest-excfilter.il valid. (#5463) 2017-08-28 21:36:42 -04:00
Zoltan Varga 9a634c1810 [amd64] Make code patching smp safe for the case where we emit a mov + call_reg. Hopefully fixes #57959. (#5452) 2017-08-28 04:37:53 -04:00
Bernhard Urban a2cf047226 [gc counters] avoid using Interlocked*64 functions as they are broken on some arches (#5451)
They are implemented via a global lock, which can lead to deadlooks in
some situations, e.g.

```
-0  0xb6c92e14 in sigsuspend () from /lib/arm-linux-gnueabi/libc.so.6
-1  0x0043f3b4 in suspend_signal_handler (_dummy=35, info=0xb4afe6d0, context=0xb4afe750) at mono-threads-posix-signals.c:177
-2  <signal handler called>
-3  0xb6de6bc4 in __pthread_mutex_unlock_usercnt () from /lib/arm-linux-gnueabi/libpthread.so.0
-4  0x00440f00 in InterlockedCompareExchange64 (dest=0x530700 <worker+64>, exch=0, comp=0) at atomic.c:578
-5  0x002f228c in InterlockedRead64 (src=0x530700 <worker+64>) at ../../mono/utils/atomic.h:398
-6  0x002f29a0 in COUNTER_READ () at threadpool-worker-default.c:194
-7  0x002f3320 in worker_park () at threadpool-worker-default.c:426
-8  0x002f3774 in worker_thread (unused=0x0) at threadpool-worker-default.c:488
-9  0x002e66b0 in start_wrapper_internal (start_info=0x0, stack_ptr=0xb4b00000) at threads.c:982
-10 0x002e6894 in start_wrapper (data=0x5a8f38) at threads.c:1044
-11 0xb6de31a8 in start_thread () from /lib/arm-linux-gnueabi/libpthread.so.0
-12 0xb6d3a1bc in ?? () from /lib/arm-linux-gnueabi/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 4 (Thread 0xb40ff440 (LWP 10198)):
-0  0xb6deb56c in __lll_lock_wait () from /lib/arm-linux-gnueabi/libpthread.so.0
-1  0xb6de584c in pthread_mutex_lock () from /lib/arm-linux-gnueabi/libpthread.so.0
-2  0x00440e6c in InterlockedCompareExchange64 (dest=0x559868 <gc_stats+8>, exch=2855648, comp=2844091) at atomic.c:570
-3  0x0039bdcc in InterlockedAdd64 (dest=0x559868 <gc_stats+8>, add=11557) at ../../mono/utils/atomic.h:392
-4  0x003a1b50 in collect_nursery (reason=0x5083f4 "Nursery full", is_overflow=0, unpin_queue=0x0) at sgen-gc.c:1865
-5  0x003a3794 in sgen_perform_collection (requested_size=4096, generation_to_collect=0, reason=0x5083f4 "Nursery full", wait_to_finish=0, stw=1) at sgen-gc.c:2539
-6  0x003a35f0 in sgen_ensure_free_space (size=4096, generation=0) at sgen-gc.c:2505
-7  0x00389db0 in sgen_alloc_obj_nolock (vtable=0xb4d174d0, size=64) at sgen-alloc.c:256
-8  0x0036e330 in mono_gc_alloc_vector (vtable=0xb4d174d0, size=64, max_length=12) at sgen-mono.c:1743
-9  0xb6c16a38 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
```

fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59039
2017-08-28 07:57:00 +02:00
Alex Rønne Petersen c7c3baba31 Merge pull request #5459 from HinTak/patch-5
More informative g_error message
2017-08-28 00:17:21 +02:00
Alex Rønne Petersen 4fa03c425f Merge pull request #5458 from HinTak/patch-4
remove redundant duplicate word 'not'
2017-08-28 00:16:54 +02:00
HinTak 3dd754cbf8 More informative g_error message
Encountered this message while running the new mkbundle simple-cross functionality introduced recently. "Function not supported" is seen on both Mac OS X and Ubuntu. Will possibly file a separate bug since HAVE_MKDTEMP should be true... but it should be "Function mkdtemp not supported" in any case.
2017-08-27 22:55:11 +01:00
HinTak f26bf88250 remove redundant duplicate word 'not'
Found a consecutive 'not' pair while searching the code for somethng else.
2017-08-27 22:44:09 +01:00
Zoltan Varga 3b3b48dbb4 [runtime] Use the AC_FUNC_STRERROR_R() autoconf macro to distinguish between the two possible signatures for strerror_r (). (#5453) 2017-08-27 03:35:50 -04:00
Alex Rønne Petersen d605f45365 Merge pull request #5455 from HinTak/patch-1
Fixing confusing typos
2017-08-27 06:49:46 +02:00
HinTak ecd9af3f20 Fixing confusing typos
Fixing confusing typos - should be self-explanatory.
2017-08-27 12:21:59 +08:00
Zoltan Varga d0e103fcb4 [jit] Assert that the trampoline code is called in gc unsafe mode, throw exceptions by returning the exception to the assembly trampoline code and throwing it from there. (#5409) 2017-08-26 04:53:24 -04:00
Uri Simchoni 7263bfef55 [amd64] silence compiler warning (#5435)
Silence a GCC warning about param_regs and return_regs not being
used.
2017-08-25 23:24:47 -04:00
Alexander Köplinger ef83450ab0 [System] Disable SocketTest.SendAsyncFile for now (#5447)
It's one of the flaky tests that we have had for a very long time.

There's work in progress fixing it as part of
https://github.com/mono/mono/pull/5345 and https://bugzilla.xamarin.com/show_bug.cgi?id=43172
but I think we should disable it in the meantime for clean CI.
2017-08-25 21:58:52 +02:00
Alexander Köplinger ec9a95dd53 [configure.ac] Don't include the .build number in runtime-corlib version (#5449)
It's causing unnecessary complexity because we need to create a new
monolite when bumping the .build number in a major.minor.build
version like from 5.2.0 -> 5.2.1

corlib version bumps are very rare in those cases and even then
you can just increment the MONO_CORLIB_COUNTER variable.
2017-08-25 21:57:20 +02:00
Alex Rønne Petersen 5965357a59 [profiler] Correct the description of the 'legacy' option. 2017-08-25 21:06:36 +02:00
Martin Baulig efaec63cc8 [System]: Cleanup debugging and use the same technique from the new web stack. (#5441)
* Cleanup debugging and use the same technique from the new web stack.

* The MARTIN_DEBUG conditional has been renamed into MONO_TLS_DEBUG.

* Moved the actual implementation into MNS.MonoTlsProviderFactory.

* We now use an environment variable called 'MONO_TLS_DEBUG' to
  enable debugging (so to get debugging, you need to both compile with
  -define:MONO_TLS_DEBUG and set that environment variable).

The new web stack has a conditional and environment variable called
'MARTIN_WEB_DEBUG'.

* Use [Conditional] instead of #if.
2017-08-25 12:58:50 -04:00
monojenkins 4848d5a34c [msvc] Update csproj files (#5450) 2017-08-25 18:14:40 +02:00
Alexander Köplinger 5f523b92fc [man] Cleanup mentions of monocov in mono.1 (#5446)
Coverage support was added to the log profiler in a5ab6c642e
and the monocov profiler was removed with 1657026514.
2017-08-25 14:36:44 +02:00
Jonathan Chambers c6676b0ff8 Retrieve thread lazily and avoid special case for defer. We were trying to get thread when in defer mode even for EVENT_KIND_VM_DEATH and hitting assert since current thread was not available. (#5440) 2017-08-25 03:46:34 -04:00
Jonathan Chambers cfe7502c1c Ensure exception out argument is initialized to NULL. (#5424) 2017-08-25 03:38:11 -04:00
Toni Spets 62e2fcde73 [System] Fix TDS 7.0 prepared InputOutput parameter info
Fixes ParameterDirection.InputOutput type parameters not sending
the "output" modifier to server which creates a conflict resulting
in an exception server side.
2017-08-25 08:30:07 +03:00
Rodrigo Kumpera 7b5ec9f82c Merge pull request #5420 from nealef/z13v5
Add support for z13 processor
2017-08-24 16:58:08 -04:00
Martin Baulig 79c15b9ff0 [System]: Cleanup internal TLS APIs in preparation of adding renegotiation support. (#5426)
* [btls]: Bind new native APIs to support renegotiation.

* mono_btls_ssl_set_renegotiate_mode(), mono_btls_ssl_renegotiate_pending():
  New native methods.

* MonoBtlsSsl: Added SetRenegotiateMode() and RenegotiatePending().

* MonoBtlsSslRenegotiateMode: New internal enum.

* [System]: Cleanup internal Mono.Net.Security.MobileTlsContext APIs.

Use tuple `(int ret, bool wantMore)' return value instead of out variables.

* [System]: Check for pending exceptions in MobileAuthenticatedStream.

This should fix some issues where we're hanging instead of throwing
an exception if something went wrong.
2017-08-24 16:13:04 -04:00
Alex Rønne Petersen 53d0bba46c Merge pull request #5438 from cherusker/cherusker-2017-08-24-complete-prototype
[libtest] Complete the function prototype
2017-08-24 21:53:19 +02:00
Alex Rønne Petersen 75fd607a5c Merge pull request #5439 from alexrp/master
[profiler] Fix some stack imbalance issues due to missing method leave events.
2017-08-24 19:21:47 +02:00
Alex Rønne Petersen df4d89bd36 [profiler] Add a missing method_leave event for the CEE_MONO_RETOBJ opcode. 2017-08-24 17:08:49 +02:00
Alex Rønne Petersen 081280659a [profiler] Add a missing method_tail_call event when the tailc optimization is enabled. 2017-08-24 17:08:20 +02:00
cherusker 49c66e779a Complete the function prototype 2017-08-24 16:16:02 +02:00
Marek Safar 511a769fdd [mcs] Update logic when checking for tuple element names when overriding inherited member 2017-08-24 10:38:25 +02:00
Zoltan Varga d4390d6a12 Revert "[runtime] Fix a warning."
This reverts commit f99617537b.

Revert this as the original code was right, there is a problem with the defines.
2017-08-23 22:47:43 -04:00
Rodrigo Kumpera ff9a538941 [wasm] Add basic interpreter support for WebAssembly. 2017-08-23 16:05:01 -07:00
Rodrigo Kumpera a9107951a7 [mini] Add skeleton WebAssembly mini backend. It's not functional and some code needs to be shuffled to better places.
The wasm backend is inspired on the x86 one with a few key differences:

1) It assumes a different aot runtime will be used to deal with all the weirdness of wasm.
In particular, it can run under MONO_AOT_MODE_INTERP_LLVMONLY without an actual working AOT compiler.

2) It's the only non-ISA based backend, so lots of weird things.
Like, no registers or addressable stack - for realsies.
2017-08-23 16:04:58 -07:00
Rodrigo Kumpera b85f40ba88 [wasm] Add MONO_AOT_MODE_INTERP_LLVMONLY to MonoAotMode. This is what wasm+interpreter uses. 2017-08-23 16:04:49 -07:00
Rodrigo Kumpera 2e1afbd7b7 Merge pull request #5415 from kumpera/wasm-support
WebAssembly port
2017-08-23 19:03:16 -04:00
Rodrigo Kumpera 3b079a7939 [wasm] Don't define MONO_CROSS_COMPILE in the wasm configure.ac 2017-08-23 13:57:18 -07:00
Rodrigo Kumpera 98f4ec3ab6 [utils] Fix mono_valloc and mono_valloc_aligned malloc-based implementation. 2017-08-23 13:57:17 -07:00
Rodrigo Kumpera 9719dd2343 [wasm] Add wasm stubs for object-offsets and sgen-archdep. 2017-08-23 13:57:08 -07:00
Rodrigo Kumpera 6e31e14ba3 [wasm] Add wasm strings to mono-config.c 2017-08-23 13:57:06 -07:00
Rodrigo Kumpera 63795c0ce8 [wasm] Add comments explaining the magic strings in mono-dl-wasm.c 2017-08-23 13:57:05 -07:00
Rodrigo Kumpera 282eac6c91 [readme] Document --enable-wasm 2017-08-23 13:57:04 -07:00
Rodrigo Kumpera 1a621cfcf1 [wasm] Add threading, dl and hwcap support for wasm. 2017-08-23 13:56:55 -07:00
Neale Ferguson c007d6e0ad Remove unnecessary ifdefed code 2017-08-23 20:42:49 +02:00
Neale Ferguson 8808f52690 Skip load if same register 2017-08-23 20:42:48 +02:00
Neale Ferguson 1854763e83 Add support for z13 processor
The z13 supports some useful instructions that can be exploited
by the JIT. Most notably the compare-and-branch instructions can
reduce a two instruction sequence to one. The load-and-add command
eliminates the more complex compare-and-swap sequence.

The z13 also supports three operand instructions dst,src1,src2
which eliminate checks and loads for instructions like add and subtract.

The unaligned.cs test has been changed to cater for big-endian platforms.
For s390x only, the --trace option will result in a file per thread
being created rather than the traces being written to stdout and
sometimes intermixing incomplete trace entries.
2017-08-23 20:42:47 +02:00
Armin Hasitzka 787faec004 [TSan] Unlocking MonoStats, GCStats and JITGCStats (#5381)
[TSan] Unlocking MonoStats, GCStats and JITGCStats

As the `Unlocked* ()` functions have been approved in https://github.com/mono/mono/pull/5310, I used them to blacklist some of the most obvious counting variables whose data races should be ignored: `MonoStats`, `GCStats` and `JITGCStats` (more to follow if approved).

Please find details about all changes within the commit messages.
2017-08-23 19:50:34 +02:00
Marek Safar a716f5d143 [threadpool] Reduce logging verbosity level. Fixes #58829 2017-08-23 09:48:44 +02:00
Elastino 07d0a7b9f9 Added compile target option as library
Added -t:library since mcd does not interpret output filename for dll suffix.
Without -t:library option, it fails to compile.
{code}
mono$ mcs -debug+ -r:System.Core Options.cs -o:Mono.Options.dll
error CS5001: Program `Options.exe' does not contain a static `Main' method suitable for an entry point
Compilation failed: 1 error(s), 0 warnings
{code}
2017-08-23 09:22:34 +02:00
Alexander Köplinger cbb4ec0c88 Merge pull request #5423 from vargaz/workaround-58901
[runtime] Disable a test which asserts because of an abi break in rec…
2017-08-23 02:04:18 +02:00
Zoltan Varga 7c8acc226b Revert "Disable pinvoke2.exe test on OSX i386 for now (#5411)"
This reverts commit 4d89d5f17b.

Revert this as the problematic test is disabled in libtest.c.
2017-08-22 16:53:01 -04:00
Zoltan Varga 4188f5db54 [runtime] Disable a test which asserts because of an abi break in recent xcode/clang versions. Works around #58901. 2017-08-22 16:52:52 -04:00
Rogier Hofboer 2979bc8ba6 [Mono.Security] Bugfix of bug 23153. Certificate loop variable not used to find certificate 2017-08-22 16:41:48 +02:00
Jo Shields da9287e432 [msi] Fix typos in f9bdab7928 2017-08-22 10:18:20 -04:00
Infko fc684ff839 [Syndication]Fix Runtime crash when parsing pubTime in RFC822 format (#5416) 2017-08-22 15:11:43 +02:00
Alexander Köplinger 3c9cac96f8 [bcl] Remove unused left over .args files 2017-08-22 15:09:20 +02:00
Alexander Köplinger 27877d7103 [MacSDK] Whitelist the csi script 2017-08-22 12:49:54 +02:00
markusbeth 65e759e4a3 enable some tests for System.Text.UnicodeEncoding (#5414)
Remove attribute Category ("NotWorking") from tests GetString_Odd_Count_0
and GetString_Odd_Count_ff as they are now working.
2017-08-22 02:49:37 +02:00
Rodrigo Kumpera ad22cdbbd2 [utils] Fix atomic fallout implementation function naming. 2017-08-21 15:31:05 -07:00
Rodrigo Kumpera 61529745be [wasm] Add wasm stubs for MonoContext and membar ops. 2017-08-21 15:30:16 -07:00
Rodrigo Kumpera bb123c5de8 [WASM] Hack configure.ac to support wasm. Use --enable-wasm instead of --host / --target 2017-08-21 15:14:43 -07:00
Rodrigo Kumpera a04f104093 Merge pull request #5406 from kumpera/fix_12157
[verifier] Base constructors can only be called on uninit'd this pointers. Fix #12157.
2017-08-21 16:18:31 -04:00
Rodrigo Kumpera ffc96812e1 Merge pull request #5407 from kumpera/fix_31225
[pedump] Have the assembly search hook look at the same directory of the assembly being verified.
2017-08-21 16:04:06 -04:00
Alexander Köplinger 3cd3c4d53e Fix method-access.exe test (#5412)
The exception message of a MethodAccessException was changed in 7b88115737.
This caused the method-access.exe test to fail since it checked for the old format.
2017-08-21 17:33:40 +02:00
Alexander Köplinger 4d89d5f17b Disable pinvoke2.exe test on OSX i386 for now (#5411)
Reenable once https://bugzilla.xamarin.com/show_bug.cgi?id=58901 is fixed.
2017-08-21 17:09:06 +02:00
Jo Shields f9bdab7928 [msi] Pull in MSI changes from Mono 5.2 branch
(cherry picked from commit 929575bb0e)
2017-08-21 10:02:15 -04:00
Alexander Köplinger 538829f456 Bump libgdiplus (#5393) 2017-08-21 15:28:44 +02:00
Alexander Köplinger f567c2e5eb Bump timeout for TaskTests.Delay_Simple (#5410)
Should be reverted once https://bugzilla.xamarin.com/show_bug.cgi?id=58877 is investigated and fixed.
2017-08-21 13:45:58 +02:00
Marek Safar 5f7abc5f9d Use absolute paths to avoid ambiguity 2017-08-21 13:04:34 +02:00
Marek Safar f9d0b2f758 CODEOWNERS update 2017-08-21 10:45:49 +02:00
Jonathan Chambers 1cfd52452a Add null check for target to optimized delegate constructor code path. Fixes case 58888 (#5404) 2017-08-18 21:34:29 -04:00
Alexander Köplinger 8b43a1dd6a Update CODEOWNERS 2017-08-19 02:40:54 +02:00
Miguel de Icaza fd1d5997b0 Remove lingering bits from removed prj2make tool (#5405) 2017-08-19 02:05:32 +02:00
Rodrigo Kumpera bb2eff506a [pedump] Have the assembly search hook look at the same directory of the assembly being verified.
Unfortunately using mono_set_assemblies_path is not much of an option as it disables the MONO_PATH env var
and that's needed when working with an in-tree pedump - cuz having to `make install` all the time is BS.
2017-08-18 15:42:17 -07:00
Rodrigo Kumpera 02ca93318b [verifier] Base constructors can only be called on uninit'd this pointers. Fix #12157. 2017-08-18 15:00:45 -07:00
Marek Safar d3adf63e13 More codeowners updates 2017-08-18 23:13:58 +02:00
Rodrigo Kumpera e91a66fc94 Merge pull request #5396 from kumpera/fix_11696
[verifier] Check methodimpl table for duplicated. Fixes #11696
2017-08-18 13:04:34 -07:00
Rodrigo Kumpera 7b88115737 Merge pull request #5397 from kumpera/fix_41279
[runtime] Format MethodAccessException method names to use the same formating as reflection. Fixes #41279
2017-08-18 13:04:08 -07:00
vkargov 25436acaa9 [jit] Don't emit a redundant move in lazy fetch trampolines on AMD64. (#5346) 2017-08-18 11:09:30 -04:00
Aleksey Kliger 616fab4469 [threads] Use designated initializer syntax in MAKE_SPECIAL_STATIC_OFFSET
Originally we used a C90-style struct initializer `{ (index), (offset), (type)
}`.  Unfortunately, SpecialStaticOffset is defined with fields in a different
order on big-endian and little-endian machines.  Using a designated
initializer, we don't have to care about the order.
2017-08-18 09:52:09 -04:00
Rodrigo Kumpera f2a6335118 [runtime] Format MethodAccessException method names to use the same formating as reflection. Fixes #41279
Add mono_method_get_reflection_name that returns the string managed is expecting.
2017-08-17 15:47:27 -07:00
Rodrigo Kumpera fc6e8a27fc Merge pull request #5390 from kumpera/fix_58637
[corlib] When parsing the ECMA key, don't produce a public key. Fixes #58637
2017-08-17 18:37:16 -04:00
Alexander Köplinger eecf2d99e2 Bump bockbuild to remove gtk+ screen patch 2017-08-17 21:12:30 +02:00
Rodrigo Kumpera 04a6c2c987 [runtime] Don't set pkey to a value that will be freed immediately after. 2017-08-17 11:33:37 -07:00
Rodrigo Kumpera 966864c7a8 update CODEOWNERS 2017-08-17 11:01:04 -07:00
Rodrigo Kumpera e3e77d628a [verifier] Check methodimpl table for duplicated. Fixes #11696 2017-08-17 10:52:21 -07:00
Ludovic Henry ab90246c67 [marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace (#5384)
* [marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace

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

* [interp] disable tests for 58782 as they rely on appdomains
2017-08-17 19:11:23 +02:00
Ludovic Henry 91288cad6a [w32error] Add ENODEV -> ERROR_DEV_NOT_EXIST error translation (#5385)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58738
2017-08-17 19:03:40 +02:00
Alexander Köplinger 2536266232 Bump bockbuild 2017-08-17 18:46:12 +02:00
Eberhard Beilharz 9cfadcb38f [SWF] Fix string drawing truncation in combo boxes
This fixes Xamarin-10321. This change fixes the problem in SWF rather
than in libgdiplus which has the advantage that it works with both
Cairo and Pango renderers.

Without the additional NoWrap flag the text will wrap at a word boundary,
which results in the combo box showing lines with potentially a lot of
empty space at the end. With the NoWrap flag we render only one line,
displaying as many characters as possible in that one line.
2017-08-17 10:33:18 +02:00
Armin Hasitzka aa7cd58fb8 Use the Unlocked* () functions to blacklist specific load / store operations (#5387)
- avoid blacklisting whole functions with `MONO_NO_SANITIZE_THREAD`
- change `long` to `gint64` as it is more portable
2017-08-17 09:54:26 +02:00
Rodrigo Kumpera e1518daf9d [corlib] When parsing the ECMA key, don't produce a public key. Fixes #58637
The key was incorrectly encoded and triggered heap corruption.
2017-08-16 16:47:10 -07:00
Ludovic Henry 6e30ded242 [corlib] Increase timeout for MonoTests.System.Runtime.Remoting.TestSynchronizationReleasedOnMultipleAcquire (#5373) 2017-08-16 22:21:13 +02:00
Alexander Köplinger a9ffb3da97 Bump bockbuild 2017-08-16 19:09:28 +02:00
Marek Safar 6223a90aa0 Update list of denied assemblies 2017-08-16 13:15:41 +02:00
Rodrigo Kumpera d67c6000ce Merge pull request #5382 from kumpera/pedump_fix
Address pedump issues from https://bugzilla.xamarin.com/show_bug.cgi?id=58168
2017-08-15 21:58:17 -07:00
Ankit Jain 16eadad7d3 [msbuild] bump to xplat-master branch HEAD 2017-08-15 23:52:54 -04:00
Ankit Jain 823bca4aed [msbuild] Install a deniedAssembliesList.txt to support denied ... (#5358)
... assemblies.

msbuild tries to filter out the denied assemblies, which mono refuses to
load, during a build. It uses the `deniedAssembliesList.txt` installed
to `$mono_prefix/lib/mono/xbuild` to identify them.

This was generated with:

 `$ mono tools/nuget-hash-extractor/nuget-hash-extractor.exe nugets guids_for_msbuild > mcs/tools/xbuild/data/deniedAssembliesList.txt`

This file needs to be kept in sync with any changes in the assemblies
denied by the runtime.

msbuild PR that adds support for this -
https://github.com/mono/msbuild/pull/23 .
2017-08-15 23:51:29 -04:00
Ankit Jain 45ca7b3851 [msbuild] bump to xplat-master branch HEAD 2017-08-15 22:56:03 -04:00
Rodrigo Kumpera c385035a80 [verifier] Add workaround for verifying corlib and valid-only output. 2017-08-15 14:56:09 -07:00
Rodrigo Kumpera b5546715f6 [verifier] Handle csc encoding of enums in cattr blobs. Fixes #58168. 2017-08-15 14:54:47 -07:00
Rodrigo Kumpera 83e71411ab [runtime] Add WINDOWS_RUNTIME type attribute that csc generates 2017-08-15 14:53:17 -07:00
Rodrigo Kumpera 4fe8b900a7 [verifier] Avoid double init of metadata when using pedump.
This is a workaround for the larger problem of it using a non-standard init sequence.

Tracked as https://bugzilla.xamarin.com/show_bug.cgi?id=58793
2017-08-15 14:32:38 -07:00
Rodrigo Kumpera 97bc10361b [verifier] Partially revert 6d37ffdf53. It adds internal a header to a public one. 2017-08-15 14:28:21 -07:00
Marek Safar c603ce5df5 netstandard dependant facades update after 2.0 release (#5371) 2017-08-15 23:14:36 +02:00
Aaron Bockover 97f42f6046 mkbundle: avoid NREs and print useful errors
When scanning for references, emit an error when loading the assembly
into the universe fails or when loading a referenced assembly by
name fails.
2017-08-15 23:08:06 +02:00
Ankit Jain ca0c2f51b7 [msbuild] bump to help debug wrench build failure 2017-08-15 16:39:51 -04:00
Martin Baulig 83020f1270 Add scripts/csi to .gitignore. 2017-08-15 13:25:00 -04:00
Martin Baulig 9b8bb0edbe Cosmetic; remove unnecessary cast and fix compiler warning. 2017-08-15 13:12:47 -04:00
Martin Baulig 093915cf83 [System]: Fix minor leaks in AppleTls. (#5369)
These should be automatically collected by the GC, but explicitly disposing
will keep memory usage more stable over time and keep pressure off the GC.
2017-08-15 13:08:12 -04:00
Martin Baulig c74f44126e [System]: Fix major AppleTls memory leak. Bug #56814. (#5370) 2017-08-15 13:00:18 -04:00
Zoltan Varga 9ba3fa0ba3 [runtime] Use HOST_ defines instead of PLATFORM_ defines. (#5362) 2017-08-15 11:16:48 -04:00
Rodrigo Kumpera b89b696e71 Merge pull request #5355 from kumpera/fix_58379
[mini] Emit widen ops when storing to locals of size < 4. Fixes #58379.
2017-08-14 21:38:40 -04:00
Ankit Jain 746d97a043 [msbuild] bump to help debug wrench build failure 2017-08-14 21:07:15 -04:00
Alexis Christoforides 1413e21a63 [MacSDK] Update bockbuild to work around build/staging issue
Commit message: Allow for non-fatal shell execution, and turn “install_name_tool” staging failures to warnings as we find a more permanent solution to AOT dylibs not always having enough field space for the new path (all other dylibs made in the build with the XCode toolchain typically do, as they are built with the “-headerpad_max_install_names” flag.
2017-08-14 16:27:34 -04:00
Rodrigo Kumpera 1c97e98115 [mini] Add test for implicit widen on argument stores. 2017-08-14 13:22:20 -07:00
Aleksey Kliger 7a0979e2be [remoting] transparent proxy GetType of an interface should return the
interface Type, not MarshalByRefObject. (Fixes #17325)

If a RealProxy instance is created (using the protected RealProxy(Type)
constructor) for an interface, mono internally sets up a MonoRemoteClass which
looks like a proxy for a MarshalByRefObject instance that happens to implement
the given interface.  However mono_class_proxy_vtable just does a memcpy() to
setup the MonoVTable:type field of the transparent proxy's vtable.  That type
field is hit by the JIT when System.Object.GetType() is called - and on .NET
Framework GetType for a transparent proxy of an interface returns the interface
not (as Mono used to) typeof(MarshalByRefObject).

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=17325
2017-08-14 15:38:53 -04:00
Aleksey Kliger 0a58940696 [test] Add regression test for GetType() of a transparent proxy.
Check that calling GetType() on a transparent proxy of a RealProxy of an
interface returns that interface type.
2017-08-14 15:38:53 -04:00
Zoltan Varga f99617537b [runtime] Fix a warning. 2017-08-14 14:52:55 -04:00
Alexander Köplinger a9a08890cb Bump nuget to latest 4.3.0 release (#5368) 2017-08-14 19:27:13 +02:00
Alexander Köplinger e88178655b Bump nuget-buildtasks
Includes https://github.com/NuGet/NuGet.BuildTasks/pull/35
2017-08-14 14:15:18 +02:00
Zoltan Varga a622c9c8ce Fix a warning. 2017-08-14 00:28:50 -04:00
Alex Rønne Petersen 6bd6da1ae6 Merge pull request #5360 from urisimchoni/fix-mon
[profiler] Fix log profiler SetMonitorEvents icall
2017-08-13 13:56:09 +02:00
Uri Simchoni fe29d23c7d [profiler] Fix log profiler SetMonitorEvents icall
Set the right flag when enabling/disabling monitor
event profiling
2017-08-13 09:53:03 +03:00
Jonathan Chambers 537a24f852 Use eglib g_* allocators rather than malloc/calloc (#5359) 2017-08-12 10:54:01 -04:00
Alex Rønne Petersen 1f635c1532 [acceptance-tests] Increase the profiler-stress timeout to 9 hours.
msbiology seems to take longer than 8 hours on 32-bit OS X.
2017-08-12 16:37:03 +02:00
Zoltan Varga 8f0de0cbfb Bump roslyn-binaries. 2017-08-12 03:07:47 -04:00
Rodrigo Kumpera 5968ff1992 [jit] Add implicit widening of stores to args of types < 4 bytes.
This fix follows what was done for #58379 but for arguments.
2017-08-11 15:19:30 -07:00
Alexander Köplinger e6a2cb8763 [ci] Add CI_TAGS for apidiff and ms-test-suite
Easier to maintain than the "label" which could change depending on the bots.
2017-08-11 23:56:43 +02:00
Ankit Jain 43cec6c0dd Install Roslyn binaries, including msbuild tasks to msbuild/Roslyn (#5251)
.. directory, which is `$mono_prefix/lib/mono/msbuild/15.0/bin/Roslyn/`

Mono installs `csc.exe` but the corresponding
`Microsoft.Build.Tasks.CodeAnalysis.dll` required for supporting msbuild C#
projects is installed by msbuild. But these two can get out of sync,
like they did and had to be worked around in
https://github.com/mono/msbuild/pull/19 .

Instead, we now install all the relevant roslyn bits (C# and VB) from the same
source. Only the msbuild specific files are copied to the Roslyn folder.
VBCSCompiler, csi and their dependencies are symlinked from `lib/mono/4.5`.

Also:

- csi.exe is included since the tool is surfaced as an msbuild task,
  and that requires the *Scripting.dll assemblies.
- VBCSCompiler* - shared compiler is installed
- vbc.exe doesn't work on mono currently, so skipping that
- And `Microsoft.DiaSymReader.Native.{amd64,x86}.dll` are dropped.
2017-08-11 17:53:45 -04:00
Rodrigo Kumpera 242987b59b Address reviewer feedback. 2017-08-11 14:53:37 -07:00
Ankit Jain 13dc0bb2c2 [msbuild] Bump to xplat-master branch HEAD 2017-08-11 17:29:48 -04:00
Alexander Köplinger 62458f4b9e [acceptance-tests] Bump coreclr submodule 2017-08-11 22:20:53 +02:00
Alexis Christoforides 9d0b1967c0 Merge pull request #5353 from jonpryor/jonp-mono-api-html-ignore-class-removal
[mono-api-html] Allow `-r` to ignore class removals
2017-08-11 16:02:11 -04:00
Alexis Christoforides aa2ea3b812 [MacSDK] Switch to HTTPS for downloading SQLite 2017-08-11 14:13:09 -04:00
Alex Rønne Petersen 610c764662 [profiler] Fix code coverage support. 2017-08-11 19:31:05 +02:00
Alexis Christoforides dc3aa8cd27 Update Bockbuild for a CI fix/update (shorter build paths for MacSDK) 2017-08-11 12:22:36 -04:00
Alex Rønne Petersen 47cd88f0f8 Merge pull request #5352 from urisimchoni/fix-logprof-manpage
[docs] fixes to log profiler manpage
2017-08-11 16:34:50 +02:00
Alexander Köplinger bf8cc86306 [bcl] Clean up FRAMEWORK_VERSION 4.0 and 2.0 checks (#5356)
We don't build those profiles anymore, we have a net_4_x configuration instead.
2017-08-11 16:22:02 +02:00
Uri Simchoni 7ce175b023 [docs] mprof-report manpage - remove "onlycoverage" log profiler option
This option does not exist in the code.
2017-08-11 09:57:19 +03:00
Uri Simchoni 941108ca07 [docs] mprof-report manpage - document heapshot-on-shutdown
Document the heapshot-on-shutdown log profiler option.
2017-08-11 09:57:19 +03:00
Uri Simchoni 9aac2a41c4 [docs] mprof-report manpage - document '#' output option
Document ability to use the log profiler with an open file
descriptor.
2017-08-11 09:56:20 +03:00
Zoltan Varga 5b2ac5b1d9 [llvm] Avoid generating invalid llvm IR when a finally clause contains a loop which branches back to the beginning of the finally clause. (#5354) 2017-08-10 20:29:10 -04:00
Rodrigo Kumpera 85270afe51 [mini] Emit widen ops when storing to locals of size < 4. Fixes #58379. 2017-08-10 15:22:07 -07:00
Rodrigo Kumpera c695c1ee8b Merge pull request #5323 from cherusker/cherusker-2017-08-07-fix-strerror
[eglib] Fix g_strerror / monoeg_g_strerror
2017-08-10 17:12:02 -04:00
Jonathan Pryor f19bdb47e4 [mono-api-html] Allow -r to ignore class removals
Allow `mono-api-html -r REGEX` to be used to silence messages
regarding class and namespace removals in addition to member removals.
2017-08-10 16:27:31 -04:00
Uri Simchoni fa3dcfdc87 [docs] mprof-report manpage -- fix desctiption of existing file behavior
Fix the description of what happens when the output file already exists.
2017-08-10 22:53:28 +03:00
Uri Simchoni 9dc8579c11 [docs] remove non-existant option from log profiler manpage
The option of prepending a '-' to the log profiler output
filename is not supported by the code - remove it.
2017-08-10 22:53:28 +03:00
Uri Simchoni 246d4ffcc0 [docs] Capitalization / puctuation fixes in mprof-report manpage. 2017-08-10 22:53:28 +03:00
Marek Safar c6e50e868f More codeowners updates 2017-08-10 21:00:31 +02:00
Marek Safar 90d09a591e Update codeowners 2017-08-10 20:17:37 +02:00
cherusker dffb0dd178 Distinguish between the XSI-compliant and the GNU-specific version of strerror_r ()
- add USE_STRERROR_R_XSI to use the feature test macros conveniently later
- deal with the GNU-specific version of `strerror_r ()` separately (leave the code for the XSI-compliant version untouched)
- make `buff_len` size_t as this is ISO compliant (even though it should not really matter in this case)
2017-08-10 18:47:08 +02:00
Armin Hasitzka 5141dc7f2c Add rules to run TSan with run-jenkins.sh (#5254)
- export TSan flags that are used by the compiler and the compiled program
- introduce `make_timeout` to set individual timeouts for `make` based on the config (e.g. TSan will only get 30 minutes to complete)
2017-08-10 18:22:16 +02:00
Mikhail Filippov 6a5fbca3d9 Add implementation and tests for MatrixValueSerializer and MatrixConverter 2017-08-10 17:53:55 +02:00
Mikhail Filippov 88c76920be Uncomment fixed SizeConveter tests 2017-08-10 17:53:55 +02:00
Aleksey Kliger 5ff3b55860 [monodis] Not all override methods are errors
Check whether mono_get_method_checked returned an error, if not, just decode
the override normally.

This partly reverts f100c2f5ff
2017-08-10 10:28:38 -04:00
Armin Hasitzka bc84302196 [TSan] Yet another idea about whitelisting data races (#5310)
* Introduce racing.h
- introduce the `RacingIncrement* ()` functions
- test the `RacingIncrement* ()` functions with races of `mono_stats` in class.c
- add racing.h to Makefile.am, libmonoutils.vcxproj and msvc/libmonoutils.vcxproj.filters

* [fixup!] Rename "racing" to "unlocked"
- rename racing.h to unlocked.h
- update new file name in Makefile.am and *.vcxproj* files
- rename the functions from Racing* to Unlocked*
- update the macro logic
2017-08-10 16:16:02 +02:00
Ankit Jain a46c587880 [msbuild] Bump to xplat-master branch HEAD 2017-08-09 21:07:45 -04:00
Alexander Köplinger c82fab64a0 [mono-symbolicate/mdoc] Don't fail tests in mcs mode (#5348)
The checked in test files which the test suites in mono-symbolicate
and mdoc verify their output against have a few roslyn-specific
things in them and would fail when running in mcs mode.

While in theory we could check in both mcs- and roslyn-specific
test files it seems not worth the effort and we should just skip
the tests in mcs mode so we get greener builds on platforms
where we still use mcs by default.
2017-08-10 02:33:23 +02:00
Alexander Köplinger 9d84dcb2fc Revert "[runtime] Avoid building a separate static library, use the shared object files for the static library as well. (#5233)"
This reverts commit 56a1881bff.

It caused a consistent test error on ARM64:
https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/2810/testReport/regression-tests/dummy/MonoTests_regressions_100percentsuccess/
2017-08-09 20:06:37 +02:00
Bernhard Urban f3d3e2beae Update CODEOWNERS 2017-08-09 19:57:44 +02:00
Bernhard Urban c93589ae97 [interp] builtin types (#5339)
* [interp] support System.{nint,nuint,nfloat} (64bit only so far)

* [interp] 32bit support for System.{nint,nuint,nfloat}

* [fixup] explain mint_niy
2017-08-09 19:49:43 +02:00
Martin Baulig 0fdb5fae2f [System]: Fix memory leak in AppleTls. (#5305)
* [System]: Fix memory leak in AppleTls.

* Apply Miguel's patch to use GCHandleType.Weak.

* Actually assign context.
2017-08-09 12:27:28 -04:00
Aleksey Kliger (λgeek) 4d4594d8b8 Merge pull request #4379 from ermshiperete/master
[runtime] Fix bug when marshaling COM interfaces in arrays
2017-08-08 23:00:55 -04:00
Alexander Köplinger ee8c7c80b7 Default powerpc to mcs instead of roslyn (#5326)
It is crashing still way more than it works and now that the mcs
configuration works again we should default to that to make our CI
more pleasant.
2017-08-09 03:03:50 +02:00
Zoltan Varga 629948534e [runtime] Remove ves_icall_object_new_fast (), its only a bit faster than object_new_specific (), fast allocation is done by the managed allocators. Also remove mono_class_get_allocation_ftn () which is not needed anymore. (#5304) 2017-08-08 19:56:21 -04:00
Zoltan Varga 62c576b042 [btls] Compile btls using ninja if available. (#5333) 2017-08-08 19:54:51 -04:00
Aleksey Kliger 242dce8c9e [eglib] (goutput.c) Revert Android logging host-target change
Revert part of 590473d01b - the Android-specific
logging in eglib/goutput.c should be used when the host is Android, not the
target.
2017-08-08 18:37:33 -04:00
Eberhard Beilharz 2a5200b596 Fix allocation of memory to match the way it gets freed
Since we use g_free() to free the memory we should use g_malloc()
to allocate it.
2017-08-08 17:18:23 -04:00
Damien Daspit dc0400056c [runtime] Fix bug when marshaling COM interfaces in arrays
* use the correct COM interface when creating native array
* do not free CCWs when freeing the native array

This fixes Xamarin-47560.
2017-08-08 17:18:23 -04:00
Eberhard Beilharz fe836ec756 [runtime] Unit test for Xamarin-47560 2017-08-08 17:18:23 -04:00
Uri Simchoni 555041c8c2 Fix xdebug (#5309)
* [mini] fix xdebug null pointer dereferencing

Some trampolines are nameless, avoid crashing when generating their
debug info.

This change is released under the MIT license.

* [mini]: image-writer - move definition of USE_BIN_WRITER to header file

USE_BIN_WRITER is being used by xdebug for conditional compilation.

This change is released under the MIT license.

* [mini]: xdebug - obtain definition of USE_BIN_WRITER from header file

This re-enables xdebug on supported platforms.

This change is released under the MIT license.
2017-08-08 16:38:25 -04:00
Zoltan Varga 074c3c2693 [runtime] Fix a case where klass->blittable was written without holding the loader locked. (#5331) 2017-08-08 16:35:54 -04:00
Zoltan Varga eabbcf5332 [btls] Enable ccache support for cmake. (#5332) 2017-08-08 16:35:06 -04:00
Michael DeRoy ef9ca7ac17 add #if MONO around change to make it easier for merging upstream referencesource changes for the xamaran folks 2017-08-08 22:26:10 +02:00
Michael DeRoy bdb9f21dad Call array sort function that takes comparison instead rather than allocating for a wrapper struct 2017-08-08 22:26:10 +02:00
Mikhail Filippov fd708a1ab6 Add implementation and tests for SizeValueSerializer 2017-08-08 21:55:36 +02:00
Marek Safar ad06981f78 [mcs] Soften referenced assemblies unification rules. Fixes #58621 2017-08-08 17:30:56 +02:00
Jason Imison 2d9df9123c Merge pull request #5335 from mono/master-bump-fsharp
Bump F# to 4.1.25 and remove already merged patches
2017-08-08 12:55:10 +01:00
nosami 00b6bc472b Bump F# to 4.1.25 and remove already merged patches 2017-08-08 12:35:28 +01:00
Alexander Köplinger d0fc6f4ec6 Bump API snapshot 2017-08-08 11:56:55 +02:00
Alex Rønne Petersen 5ac651e7b4 Merge pull request #5317 from alexrp/master
[profiler] Some profiler API improvements.
2017-08-08 08:55:11 +02:00
Zoltan Varga 56a1881bff [runtime] Avoid building a separate static library, use the shared object files for the static library as well. (#5233) 2017-08-07 23:48:52 -04:00
Zoltan Varga f99af5280e [jit] Remove unused mono_arch_print_tree () function. (#5258) 2017-08-07 17:44:02 -04:00
Zoltan Varga 8ab54099c4 [runtime] Remove empty eglib/ dir. 2017-08-07 17:19:30 -04:00
Zoltan Varga 9be68f8952 [runtime] Move eglib into mono/eglib so it becomes a convenience library similar to utils/ etc. (#5297) 2017-08-07 17:14:31 -04:00
Alex Rønne Petersen a5bc0ce8a0 [profiler] Split method_leave callback into a method_tail_call callback.
With this, profilers can distinguish between the two, and also know what the
target method of a tail call is.

The call instrumentation flags have been renamed accordingly and a new flag has
been added for instrumenting tail calls. I've also added a flag for exceptional
leave events, and method_exception_leave is only raised if this flag is given
for a method.

Also refactored the relevant JIT code a bit so it's easier to follow.
2017-08-07 22:47:55 +02:00
Alex Rønne Petersen b40ae96a9b [profiler] Mark generated raise functions as ICALL_DECL_EXPORT.
This is currently needed for method_enter, method_leave, and gc_allocation.
2017-08-07 22:38:26 +02:00
Alex Rønne Petersen 54d73d3bfe [runtime] Declare MonoProfilerCallContext::return_value offset. 2017-08-07 22:38:26 +02:00
Alex Rønne Petersen 66420c76f7 [runtime] Add ICALL_DECL_EXPORT.
ICALL_EXPORT is only used on function definitions, not declarations.
2017-08-07 22:38:26 +02:00
Alex Rønne Petersen f35875568b [profiler] Properly clean up the resources used by the profiler API on shutdown.
Also introduce mono_profiler_set_cleanup_callback ().
2017-08-07 22:38:26 +02:00
Alex Rønne Petersen d97e190c7e [profiler] Some improvements to the code coverage API.
Code coverage must now be explicitly enabled. This simplifies initialization
of some coverage-related structures and also lets us enable debug info which
is needed to produce good data.

Also change the signature of mono_profiler_get_coverage_data so it returns a
value indicating whether coverage data was available.
2017-08-07 22:38:26 +02:00
Alexander Köplinger f1ff42789b [msvc] Update csproj files 2017-08-07 22:14:00 +02:00
Alexander Köplinger 83dde0759f [genproj] Simplify strong name key handling
It doesn't need to be in a separate PropertyGroup.
2017-08-07 22:10:58 +02:00
Armin Hasitzka 757741bd90 [mono-threads-posix] Fix a buffer overflow (rather an information leak / over-read) (#5285)
[mono-threads-posix] Fix a buffer overflow (rather an information leak / over-read)

While testing Clang's AddressSanitizer, I found and fixed a buffer overflow.

Up for discussion: it might be worth importing `strlcpy` (http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strlcpy.c?rev=1.11) for similar purposes as it provides additional safety and also helps with the readability?
2017-08-07 21:10:32 +02:00
Alex Rønne Petersen d1de81f0c6 Merge pull request #5321 from urisimchoni/prof-lin
Profiler - inlining fixes
2017-08-07 19:11:25 +02:00
Uri Simchoni b6397061dd [profiler] Avoid instrumenting inlined methods
An inlined method does not require instrumentation (if it
did, it would not have been inlined). The flags that
control instrumentation options are valid for the caller
method and are not to be consulted.

This patch replaces an assertion with a check and early
return. A method that "wants to be instrumented" does not
get inlined, but a method that "doesn't want to be instrumented"
can get inlined. However, the flags that control instrumention
options have been calculated against the caller method, hence
they should not be consulted at all. The extra check renders
the assertion unnecessary.
2017-08-07 19:54:45 +03:00
Uri Simchoni 65e92f4cef [profile] set the "no profiling" bitmask equal to zero
This makes constructs such as "if (!mono_profiler_get_call_instrumentation_flags(methos))"
correct. See mono_method_check_inlining()
2017-08-07 19:54:45 +03:00
Aleksey Kliger (λgeek) ef684b2041 Merge pull request #5313 from lambdageek/corefx-sre-fixup
[sre] Fix some argument checks, enable xtests
2017-08-07 11:58:50 -04:00
Alexander Köplinger 0f7389f5bb [System.ServiceModel.Web] Simplify AssemblyInfo.cs
We don't need separate AssemblyInformationalVersion for mobile and
non-mobile.
2017-08-07 17:09:34 +02:00
Alexander Köplinger 4e32895440 [ci] Add CI_TAGS option for --disable-mcs-build
Useful if you don't want to build the class libraries e.g. for
some static analysis of the runtime.
2017-08-07 16:28:47 +02:00
Ludovic Henry ddcdec0314 Bump version to 5.7 (#5325) 2017-08-07 16:03:24 +02:00
Ludovic Henry bf3ac1d7fc [w32handle] Remove use of w32handle for File, Console, Pipe and Socket (#5319)
* [w32file] Remove io_ops indirection

* [w32file] Replace use of w32handle by a GHashTable for File, Console and Pipe

* [Socket] Avoid relying on MonoIO.DuplicateHandle

* [w32socket] Remove force closing of sockets on shutdown

* fixup! [Socket] Avoid relying on MonoIO.DuplicateHandle

* [w32socket] Replace use of w32handle by a GHashTable

* [w32handle] Remove dead function mono_w32handle_new_fd

* fixup! [w32file] Replace use of w32handle by a GHashTable for File, Console and Pipe

* [w32handle] Remove dead variable mono_w32handle_fd_reserve

* [fdhandle] Factor w32file and w32socket common fdhandle code

* fixup! [Socket] Avoid relying on MonoIO.DuplicateHandle

* [w32socket] Fix GC safe/unsafe transitions

* fixup! [w32handle] Remove dead variable mono_w32handle_fd_reserve
2017-08-07 15:52:12 +02:00
Alexander Köplinger 7845ed2d91 [eglib] Add back NEWS file, it's required for the tarball 2017-08-07 14:32:13 +02:00
Ludovic Henry 6bfb2f1cf1 Revert "Bump version to 5.7"
This reverts commit 82eafc02e4.
2017-08-07 14:30:20 +02:00
Ludovic Henry 82eafc02e4 Bump version to 5.7 2017-08-07 14:20:29 +02:00
Alexander Köplinger 91dd686981 [System.Drawing] Simplify mobile profile check 2017-08-07 14:11:59 +02:00
Zoltan Varga 33d2d52644 [bcl] Specify the name of the key file on the command line instead of using the AssemblyKeyFile attribute for consistency and to make it easier to do path name manipulation on the file name. (#5316) 2017-08-07 14:03:48 +02:00
Alex Rønne Petersen c65f48052a Merge pull request #5320 from urisimchoni/prof-sample
[profiler] fixes to profiler sample
2017-08-07 08:45:36 +02:00
Uri Simchoni e3a57ead2e [profiler] fixes to profiler sample
- Fix the Linux build instructions.
- Remove eglib dependencies, as they complicate the build of an
  extenral module.
- Make instance static instead of heap-allocated.
- Make the call counter 64 bits.
- Adjustments to accommodate the new profiling API.
2017-08-07 06:33:01 +03:00
Ludovic Henry 6e23736a07 Revert "[w32handle] Remove use of w32handle for File, Console, Pipe and Socket (#5283)" (#5318)
This reverts commit 78735091b6.
2017-08-05 12:59:08 -04:00
Ludovic Henry 78735091b6 [w32handle] Remove use of w32handle for File, Console, Pipe and Socket (#5283)
* [w32file] Remove io_ops indirection

* [w32file] Replace use of w32handle by a GHashTable for File, Console and Pipe

* [Socket] Avoid relying on MonoIO.DuplicateHandle

* [w32socket] Remove force closing of sockets on shutdown

* fixup! [Socket] Avoid relying on MonoIO.DuplicateHandle

* [w32socket] Replace use of w32handle by a GHashTable

* [w32handle] Remove dead function mono_w32handle_new_fd

* fixup! [w32file] Replace use of w32handle by a GHashTable for File, Console and Pipe

* [w32handle] Remove dead variable mono_w32handle_fd_reserve

* [fdhandle] Factor w32file and w32socket common fdhandle code

* fixup! [Socket] Avoid relying on MonoIO.DuplicateHandle

* [w32socket] Fix GC safe/unsafe transitions

* fixup! [w32handle] Remove dead variable mono_w32handle_fd_reserve
2017-08-05 12:51:15 -04:00
Marek Safar 508effd434 Bump boostrap mono dependency 2017-08-05 11:47:05 +02:00
Marek Safar 6e65ed7cf8 Bump corefx 2017-08-05 11:47:05 +02:00
Alexander Köplinger a3806d1745 [ci] Disable corlib-xunit on Windows for now
It seems to fail.
2017-08-05 02:10:21 +02:00
Marek Safar 858f025f69 [mcs] Adds handling for declared variables from while loop condition 2017-08-04 23:49:42 +02:00
monojenkins 94bb3cadd2 Bump API snapshot submodule 2017-08-04 22:41:09 +02:00
Marek Safar 7592b15865 Bump cecil and linker 2017-08-04 22:41:09 +02:00
Aleksey Kliger d56bdb34e8 [test] (corlib) Enable more xtest SRE tests
- MethodBuilderDefineParameter
- ConstructorBuilderDefineParameter
- FieldBuilderSetCustomAttribute
- GenericTypeParameterBuilderSetCustomAttribute
- FieldBuilderSetOffset
- ModuleBuilderDefineInitializedData
- ModuleBuilderDefineUninitializedData
2017-08-04 16:38:27 -04:00
Aleksey Kliger 39b2b769d5 [sre] ModuleBuilder.DefineUnitializedData argument checks
1. Fix off by one in size check.
  Largest usable size is 0x3effff, first unusable size is 0x3f0000
  (Also change order of ArgumentException arguments - param name is second.
   Set it to null because of misguided CoreFX SRE test that expects a null name)
2. Check for empty string field name.
2017-08-04 16:38:24 -04:00
Aleksey Kliger 41393735d6 [sre] negative FieldBuilder.SetOffset should throw ArgumentException 2017-08-04 16:38:24 -04:00
Aleksey Kliger 9eee5a5221 [sre] Add explicit null checks of CustomAttributeBuilder arguments 2017-08-04 16:38:23 -04:00
Aleksey Kliger 07b8fd3cf1 [sre] ConstructorBuilder.DefineParamter(0,...) shouldn't throw
.NET Framework says:

> If you specify 0 (zero) for iSequence, this method returns a ParameterBuilder
>  instead of throwing an exception. There is nothing useful that you can do
>  with this ParameterBuilder.

So let's do that.
2017-08-04 16:38:23 -04:00
Alex Rønne Petersen 4cf197d22b [runtime] Install profiler-events.h as a public header. 2017-08-04 21:05:12 +02:00
Alexander Köplinger 24c3624fee [bcl] Grab free ports randomly in NetworkHelpers (#5312)
* [bcl] Grab free ports randomly in NetworkHelpers

We're frequently seeing "address already in use" errors on Jenkins.

The theory is that when we're running tests and grab the next free
port via our custom NetworkHelpers we're getting a port which will
also be returned to a simultaneously running test (e.g. another chroot)
because we're closing the TcpListener and thus releasing the port until
we start using it in actual test code. By that time the other test
might've already opened the port, causing our test to fail.

Instead we now try to use a random port in the range 10000-60000
and try if it's available. This doesn't completely fix the inherent
race but should hopefully make it way less likely.
2017-08-04 20:22:50 +02:00
Aleksey Kliger a7f5328ca1 [sre] Throw ArgumentOutOfRange exn in MethodBuilder.DefineParameter if called
before SetParameters.

Fixes xunit testpoint MethodBuilderDefineParameter:DefineParameter_NoParameters_NonZeroPosition_ThrowsArgumentOutOfRangeException
2017-08-04 12:55:38 -04:00
Aleksey Kliger (λgeek) 2d4ea2b604 Merge pull request #5306 from lambdageek/corefx-sre-tests
[test] (corlib) Use CoreFX System.Reflection.Emit xunit tests
2017-08-04 12:40:54 -04:00
Aleksey Kliger (λgeek) cb85c56a58 Merge pull request #5303 from lambdageek/cattr-bcheck
[custom_attrs] Add bounds checking to custom attribute parsing
2017-08-04 12:29:19 -04:00
Zoltan Varga e6e0fb8226 [btls] Disable BUILD_SHARED_LIBS while building boringssl, so its symbols are not exported from the btls shared lib. (#5307) 2017-08-04 11:39:28 -04:00
Marek Safar d0f51b4e83 [mcs] Fixes codegen for type pattern matching in probing expressions over hoisted local variables 2017-08-04 15:15:14 +02:00
Marek Safar 69c20abafe [mcs] Flow analysis on reduced expressions need to run on original expression 2017-08-04 13:30:06 +02:00
Marek Safar 8790799a12 [mcs] Warnings clean up 2017-08-04 10:52:23 +02:00
Marek Safar 3749debbec [mcs] Pending implementation of accessors cannot hide base implementation with different member type 2017-08-04 00:24:38 +02:00
Aleksey Kliger 51176ec4eb [ci] (run-test-default) Run the corlib xunit tests 2017-08-03 17:31:15 -04:00
Aleksey Kliger 5e33d810bd [test] (corlib) Use CoreFX System.Reflection.Emit xunit tests 2017-08-03 16:48:10 -04:00
Aleksey Kliger c2f4d0439d [custom_attrs] Add bounds checking to mono_reflection_create_custom_attr_data_args
and load_cattr_value_boxed
2017-08-03 14:26:52 -04:00
Aleksey Kliger 4d17243fd1 [custom_attrs] Add bounds checking to load_cattr_value 2017-08-03 13:51:08 -04:00
Aleksey Kliger fab01c2cff [custom_attrs] Add (some) bounds checking to create_custom_attr
In principle, mono_verifier_verify_cattr_content should prevent malformed custom
attribute blobs from being passed in here.

In practice:

1. The verifier is not on by default

2. System.Reflection.Emit allows an arbitrary byte[] to be passed in which
   means that code like this can cause mono to read past the end of the array.

   ```
   // "1 1-byte constructor argument and then 65280 named properties follow"
   assembly.SetCustomAttribute(constructor, new byte[] { 1, 0, 1, 0x00, 0xFF });
   var attributes = assembly.GetCustomAttributes(true);
   ```
2017-08-03 13:32:25 -04:00
Marek Safar 77f563b5f2 Updates codeowners 2017-08-03 17:09:32 +02:00
Ankit Jain 3fd6c71d19 [msbuild] Add option to nuget-hash-extractor to generate a list of the
.. denied assemblies usable by a msbuild task for filtering them.
2017-08-03 09:28:44 +02:00
Zoltan Varga 3885890e49 Bump ikdasm. 2017-08-02 20:38:02 -04:00
Vlad Brezae 23fa02853e [tests] Disable test on llvm
On llvm aborts can happen during finally blocks. This test was not failing before because the method in question had llvm disabled, which has recently changed.
2017-08-03 02:22:52 +03:00
monojenkins 8bbca2bada Merge pull request #5299 from cherusker/cherusker-2017-08-01-next-generic-inst-id
[metadata] Fix racy next_generic_inst_id

Like suggested by @luhenry, I would like to propose this fix which was discussed in https://bugzilla.xamarin.com/show_bug.cgi?id=58423. As `next_generic_inst_id` is `int`, `InterlockedIncrement64 ()` seems to be the right choice.

Also, I cannot add any reviewers or assignees, which is why I would kindly ask @lambdageek to review this as well :)
2017-08-03 01:10:32 +02:00
Alex Rønne Petersen 266c991d6f [profiler] Fix MonoProfilerState::context_free_buffer type. 2017-08-02 23:10:57 +02:00
Atsushi Eno c60a28c8ad [mono-api-html] Fix bogus IgnoreParameterNameChanges behavior.
It never ignored parameter name changes. Make the entire code just simple.
2017-08-02 21:26:08 +02:00
cherusker 47535f557d Fix racy next_generic_inst_id
- as discussed in https://bugzilla.xamarin.com/show_bug.cgi?id=58423
- in addition, unify `int` and `guint` into `gint32` which can be used flawlessly with `InterlockedIncrement ()`
2017-08-02 21:17:43 +02:00
Zoltan Varga a48bc43985 [bcl] Fix Delegate.GetHashCode () so it takes into account the target too. Fixes #58399. (#5296) 2017-08-02 02:58:41 -04:00
Zoltan Varga 2a648ccdb8 [runtime] Fix msvc build. 2017-08-02 02:08:17 -04:00
Vlad Brezae 1cd20b27b4 Update CODEOWNERS 2017-08-02 02:39:14 +03:00
Alex Rønne Petersen 0dac4223b2 Merge pull request #5298 from baulig/work-offsets-profiler
[offset-tool]: Add MonoProfilerCallContext to MonoAotOffsetsDumper.
2017-08-02 01:35:41 +02:00
Martin Baulig db8d45b66d [offset-tool]: Add MonoProfilerCallContext to MonoAotOffsetsDumper. 2017-08-01 18:11:40 -04:00
Alex Rønne Petersen e0b279ec61 [mini] Remove the functions that were unexported in b05d4b9322. 2017-08-01 21:53:01 +02:00
Alex Rønne Petersen f4c3c959b4 [runtime] Declare MonoProfilerCallContext::method offset. 2017-08-01 21:52:35 +02:00
Zoltan Varga f3a8d72bfb [jit] Fix the DISABLE_JIT build. 2017-08-01 15:13:30 -04:00
Martin Baulig 8ffdc724ec Add myself to CODEOWNERS. 2017-08-01 13:54:27 -04:00
Martin Baulig 2b574b2c5e [System]: Fix memory leak in BTLS. (#5291) 2017-08-01 12:59:23 -04:00
Aleksey Kliger (λgeek) 3109b7cfeb Merge pull request #5288 from lambdageek/bug-58454
[sre] Pass declaring type to GetMethodFromHandle in GenericTypeParameterBuilder:InternalResolve (Fixes #58454)
2017-08-01 12:08:56 -04:00
Alex Rønne Petersen f8dfe7066e Merge pull request #5292 from alexrp/profiler-symbol-fixes
[profiler] Move legacy profiler code to profiler.c.
2017-08-01 17:05:37 +02:00
Alex Rønne Petersen fc869e76b9 Update CODEOWNERS. 2017-08-01 06:54:14 +02:00
Alex Rønne Petersen 6c3adfeac1 [profiler] Move legacy profiler code to profiler.c.
These symbols weren't being properly exported in the final mono executable on
Mac because no code in the runtime called these functions. As long as they're
defined in an object file that contains used functions, they'll be exported.
2017-08-01 06:50:05 +02:00
Alex Rønne Petersen 45d9cc1b5a Merge pull request #5274 from alexrp/profiler-call-contexts
[profiler] Implement call context introspection for enter/leave events.
2017-08-01 06:35:36 +02:00
Alex Rønne Petersen 4aa090cf11 [mini] Add a mono_jit_aot_compiling () function. 2017-08-01 06:15:06 +02:00
Alex Rønne Petersen b05d4b9322 [mini] Remove some unstable exports that are no longer used by the profiler. 2017-08-01 06:15:06 +02:00
Alex Rønne Petersen f9ae98ab88 [profiler] Implement call context introspection for enter/leave events.
When this feature is enabled for a method, the enter/leave event receives an
additional argument, a so-called 'call context'. This call context contains
enough information about the stack frame of the instrumented method to allow
the enter/leave callback to inspect the 'this' reference, method arguments,
local variables, and the return value (for non-void methods).

This feature enables some interesting scenarios that were not possible with
the regular enter/leave events. For example, a profiler could instrument
well-known methods in the managed thread pool code to get an idea of how an
application is using the thread pool, or it could instrument network-related
methods to gather statistics or even log all network traffic.

This is implemented by storing a MonoProfilerCallContext on the stack, whose
MonoContext field is populated by executing an OP_FILL_PROF_CALL_CTX opcode
which stores the stack pointer, frame pointer, and all callee-saved registers
to it. For the epilogue, a pointer to the return value (for non-void methods)
is also stored in the MonoProfilerCallContext. An address to this context is
then passed to mono_profiler_raise_method_enter/leave. Based on debug info,
all arguments and locals can then be looked up in the instrumented method's
stack frame.

For the interpreter, we just store an InterpFrame pointer on the
MonoProfilerCallContext and look everything up from that. We don't need debug
info in this case.

This feature is currently not supported with LLVM (for regular LLVM mode, it
will fall back to Mono's JIT, while for LLVM-only mode, it's not available).

I also refactored the interpreter code so that enter/leave events are generated
not only when interpreter debugging is enabled. Also, the interpreter will only
call mono_profiler_get_call_instrumentation_flags () once per method now.
Finally, I made the interpreter also generate exception leave events.
2017-08-01 06:15:06 +02:00
Aleksey Kliger 8997ef3b6a [sre] Pass declaring type to GetMethodFromHandle in
GenericTypeParameterBuilder:InternalResolve (Fixes #58454)

When the parameter belongs to a method builder, we need to pass the declaring
type (appropriately resolved) to GetMethodFromHandle to avoid an
ArgumentException.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58454
2017-07-31 18:35:16 -04:00
Alexander Köplinger a71c1c7196 [ci] Compile the class lib tests in a separate step
Compiling in parallel via -j should also be faster.
We had this on Wrench but it didn't make it over to Jenkins.
2017-08-01 00:33:36 +02:00
Alexander Köplinger 05bd2d2ffa [mono-symbolicate] Run tests with "run-test" target instead of "test"
The "test" target is used to precompile the tests but actual running
should happen with the "run-test" target.
2017-08-01 00:33:36 +02:00
Aleksey Kliger 62a24cf4ac [test] Check that GenericTypeParamBuilder:InternalResolve passes declaring type
to GetMethodFromHandle

Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58454
2017-07-31 18:33:19 -04:00
vkargov e0d515ec32 Merge pull request #5234 from vkargov/vk-kiokunegi
[jit] Check method cache first in mono_get_method_constrained_checked.
2017-07-31 16:49:58 -04:00
Martin Baulig 256dbaaa20 [corlib]: Fix race condition in ExceptionDispatchInfo. (#5279) 2017-07-31 13:01:41 -04:00
Zoltan Varga f0398a70a5 [llvm] Fix the calling of fault clauses in llvm compiled code. Fixes #58446. (#5286) 2017-07-31 11:20:22 -04:00
Marek Safar 9a1d66fa3a [mcs] Implements C#7 expression bodied members enhancement 2017-07-31 17:01:12 +02:00
Marek Safar 1837a71ea1 [mcs] Add parser sequence for case type pattern matching 2017-07-31 17:01:12 +02:00
Vlad Brezae 82bc0ca4ce Merge pull request #5260 from BrzVlad/fix-handler-block
[runtime] Fix handler block abort
2017-07-28 22:14:33 +03:00
Aleksey Kliger (λgeek) 11961e0202 Merge pull request #5272 from lambdageek/bug-58421
[sre] Handle typeref tokens in fixup_method (Fixes #58421)
2017-07-28 12:00:09 -04:00
Marek Safar 455cfb3b95 [mcs] Implements cloning for yield break. Fixes #57796 2017-07-28 11:14:08 +02:00
Zoltan Varga 590473d01b Eglib integrate (#5267)
* [runtime] Integrate eglib's configure into mono's configure to simplify and speed up the configure process.

* [runtime] Delete some duplicate eglib configure code.
2017-07-28 00:16:18 -04:00
Aleksey Kliger (λgeek) c18b403fa5 Merge pull request #5271 from lambdageek/bug-58361
[sre] Resolve EnumBuilder tokens in managed (Fixes #58361)
2017-07-27 17:55:47 -04:00
Aleksey Kliger 25233ec2ee Bump corlib version
Due to changed semantics of ModuleBuilder:RegisterToken icall (it now does not
allow an EnumBuilder argument)
2017-07-27 11:47:34 -04:00
Aleksey Kliger 186600778e [sre] Resolve EnumBuilder tokens in managed. (Fixes #58361)
In particular, delegate to the TypeBuilder within the EnumBuilder.

Also do not register the EnumBuilder object with the runtime.  (Fixes
https://bugzilla.xamarin.com/show_bug.cgi?id=58361)
2017-07-27 11:41:29 -04:00
Aleksey Kliger 7993a0d9e4 [test] EnumBuilder regression tests for #58361
Cause the creation of a token for an EnumBuilder object.  Test both typedef
tokens (EnumBuilder from same assembly) and typeref token (EnumBuilder in another assembly)
2017-07-27 11:41:29 -04:00
Aleksey Kliger 792b5367cd [sre] Add MonoDynamicImageTokCollision arg to mono_dynamic_image_register_token
The new argument controls what should happen when the given token is already
present.

In some situations it's expected that we either see the same object, or we
unconditionally want to replace it (for example if we previously registered a
TypeBuilder or a MethodBuilder, after the type or method is created, we will
re-register the RuntimeType or MonoMethod in its place).  In other cases (for
example when a module references a MonoMethod from a different assembly), we
may still call `mono_image_create_token()` multiple times but we expect to see
the same MonoMethod object.
2017-07-27 11:41:28 -04:00
Aleksey Kliger 0054c555b3 [sre] Handle typeref tokens in fixup_method (Fixes #58421)
This may occur if there are two AssemblyBuilders in progress and one of them
refers to a TypeBuilder from the other.

https://bugzilla.xamarin.com/show_bug.cgi?id=58421
2017-07-27 11:00:10 -04:00
Aleksey Kliger dc4c79a52f [test] Check that one AssemblyBuilder can refer to a TypeBuilder from another.
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58421
2017-07-27 11:00:10 -04:00
Zoltan Varga d6141be2ef [interp] Make the 'td' variable a pointer in generate () for consistency with the rest of the code. 2017-07-27 14:23:08 +02:00
Zoltan Varga ea21013fb5 [interp] Rename some types to better reflect their function.
MonoInvocation -> InterpFrame
RuntimeMethod -> InterpMethod
runtime_method -> imethod
2017-07-27 14:23:08 +02:00
Marek Safar 9c7b4038d3 [mcs] Another workaround for enum builder SRE crash (this time on Mono) 2017-07-27 10:38:15 +02:00
Marek Safar 63c3593370 Updates codeowners 2017-07-27 09:07:37 +02:00
Zoltan Varga 62835ec068 [runtime] Move object.c to 'common_sources', as it no longer has compile time gc dependencies. 2017-07-26 21:35:38 -04:00
Zoltan Varga 5622889849 Sre not gc dependent (#5264)
* [runtime] Move the sre source files to 'common_sources', they no longer have compile time gc dependencies after the Boehm GC root changes. sre.c still depends on the gc dependent caching code in reflection-cache.h.

* [runtime] Remove compile time gc dependencies from the reflection caching code.

* [runtime] Move reflection.c/sre.c to 'common_sources', they no longer have compile time gc dependencies.
2017-07-26 21:33:12 -04:00
Marek Safar 632e1354b6 [corlib] Update Assembly class xml descriptor 2017-07-27 00:00:35 +02:00
monojenkins c8df608851 [msvc] Update csproj files 2017-07-26 19:35:28 +02:00
Zoltan Varga 966d2b4292 [sre] Add some tests for saving assemblies. (#5265) 2017-07-26 10:16:03 -04:00
Marek Safar fdae69d222 [Mono.CSharp] Updates csproj 2017-07-26 13:27:35 +02:00
Marek Safar 716ff39b42 [mcs] Adds workaround for repl enum declaration on .net SRE 2017-07-26 13:27:35 +02:00
Marek Safar ebfae1efa8 [corlib] ModuleBuilder pseudo-token lookup needs to use references insteads of logical equality comparer.
Fixes #58291
2017-07-26 13:04:27 +02:00
Alex Rønne Petersen 266076030a [acceptance-tests] Another attempt fix a StringBuilder race in the profiler stress runner. 2017-07-26 13:03:52 +02:00
Zoltan Varga 5d9d139e0a [runtime] Remove compile time gc dependencies from object.c. (#5266) 2017-07-25 23:07:49 -04:00
Zoltan Varga 38b9617c77 [runtime] Remove compile-time gc dependencies from domain.c/appdomain.c. (#5263)
* [runtime] Remove compile-time gc dependencies from domain.c/appdomain.c.

* [runtime] Move domain.c/appdomain.c to 'common_sources' since they no longer have compile time gc dependencies.
2017-07-25 20:31:42 -04:00
Marek Safar 211594fb3c Merge branch 'vladimir-kazakov-xml-dsig-transforms-from-corefx' 2017-07-25 23:46:27 +02:00
Marek Safar 6b6c324e06 Merge branch 'xml-dsig-transforms-from-corefx' of git://github.com/vladimir-kazakov/mono into vladimir-kazakov-xml-dsig-transforms-from-corefx 2017-07-25 23:46:04 +02:00
monojenkins 422a7103d1 [msvc] Update csproj files 2017-07-25 23:34:54 +02:00
Alex Rønne Petersen 4484646a0b [interp] Fix a copy/paste error in ea4e4a9ef6. 2017-07-25 16:16:11 +02:00
Marek Safar 5d8d1285d7 Bump roslyn (to include more files) 2017-07-25 15:01:22 +02:00
monojenkins b08c54265b Bump API snapshot submodule 2017-07-25 12:51:52 +02:00
Marek Safar efc7e54e14 Bump CoreFX 2017-07-25 12:51:52 +02:00
Vlad Brezae df7f474937 [runtime] Remove handler block trampoline code 2017-07-25 12:25:53 +03:00
Vlad Brezae ba95f34c0a [runtime] Fix handler block
Instead of hijacking the return address when suspending a thread in a finally block for an abort, do an explicit check in managed code when we are returning from the handler in order to see if we need to abort. Hijacking the return address is arch specific and it doesn't work if we are suspended before it is initialized in handler start.

Fixes #5798
2017-07-25 12:23:34 +03:00
Alexis Christoforides 4526bbb722 Update bockbuild. Fixes #57002 2017-07-25 01:25:54 -04:00
Zoltan Varga 3daaa4d39c [runtime] Fix the size calculation for CustomAttributeType coded indexes, they can only point to the MethodDef/MemberRef tables even through 3 bits are used to encode them, only 2 values are used. Fixes #58210. (#5256) 2017-07-24 23:20:43 -04:00
Zoltan Varga 11ce9cab62 [jit] Handle OP_VCALL_MEMBASE in get_simd_vreg (). Fixes #58344. 2017-07-24 18:28:52 -04:00
Zoltan Varga 4d56a808cf Bump bockbuild. 2017-07-24 17:35:08 -04:00
Marek Safar d26bec1721 Bump roslyn to 2.3.1 2017-07-24 19:49:48 +02:00
Vladimir Kazakov 7ede70ad8e XMLDSIG transforms from .NET Core. 2017-07-24 19:57:26 +03:00
Zoltan Varga 9b1fa3e38f Bump bockbuild. 2017-07-24 11:31:34 -04:00
Alex Rønne Petersen 2a3006438d Update CODEOWNERS 2017-07-23 07:24:55 +02:00
Alex Rønne Petersen 548854a9c6 Merge pull request #5252 from alexrp/profiler-stress-fixes
[acceptance-tests] A few fixes for the profiler stress test suite.
2017-07-23 06:06:28 +02:00
Alex Rønne Petersen 1d14ecc9ed Merge pull request #5253 from alexrp/profiler-lib
[Mono.Profiler.Log] Catch SecurityException for missing icalls.
2017-07-22 20:26:16 +02:00
Alex Rønne Petersen aebb8f0d85 [Mono.Profiler.Log] Catch SecurityException for missing icalls.
This is the exception that is thrown on .NET because icalls are not allowed in
non-GAC assemblies.
2017-07-22 17:15:56 +02:00
Alex Rønne Petersen 709871bd6e [acceptance-tests] Disable the ironjs-v8 test on arm32/arm64.
It times out even with a 24-hour timeout. Eventually we should investigate why,
but disable it for now so the lane can become green.
2017-07-22 15:59:52 +02:00
Alex Rønne Petersen e013096c65 [acceptance-tests] Fix a crash in the profiler stress runner caused by racey modification of a StringBuilder. 2017-07-22 14:42:06 +02:00
Alex Rønne Petersen f0e6bd2f96 [acceptance-tests] Set individual timeout for profiler stress tests back to 8 hours. 2017-07-22 14:35:33 +02:00
Alex Rønne Petersen b7e4f0c0b9 [acceptance-tests] Build profiler stress runner with debug info. 2017-07-22 14:33:35 +02:00
Zoltan Varga 16309a7561 [bockbuild] Avoid overwriting self.local_configure_flags in some packages, extend them instead. (#5239) 2017-07-21 20:02:43 -04:00
Alex Rønne Petersen e4b5152a9b Merge pull request #5248 from alexrp/profiler-api
[profiler] Add back some legacy profiler API functions.
2017-07-21 20:09:54 +02:00
Armin Hasitzka 792a0169b9 [mempool] Annotate functions for clang's ThreadSanitizer (#5191)
* [mempool] Annotate functions for ThreadSanitizer
Whitelist `mono_mempool_alloc`, `mono_mempool_new_size` and `mono_mempool_destroy` according to https://bugzilla.xamarin.com/show_bug.cgi?id=57936

* [fixup!] Test the NO_SANITIZE_THREAD macro

* [fixup!] Merge comments / documentation
2017-07-21 11:39:04 +02:00
Alex Rønne Petersen eb0209be29 [acceptance-tests] Temporarily increase the profiler stress timeout to 24 hours.
This is temporary and is just to see how long ironjs-v8 actually takes to complete on ARM. We may need to just exclude it there.
2017-07-21 11:12:58 +02:00
monojenkins d26e9c18e8 Bump API snapshot submodule 2017-07-21 10:52:05 +02:00
pjt33 952c9145b2 Implement ServiceEndpoint.EndpointBehaviors
This follows the reference source in understanding `EndpointBehaviors` to be an alias of `Behaviors` with a more general type.

Note that although an alias might not seem necessary to implement, when using netstandard1.3 the [`System.ServiceModel.Primitives`](https://www.nuget.org/packages/System.ServiceModel.Primitives) package exposes `EndpointBehaviors` but not `Behaviors`.
2017-07-21 10:52:05 +02:00
Alex Rønne Petersen 68fe403e46 [msvc] Update project files with new profiler-related source files. 2017-07-21 09:53:46 +02:00
Miguel de Icaza 061f782c4b [Marshal.IsComObject] Make this predicate return false instead of throwing an exception which is what the calling code expects (#5246) 2017-07-20 22:47:48 -04:00
Ludovic Henry e58e0fcf57 Reenable MonoTests.Remoting.IpcChannelTest.Bug609381 (#5245)
Fixes bug https://bugzilla.xamarin.com/show_bug.cgi?id=36634
2017-07-20 16:08:26 -04:00
Alex Rønne Petersen 145842ded5 [msvc] Update def files. 2017-07-20 21:14:02 +02:00
Alex Rønne Petersen b6082446c2 [profiler] Add back some legacy profiler API functions.
These are used by XA/XI/XM and because XM in particular needs to work with
both old and new versions of system Mono, we need to make sure these functions
still exist.
2017-07-20 20:46:59 +02:00
Alex Rønne Petersen 9ab31d0213 [profiler] Rename mono_profiler_install to mono_profiler_create. 2017-07-20 20:07:47 +02:00
Vlad Brezae 2657d9cb1e [runtime] Fix abort ignore when suspended in first instruction from finally block 2017-07-20 20:35:23 +03:00
Vlad Brezae 42874b6479 Merge pull request #5198 from BrzVlad/fix-binprot-stats
[sgen] Parallel gc improvements
2017-07-20 20:30:49 +03:00
Bernhard Urban 2ce28c626c [jit] test builtin types (#5208)
* [builtin-types] import test suite

List of original contributors:

Zoltan Varga <[email protected]>
Rodrigo Kumpera <[email protected]>

* [builtin-types] import updated definitions from xamarin-macios

https://github.com/xamarin/xamarin-macios/blob/8fbbfa5ca7154fcfd553f7a7b242ffee9a95f240/src/NativeTypes/Primitives.tt

* [builtin-types] make regression suite work

* [builtin-types] disable broken tests

* [fixup] disable failing tests on arm64
2017-07-20 19:24:11 +02:00
Bernhard Urban a5a3a52e10 [interp] reuse finally_ips infrastructue for fault clauses 2017-07-20 19:21:50 +02:00
Mikayla Hutchinson d3b8558190 Tweak the Unreal profile 2017-07-20 17:52:39 +02:00
Alex Rønne Petersen b1aa5c0074 Merge pull request #5243 from alexrp/profiler-stress-fixes
[acceptance-tests] Don't mark msbiology as a failure if it OOMs on 32-bit.
2017-07-20 15:34:06 +02:00
Vlad Brezae 0a35d095bf [sgen] Fix function signature 2017-07-20 13:53:50 +03:00
Vlad Brezae b319e134ef [sgen] Compact allocated block list
It helps with its repeated traversal and improves work distribution when using parallel modes.
2017-07-20 13:53:50 +03:00
Vlad Brezae 5ff8de7322 [sgen] Improve card table parallelization
Improve caching by scanning consecutive blocks and avoiding full block list travesal.
2017-07-20 13:53:49 +03:00
Vlad Brezae 7692bfc5a9 [sgen] Run a single worker cycle in major parallel finish case
This was not the case when we were doing a forced concurrent finish.
2017-07-20 13:53:48 +03:00
Vlad Brezae 58a947d9c5 [sgen] Avoid logging unnecessary binary protocol events 2017-07-20 13:53:48 +03:00
Vlad Brezae 1f19829f91 [sgen] Add explicit binary protocol stats for collections
Using the cardtable scan and finish_gray_stack start and end events is cumbersome to parse and require a lot of logging, especially in the case of the parallel collector.
2017-07-20 13:53:47 +03:00
Vlad Brezae 1e58d75461 [sgen] Include mod union times to stats 2017-07-20 13:53:46 +03:00
Vlad Brezae 88c89b2a0d [sgen] Use parallel minors for pause mode
It should makes pauses less influenced by workload spikes
2017-07-20 13:53:46 +03:00
Vlad Brezae f7cf1b7e07 [sgen] Avoid waiting for workers to report their own finish
If a worker is stuck doing work in another context, it might not be very responsive in transitioning its own state from WORK_ENQUEUED to WORKING and finally to FINISHING. When joining worker threads, we check whether we have any threads working in the corresponding context and, if there aren't any, change their state directly from the gc thread.

We can do this because work is distributed from centralized pools (worker_distribute_gray_queue and the job_queue), instead of per worker. Therefore we don't need all the workers to perform actual work in the context.
2017-07-20 13:53:43 +03:00
Marek Safar f1df763e67 Update CODEOWNERS 2017-07-20 11:42:01 +02:00
Alex Rønne Petersen fff286cdfa [acceptance-tests] Don't mark msbiology as a failure if it OOMs on 32-bit.
This is known to happen on some platforms.
2017-07-20 02:23:17 +02:00
Ludovic Henry 82a7e5bb70 [threads] Add checks around libc calls (#5240) 2017-07-19 17:50:07 -04:00
Ludovic Henry 78bcf6aa14 [threads] Make mono_thread_detach_internal static (#5241) 2017-07-19 17:49:20 -04:00
Alex Rønne Petersen 8b53bbfa5f [acceptance-tests] Further increase the individual test timeout in the profiler stress runner.
It seems ironjs-v8 takes even longer to run on ARM than fsharp, msbiology, and roslyn.
2017-07-19 21:32:21 +02:00
Zoltan Varga e0c549679a [bcl] Fix the parallel build in the tools dir. (#5236) 2017-07-19 15:03:58 -04:00
Bernhard Urban b57202ea18 [offset-tool] fix assignment for GeniOS
fixes this compilation error

MonoAotOffsetsDumper.cs(279,59): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
2017-07-19 15:40:04 +02:00
Zoltan Varga 574f999d55 [btls] Remove create-object-library.sh script which is no longer used. (#5232) 2017-07-19 00:21:32 -04:00
Alexander Köplinger 09aa3bcc30 Fix build of "unreal" profile 2017-07-19 01:14:02 +02:00
Alex Rønne Petersen aabcc3e60e Merge pull request #5224 from alexrp/profiler-multiple-args
[profiler] Better support for multiple profilers.
2017-07-19 00:39:40 +02:00
Martin Baulig d1555c7c72 [System.Net.Http]: Close request stream when HttpClientHandler.SendAsync() is done writing data. (#5226) 2017-07-18 11:09:37 -04:00
Alex Rønne Petersen 30c163826c [acceptance-tests] Increase individual timeout of profiler stress tests to 8 hours.
fsharp, roslyn, and msbiology take a very long time to run on ARM. Hopefully this is enough.
2017-07-18 10:04:29 +02:00
Zoltan Varga a8a03515fa [llvm] Disable an optimization in LLVM where we deleted and recomputed the MONO_INST_INDIRECT flags during codegen. This doesn't work since the INDIRECT flag prohibits the insertion of phi nodes, so its later removal leads to the generation of LLVM IR which is missing phi nodes. (#5227) 2017-07-18 02:21:59 -04:00
Ankit Jain b4ef279dd7 [msbuild] Bump msbuild, fix build breakage 2017-07-17 20:19:43 -04:00
Zoltan Varga 6207a4932a [llvm] Set the MonoJitInfo.from_llvm flag for methods loaded from llvm, it got broken by 1debf39341. (#5223) 2017-07-17 19:14:02 -04:00
Zoltan Varga b705b1c2aa [offsets-tool] Add a --gen-ios argument which can be used together with --targetdir= to generate ios offsets without having to specify the macos path. (#5218) 2017-07-17 18:54:59 -04:00
Ankit Jain d7a9834218 [msbuild] Bump msbuild to fix build breakage
.. specifically get msbuild@81687aa7dd4ad9b76c52c1efa841b4527e0f45f9
2017-07-17 17:58:26 -04:00
Alex Rønne Petersen 918da31c51 [profiler] Fix a crash in the AOT profiler when the output option isn't given. 2017-07-17 23:35:55 +02:00
Alex Rønne Petersen d63f005908 [mini] Support loading multiple profilers with the --profile option.
The runtime has ~always supported having multiple profilers loaded, so it
didn't make much sense that only the last --profile option given would be used.
2017-07-17 23:35:20 +02:00
Alex Rønne Petersen 074c3e056e [Mono.Profiler.Log] Remove coverage event support.
I intend to move code coverage support to a separate profiler module, so these
events will eventually be removed from the log format. As such, I'd rather not
commit to having these event classes in the API.

This won't affect users of the library who don't enable code coverage.
2017-07-17 22:47:30 +02:00
Alex Rønne Petersen 2e449ae199 [profiler] Profiler entry point name must now include the module name.
So mono_profiler_init becomes e.g. mono_profiler_init_log.

This allows us to link together multiple profilers into a single module and
load them selectively. This is especially useful for XA/XI/XM.
2017-07-17 22:45:02 +02:00
Andi McClure a7ae3550e9 Merge pull request #5194 from xmcclure/orbis-freeswept
Do not major_free_swept_blocks on Orbis.
2017-07-17 13:48:53 -04:00
Ankit Jain a30d0c3da9 [msbuild] Bump to get new changes on xplat-master 2017-07-17 13:36:45 -04:00
Vladimir Kargov ed744164fb [jit] Don't allocate a new method in mono_get_method_constrained_checked, check the cache first. 2017-07-17 10:31:52 -07:00
Alex Rønne Petersen e217c5ae86 Merge pull request #5206 from alexrp/profiler-gc-base-init
[profiler] Don't call mono_gc_base_init () before loading profilers.
2017-07-17 19:25:17 +02:00
Alex Rønne Petersen 982e1549fd [profiler] Don't call mono_gc_base_init () before loading profilers.
Calling this function could cause us to miss some profiler events.

In the past, we needed to call this function so that SMR and mono-threads were
initialized. Since then, 8dec9848f6 changed
profiler initialization to happen later during startup, so this is no longer
necessary.
2017-07-17 19:22:47 +02:00
Alex Rønne Petersen 9f2c4f328d Merge pull request #5216 from alexrp/profiler-runtime-settings
[profiler] Introduce runtime control API.
2017-07-17 19:15:13 +02:00
Albert Ruff 9c79e7a3ae Add SoapAction to Content-typ for SOAP 1.2 (#5219) 2017-07-17 18:30:44 +02:00
monojenkins 526d957b4f [msvc] Update csproj files (#5220) 2017-07-17 17:38:53 +02:00
Alexander Köplinger 68ba6c1456 Bump corefx (#5217) 2017-07-16 19:59:41 +02:00
Alexander Köplinger 4fa0463aa9 [System] Suppress a few instances of CS0618 obsolete warnings 2017-07-16 02:44:03 +02:00
Alexander Köplinger c4d38b54ad [corlib] Preserve List<T>.ConvertAll in TypeTest (#5215)
TypeTest.GetGenericMethodDefinitionOverInflatedMethodOnGTD accesses
List<T>.ConvertAll() via reflection but doesn't use the method
elsewhere so the linker can remove it. Added some usage to avoid that.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56242
2017-07-16 01:49:00 +02:00
Alex Rønne Petersen 16385fe576 [profiler] Use g_strerror () instead of strerror (). 2017-07-15 23:13:37 +02:00
Alex Rønne Petersen 6214c2e6ed [profiler] Change sample frequency to a 32-bit int.
The unit is hertz, so values above 100-1000 are already extremely unusual.
Changing it to a 32-bit int avoids word tearing on 32-bit platforms.
2017-07-15 23:08:24 +02:00
Alex Rønne Petersen c44957bab3 [profiler] Introduce runtime control API. 2017-07-15 23:08:12 +02:00
Alex Rønne Petersen caa28c999c Merge pull request #5210 from alexrp/profiler-runtime-settings
[profiler] Housecleaning
2017-07-15 13:33:20 +02:00
Alex Rønne Petersen 903644f8f1 [profiler] Move heapshot logic to the correct GC event.
MONO_GC_EVENT_START is actually sent _after_ all the 'stop world' events. The
heapshot logic being in this switch case only worked by accident previously.
2017-07-15 02:12:38 +02:00
Alex Rønne Petersen 21bc9cf4cd [profiler] Clean up MonoProfilerGCEvent enum.
* Remove the mark/reclaim events as they've been broken for a long time and
  aren't particularly useful.
* Reorder the enum member declarations to the order they actually arrive in.
2017-07-15 02:08:40 +02:00
Alexander Köplinger 9b4b6d6211 [bcl] Remove the ValueAdd and InetAccess NUnit categories (#2212)
ValueAdd was added over a decade ago and all the tests marked with this category are passing now.

We have *tons* of tests that rely on working DNS/Internet that aren't marked with
InetAccess (and they actually provide good value so we don't want to exclude them).

Since these categories don't really make sense and just causes confusion
it's better to just remove them.
2017-07-14 23:38:31 +02:00
Alex Rønne Petersen 7f6943705e [profiler] Add a heapshot-on-shutdown option. 2017-07-14 23:31:50 +02:00
Aleksey Kliger aa07d1c2d5 [pedump] Print failure cause message when a class cannot be initialized 2017-07-14 16:16:58 -04:00
Ludovic Henry 98442ff12c Add @luhenry and @kumpera to CODEOWNERS for some files 2017-07-14 15:59:12 -04:00
Zoltan Varga bef8c4d0f8 [llvm] Reserve the proper number of got entries in the llvm got instead of 16 which used to be enough in the past. Hopefully fixes #56111. (#5207) 2017-07-14 15:39:16 -04:00
Aleksey Kliger 4ee553f888 [metadata] Encode public key length correctly for keys longer than 128 bytes
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57691

For keys longer than 1024 bits, we encoded the length incorrectly as
   0x80 (length & 0xff)
instead of the correct algorithm:
  if (length < 0x80)
    length
  else if (length < 0x4000)
    0x80|(length>>8) (length & 0xff)
  else
    0xc0|(length>>24) (length>>16)&0xff (length>>8)&0xff length&0xff

which is provided by mono_metadata_encode_value.

See ECMA-335 II.24.2.4 #US and #Blob heaps

N.B.: we now always allocate the memory for the key as (keylen + 4) which
over-allocates by a couple of bytes in the cases where the key is shorter.
2017-07-14 14:43:18 -04:00
Aleksey Kliger 01eaabd5d4 [tests] Add regression test for InternalsVisibleTo with long PublicKey
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57691

We build a library that has an InternalsVisibleTo attribute that references an
executable that is signed with a long (>128bytes) public key.  Previously we
were using an incorrect method of encoding the key length.
2017-07-14 14:43:18 -04:00
Aleksey Kliger f3281df8c2 [tests] Use test runner for test-internalsvisibleto
Also add the source files to EXTRA_DIST
2017-07-14 14:43:18 -04:00
Alexander Köplinger e20962e7e3 [Microsoft.Build] Relax check in BuildSubmissionTest a bit more 2017-07-14 20:27:08 +02:00
Alex Rønne Petersen 569749b214 [Mono.Profiler.Log] Fix LogProcessor.ReadObject (). 2017-07-14 20:25:04 +02:00
Alex Rønne Petersen 520fb508e6 [msvc] Update VTune project files. 2017-07-14 20:25:02 +02:00
Alex Rønne Petersen f5fd9e0b3e [profiler] Fix sampling thread shutdown logic to handle idle mode correctly. 2017-07-14 20:24:59 +02:00
Alex Rønne Petersen 9a6ef035c4 [profiler] Use tabledefs.h constants for method attributes. 2017-07-14 20:24:57 +02:00
Alex Rønne Petersen 6a1ceec1fa [profiler] Move the log format description to the header. 2017-07-14 20:24:54 +02:00
Alex Rønne Petersen 7071fe64af [acceptance-tests] Update the profiler-stress runner for removed options. 2017-07-14 20:24:52 +02:00
Alex Rønne Petersen 92ac04725e [profiler] More options reworking/refactoring.
This commit does a few different things.

First, metadata event options have been removed. We now always emit these
events. This is done because they contain important data that must be present
in order for dynamic event mask changes at runtime to result in useful data.
Also, almost all uses of the profiler require this data to be present, so
letting it be turned arguably just adds confusion for users.

Second, the PROFLOG_*_FEATURE flags have been removed. These made the code a
bit confusing because it was unclear whether code in log.c should be checking
the PROFLOG_*_FEATURE flag or the PROFLOG_*_EVENTS flag for a particular kind
of event. For heapshot in particular, the heapshot mode is now a separate enum
configuration variable. For enter/leave and coverage, switching those on and
off in the log profiler at runtime is not something we want to support at this
time.

As a result of the above change, some options are now processed manually rather
than being part of the event_list array.

Third, the way we turn off GC root events when needed is now by setting the
callback to NULL. This is more efficient as it signals to the runtime that it
doesn't have to gather root information. This will especially matter later on
when the profiler root info revamp lands, as it collects a lot more data than
we do today. Also, GC roots are no longer gathered unless we're doing a
heapshot.

Fourth, the profiler now always starts the sampling thread in idle mode. This
is so that we can reconfigure and enable/disable it at runtime as needed.

Finally, the alloc alias option now includes GC move events, and GC resize
events are only emitted if the gc option is given.
2017-07-14 20:23:32 +02:00
Ludovic Henry db1476e1cb [w32error] Add ENXIO error case (#5199)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58100
2017-07-14 10:58:25 -04:00
Alexander Köplinger 5dd17f8942 [Microsoft.Build] Make BuildSubmissionTest.EndBuildWaitsForCompletion more reliable (#5209)
We've seen this test failure a few times:

```
MESSAGE:
  #2
  Expected: greater than or equal to 00:00:01
  But was:  00:00:00.9544900

+++++++++++++++++++
STACK TRACE:
  at MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion () [0x000d8] in /mnt/jenkins/workspace/test-mono-mainline-linux/label/ubuntu-1404-amd64/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs:110
  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) [0x00032] in /mnt/jenkins/workspace/test-mono-mainline-linux/label/ubuntu-1404-amd64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```

Rewriting the test to use Stopwatch instead of DateTime
for measuring elapsed time should make it more reliable.
2017-07-14 14:47:14 +02:00
Alex Rønne Petersen ed7352ea63 [profiler] Clarify docs for mono_profiler_set_sample_mode (). 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 93680ffb36 [profiler] Use mono_cpu_count () from utils/proclib. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 9030c7acda [utils/proclib] Export mono_cpu_count () for use in the profiler. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 501ded4a5e [profiler] Update file headers. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen bb725e72b0 [profiler] Use EXIT_LOG instead of EXIT_LOG_EXPLICIT where possible. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen da652801a1 [profiler] Clean up counter data structures a bit. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 84518bc046 [profiler] Consolidate log profiler state.
Previously, the profiler's state was spread all over the place. Some stuff was
in the MonoProfiler structure, some stuff was in global variables littered
throughout log.c. Now everything is stored in MonoProfiler and ProfilerConfig.
2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 1764b7e263 [profiler] Drop support for the old-style sample option. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 275e5a5e0d [profiler] Remove the need to pass a MonoProfiler pointer around everywhere. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen dbc31d3a23 [profiler] Clean up logging to use the new logging functions. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 0db33fa933 [profiler] Remove support for the output=-FILENAME option. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen ae67391964 [profiler] Remove the debug-coverage option. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 776aba3f7c [utils/logger] Export logging functions for the profiler. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen bc95b8ff1e [profiler] Use explicit values for enum members. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen 8249d970e6 [profiler] Remove unused TYPE_END enum member. 2017-07-14 12:59:27 +02:00
Alex Rønne Petersen edca7989e3 [profiler] Update sample hit size calculation. 2017-07-14 12:59:27 +02:00
Zoltan Varga 2c59986b44 [llvm] Add support for fault clauses. Fixes #58114. (#5203) 2017-07-14 00:43:23 -04:00
Alexander Köplinger fce35160dd Add myself to a few paths in CODEOWNERS
Also fix a few broken markdown links in contributing.md that that I noticed.
2017-07-14 01:36:51 +02:00
Jonathan Pryor e1feed1042 @jonpryor reviews Mono.Options (#5204) 2017-07-13 21:51:19 +02:00
Alex Rønne Petersen 4e0981da06 Merge pull request #5201 from alexrp/code-owners
Add initial CODEOWNERS file.
2017-07-13 21:39:02 +02:00
Alex Rønne Petersen 6758bfec38 Add initial CODEOWNERS file. 2017-07-13 18:30:39 +02:00
Zoltan Varga 777fa66d5b [amd64] Mark RBP as 'same value' in the unwind info for the epilog so the unwind info is correct if the method is interrupted after cleaning up its frame. (#5197) 2017-07-11 17:32:46 -04:00
Johan Lorensson 46bc4f393e Incorrect parameters passed to GetDiskFreeSpaceEx causing random memory corruption. (#5196)
The call to GetDiskFreeSpaceEx passes uninitialized pointers to GetDiskFreeSpaceEx
instead of pointers to stack variables. This will cause random memory corruption and random
crashes on Windows builds.

This is a regression caused by the refactoring work done in this PR:

https://github.com/mono/mono/pull/4255
2017-07-11 23:23:54 +02:00
Alex Rønne Petersen efd961c721 Merge pull request #5190 from alexrp/profiler-roots-deprecation
[profiler] Hide the GC roots callback behind a macro and mark it obsolete.
2017-07-11 18:52:59 +02:00
Johan Lorensson 665d8d4141 Remove partial path for ml.exe and ml64.exe in mono VS runtime builds. (#5195)
Location of ml.exe and ml64.exe is different in VS2017 compared to VS2015.
By removing the partial path from the command, the VS environment will locate
the tool depending on selected build configuration and VS version.

This should work for both VS2015 and VS2017.
2017-07-11 15:21:04 +02:00
Alexander Köplinger ce3ddc2073 [System.Drawing] Remove tab from .sources 2017-07-11 02:14:45 +02:00
Andi McClure f75c72dd2d Do not major_free_swept_blocks on Orbis.
Also, the existing major_free_swept_blocks exemption for Windows is more appropriate for Windows *hosts* than Windows *targets*.
2017-07-10 17:03:17 -04:00
cherusker 7aa4bfe352 Check return value of asn1_generalizedtime_to_tm () 2017-07-10 19:05:43 +02:00
Zoltan Varga 43957a4dd7 [bitcode] Disable tests which use filter clauses when running with bitcode. 2017-07-10 12:57:52 -04:00
Alex Rønne Petersen 53482f70bc Merge pull request #5189 from alexrp/profiler-sample-type-field
[profiler] Remove the type field from TYPE_SAMPLE_HIT.
2017-07-10 17:27:03 +02:00
Alex Rønne Petersen f8ca228b2e [profiler] Remove the type field from TYPE_SAMPLE_HIT.
It's unlikely that we'll add support for other kinds of sampling in the future
as we've dropped support for perf on Linux.
2017-07-09 03:16:03 +02:00
Alex Rønne Petersen f1e68da190 [profiler] Hide the GC roots callback behind a macro and mark it obsolete. 2017-07-08 06:41:38 +02:00
Vlad Brezae 5599130b36 [sgen] Make job waiting reliable
While this is not an issue yet, sgen_thread_pool_wait_for_all_jobs is logically expected to be called by the main thread and resume execution after all jobs have been executed. Concurrent M&S can enqueue additional jobs as part of its finishing phase, which means that we could detect early that no more jobs are to be processed. Make sure this is not the case.
2017-06-28 13:12:06 +03:00
Etienne CHAMPETIER 1057d0329a System.Web.SessionState: simplify sessions retrival polling
When using "fat" session (~2MB) and multiple (~20) simultaneous calls
the retrieval sometimes fails and lock the session.
The original code blocks on the calling thread (AutoResetEvent.WaitOne())
and uses another thread with the timer to do the polling.
If the polling succeeds, the TimerCallback AutoResetEvent.Set(),
with no guarantes that it will wake up the thread.
(see Remarks in http://msdn.microsoft.com/en-us/system.threading.eventwaithandle.set%28v=vs.110%29)

In this patch we simply replace all this code with an equivalent
loop + sleep, which give us the same behaviour
(we still block the calling thread with the sleep, but we didn't use another one)

Signed-off-by: Frederic Mestayer <[email protected]>
Signed-off-by: Etienne CHAMPETIER <[email protected]>
2014-12-22 09:20:01 +01:00
5695 changed files with 367408 additions and 335270 deletions

No files matched your search

+7 -2
View File
@@ -23,7 +23,7 @@ License
The Mono runtime, compilers, and tools and most of the class libraries
are licensed under the MIT license. But include some bits of code
licensed under different licenses. The exact list is [available here] (https://github.com/mono/mono/blob/master/LICENSE).
licensed under different licenses. The exact list is [available here](https://github.com/mono/mono/blob/master/LICENSE).
Different parts of Mono use different licenses. The actual details of
which licenses are used for which parts are detailed on the LICENSE
@@ -32,7 +32,12 @@ file in this directory.
CLA
=======
Contributions are now taken under the [.NET Foundation CLA] (https://cla2.dotnetfoundation.org/).
Contributions are now taken under the [.NET Foundation CLA](https://cla.dotnetfoundation.org/).
Code Review
=======
We are requiring code reviews before merging a pull request.
GitHub won't let you merge a PR until someone from the Mono team approves it.
Testing
=======
+47
View File
@@ -0,0 +1,47 @@
<!--
If you are new to the project get yourself familiar with https://www.mono-project.com/community/bugs/make-a-good-bug-report/ before filling the issue
-->
## Steps to Reproduce
1.
2.
3.
<!--
You may drag & drop the attachment (repro code/solution, screenshot, etc.) onto the issue.
-->
### Current Behavior
<!--
What is the current behavior?
-->
### Expected Behavior
<!--
Please describe the behavior you are expecting
-->
## On which platforms did you notice this
[ ] macOS
[ ] Linux
[ ] Windows
**Version Used**:
<!--
You can use `mono --version` or About dialog to obtain this information.
-->
## Stacktrace
```
Please paste the stack trace here if available.
```
<!--
You can join us at https://gitter.im/mono/mono to discuss your reported issue
-->
+9
View File
@@ -0,0 +1,9 @@
<!--
Thank you for your Pull Request!
If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.
Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
+4 -1
View File
@@ -40,10 +40,12 @@ Ankh.NoLoad
*.gpState
.vscode/
*.exp
.vs/
# Tooling
_ReSharper*/
*.resharper
.idea/*
[Tt]est[Rr]esult*
*.orig
*.rej
@@ -88,6 +90,7 @@ stamp-h.in
*.swp
*.o
.deps
.libs
# Libtool
libtool.m4
@@ -128,4 +131,4 @@ mono-*.tar.*
tmpinst-dir.stamp
msvc/scripts/inputs/
extensions-config.h
*.mlpd
+1
View File
@@ -49,6 +49,7 @@
[submodule "external/corert"]
path = external/corert
url = git://github.com/mono/corert.git
branch = mono-2018-08
[submodule "external/xunit-binaries"]
path = external/xunit-binaries
url = git://github.com/mono/xunit-binaries.git
+91
View File
@@ -0,0 +1,91 @@
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
"/usr/local/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"/usr/include",
"${workspaceRoot}",
"${workspaceRoot}/mono",
"${workspaceRoot}/mono/eglib",
"${workspaceRoot}/support"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
"/usr/local/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"/usr/include",
"${workspaceRoot}",
"${workspaceRoot}/mono",
"${workspaceRoot}/mono/eglib",
"${workspaceRoot}/support"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/mono",
"${workspaceRoot}/mono/eglib",
"${workspaceRoot}/support"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/mono",
"${workspaceRoot}/mono/eglib",
"${workspaceRoot}/support"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
"${workspaceRoot}",
"${workspaceRoot}/mono",
"${workspaceRoot}/mono/eglib",
"${workspaceRoot}/support"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
"${workspaceRoot}",
"${workspaceRoot}/mono",
"${workspaceRoot}/mono/eglib",
"${workspaceRoot}/support"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 4
}
+136
View File
@@ -0,0 +1,136 @@
# Mono Code Owners File
#
# GitHub uses this file to determine who to assign for reviews
# on pull requests. Please keep this file alphabetically sorted.
#
# References:
#
# https://github.com/blog/2392-introducing-code-owners
# https://help.github.com/articles/about-codeowners
# These owners will be the default owners for everything in the repo.
* @luhenry @marek-safar
# Order is important. The last matching pattern has the most precedence.
/acceptance-tests @akoeplinger
/acceptance-tests/profiler-stress* @alexrp
/data @marek-safar @akoeplinger @luhenry
/data/gdb @vargaz
/data/lldb @lewurm @vargaz
/docs @luhenry @marek-safar
/docs/sources/mono-api-profiler.html @alexrp
/external @marek-safar @luhenry
/external/binary-reference-assemblies @marek-safar @akoeplinger
/external/bockbuild @akoeplinger @alexischr
/external/boringssl @baulig
/external/nuget-buildtasks @radical @akoeplinger
/libgc @BrzVlad @vargaz @luhenry
/llvm @vargaz @luhenry
/man @marek-safar @miguel @luhenry
/man/*prof* @alexrp
/mcs @marek-safar @luhenry
/mcs/build @marek-safar @akoeplinger
/mcs/class @marek-safar @akoeplinger
/mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
/mcs/class/Mono.Btls.Interface @baulig
/mcs/class/Mono.Data.Tds @egorbo
/mcs/class/Mono.Debugger.Soft @vargaz
/mcs/class/Mono.Options @jonpryor
/mcs/class/Mono.Profiler.Log @alexrp
/mcs/class/Mono.Security/Mono.Security/Interface @baulig
/mcs/class/System/Mono.AppleTls @baulig
/mcs/class/System/Mono.Btls @baulig
/mcs/class/System/Mono.Net.Security @baulig
/mcs/class/System/Mono.Security.Interface @baulig
/mcs/class/System.Data* @egorbo
/mcs/errors @marek-safar
/mcs/ilasm @marek-safar
/mcs/jay @marek-safar
/mcs/mcs @marek-safar @lewurm
/mcs/tests @marek-safar
/mcs/tools @marek-safar @akoeplinger
/mono @luhenry
/mono/btls @baulig
/mono/dis @lambdageek @vargaz
/mono/eglib @kumpera @vargaz @luhenry
/mono/metadata @vargaz @kumpera
/mono/metadata/*verify* @kumpera
/mono/metadata/*profiler* @alexrp
/mono/metadata/monitor* @brzvlad
/mono/metadata/sgen* @brzvlad
/mono/metadata/threads* @luhenry @kumpera
/mono/metadata/threadpool* @luhenry
/mono/metadata/w32* @luhenry
/mono/metadata/*-win* @lateralusX @luhenry
/mono/mini @vargaz @kumpera
/mono/mini/*cfgdump* @lewurm
/mono/mini/*exceptions* @lewurm
/mono/mini/*ppc* @lewurm
/mono/mini/*type-check* @lewurm
/mono/mini/interp/* @lewurm @BrzVlad
/mono/mini/*profiler* @alexrp
/mono/mini/debugger-agent.c @DavidKarlas
/mono/profiler @alexrp @kumpera
/mono/sgen @BrzVlad @kumpera
/mono/utils @kumpera @vargaz
/mono/utils/atomic* @alexrp
/mono/utils/mono-hwcap* @alexrp
/mono/utils/mono-mem* @alexrp
/mono/utils/mono-threads* @luhenry @kumpera
/mono/utils/*-win* @lateralusX @kumpera
/msvc @lateralusX @luhenry
/msvc/*profiler* @alexrp
/msvc/scripts @akoeplinger @kg
/packaging/ @alexischr @akoeplinger @luhenry @directhex
/packaging/MacSDK/msbuild.py @radical @akoeplinger
/runtime @akoeplinger @marek-safar @luhenry
/samples @luhenry
/samples/profiler @alexrp
/samples/size @alexrp
/scripts @akoeplinger @luhenry
/scripts/ci @akoeplinger @alexischr
/scripts/ci/run-test-profiler-stress-tests.sh @alexrp
/sdks @marek-safar @luhenry
/sdks/builds/android* @luhenry @jonpryor
/sdks/builds/mxe* @luhenry @jonpryor
/sdks/builds/ios* @vargaz @rolfbjarne
/sdks/wasm @kumpera @lrz
/sdks/ios @vargaz @rolfbjarne
/sdks/android @luhenry @jonpryor
/support @luhenry @vargaz
/tools @kumpera @luhenry
/tools/checker @tritao
/tools/crash-bisector @kumpera
/tools/locale-builder @marek-safar
/tools/monograph @vargaz
/tools/nuget-hash-extractor @marek-safar
/tools/offsets-tool @lewurm @rolfbjarne
/tools/pedump @kumpera @lambdageek
/tools/sgen @brzvlad
+1 -1
View File
@@ -46,7 +46,7 @@ embeddable runtime:
* mono/utils/bsearch.c: BSD license.
* mono/io-layer/wapi_glob.h, wapi_glob.c: BSD license
* mono/metadata/w32file-unix-glob.c, w32file-unix-glob.h: BSD license
Class Library code
==================
+20 -24
View File
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(WERROR_CFLAGS)
MONOTOUCH_SUBDIRS = $(libgc_dir) eglib/src mono
MONOTOUCH_SUBDIRS = $(libgc_dir) mono
# Some tools might not build when cross-compiling
if CROSS_COMPILING
@@ -11,9 +11,9 @@ else
tools_dir = tools
endif
SUBDIRS = po $(libgc_dir) eglib mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
SUBDIRS = mk po $(libgc_dir) llvm mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests
# Keep in sync with SUBDIRS
DIST_SUBDIRS = m4 po $(libgc_dir) eglib mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
DIST_SUBDIRS = m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests
all: update_submodules
@@ -42,8 +42,16 @@ dist-hook:
test -d $(distdir)/mcs || mkdir $(distdir)/mcs
d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
rm -rf `find $(top_distdir)/external -path '*\.git'`
rm -rf `find $(top_distdir)/external -path '*\.libs'`
rm -rf `find $(top_distdir)/external -path '*\.deps'`
rm -f `find $(top_distdir)/external -path '*\.o'`
rm -f `find $(top_distdir)/external -path '*\.so'`
rm -f `find $(top_distdir)/external -path '*\.lo'`
rm -f `find $(top_distdir)/external -path '*\.Plo'`
rm -f `find $(top_distdir)/external -name '\.dirstamp'`
rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'`
rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*'`
rm -rf "$(top_distdir)/external/linker/linker/Tests"
pkgconfigdir = $(libdir)/pkgconfig
noinst_DATA = mono-uninstalled.pc
@@ -109,29 +117,12 @@ monotouch-do-clean:
endif
win32getdeps:
wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip
wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip
wget http://www.go-mono.com/archive/libiconv-1.7.zip
wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip
wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
unzip -n -d / pkgconfig-0.11-20020310.zip
unzip -n -d / glib-2.0.4-20020703.zip
unzip -n -d / glib-dev-2.0.4-20020703.zip
unzip -n -d / libiconv-1.7.zip
unzip -n -d / libiconv-dev-1.7.zip
unzip -n -d / libintl-0.10.40-20020101.zip
win32setup:
makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
update-csproj:
-rm msvc/scripts/order
-rm msvc/scripts/order.xml
-rm -rf msvc/scripts/inputs
-mkdir msvc/scripts/inputs
(cd runtime; make V=1 extra_targets=csproj-local)
(cd runtime; $(MAKE) V=1 extra_targets=csproj-local)
package-inputs:
echo '<?xml version="1.0" encoding="utf-8"?>' > msvc/scripts/order.xml
@@ -142,6 +133,7 @@ package-inputs:
(echo " <project dir=\"$$1\" library=\"$$2\">"; \
read boot; echo " <boot>$$boot</boot>"; \
read flags; echo " <flags>$$flags</flags>"; \
read sources;echo " <sources>$$sources</sources>"; \
read output; echo " <output>$$output</output>"; \
read built; echo " <built_sources>`echo $$built | sed 's/\\\/\\\\/g'`</built_sources>"; \
read libou; echo " <library_output>$$libou</library_output>"; \
@@ -160,6 +152,10 @@ update-llvm-version:
update-solution-files:
make update-csproj
make package-inputs
(cd msvc/scripts; make genproj.exe; mono genproj.exe)
cd msvc/scripts && $(MAKE) genproj.exe || exit $$?;
$(MAKE) update-csproj
$(MAKE) package-inputs
(cd msvc/scripts; mono --debug genproj.exe $(GENPROJ_ARGS))
update-solution-files-with-tests:
$(MAKE) "GENPROJ_ARGS=2012 true true" update-solution-files
+76 -40
View File
@@ -19,30 +19,31 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or
| OS | Architecture | Status |
|--------------|--------------------|------------------------------|
| Ubuntu 14.04 | amd64 | [![ubuntu-1404-amd64][1]][2] |
| Ubuntu 14.04 | i386 | [![ubuntu-1404-i386][3]][4] |
| Debian 8 | armel | [![debian-8-armel][5]][6] |
| Debian 8 | armhf | [![debian-8-armhf][7]][8] |
| Debian 8 | arm64 | [![debian-8-arm64][9]][10] |
| Debian 9 | amd64 | [![debian-9-amd64][1]][2] |
| Debian 9 | i386 | [![debian-9-i386][3]][4] |
| Debian 9 | armel | [![debian-9-armel][5]][6] |
| Debian 9 | armhf | [![debian-9-armhf][7]][8] |
| Debian 9 | arm64 | [![debian-9-arm64][9]][10] |
| OS X | amd64 | [![osx-amd64][11]][12] |
| OS X | i386 | [![osx-i386][13]][14] |
| Windows | amd64 | [![windows-amd64][15]][16] |
| Windows | i386 | [![windows-amd64][17]][18] |
| Windows | i386 | [![windows-i386][17]][18] |
| CentOS | s390x (cs) | [![centos-s390x][19]][20] |
| Debian 8 | ppc64el (cs) | [![debian-8-ppc64el][21]][22]|
| Debian 9 | ppc64el (cs) | [![debian-9-ppc64el][21]][22]|
| AIX | ppc64 (cs) | [![aix-ppc64][23]][24] |
_(cs) = community supported architecture_
[1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon
[2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64
[3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/badge/icon
[4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/
[5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/badge/icon
[6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/
[7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/badge/icon
[8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/
[9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon
[10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/
[1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
[2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
[3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
[4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
[5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
[6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
[7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
[8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
[9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
[10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
[11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
[12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
[13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
@@ -53,8 +54,10 @@ _(cs) = community supported architecture_
[18]: https://jenkins.mono-project.com/job/z/label=w32/
[19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
[20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
[21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-8-ppc64el/badge/icon
[22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-8-ppc64el
[21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
[22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
[23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
[24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
Compilation and Installation
============================
@@ -111,7 +114,7 @@ Once you have installed the software, you can run a few programs:
* `mono program.exe` runtime engine
* `mcs program.cs` C# compiler
* `mcs program.cs` C# compiler
* `monodis program.exe` CIL Disassembler
@@ -128,6 +131,14 @@ Directory Roadmap
* `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
* `ikvm-native/` - Glue code for ikvm.
* `libgc/` - The (deprecated) Boehm GC implementation.
* `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
* `m4/` - General utility Makefiles.
* `man/` - Manual pages for the various Mono commands and programs.
* `mcs/` - The class libraries, compiler and tools
@@ -142,26 +153,52 @@ Directory Roadmap
* `arch/` - Architecture specific portions.
* `benchmark/` - A collection of benchmarks.
* `btls/` - Build files for the BTLS library which incorporates BoringSSL.
* `cil/` - Common Intermediate Representation, XML
definition of the CIL bytecodes.
* `dis/` - CIL executable Disassembler
* `dis/` - CIL executable Disassembler.
* `io-layer/` - The I/O layer and system abstraction for
emulating the .NET IO model.
* `eglib/` - Independent implementation of the glib API.
* `metadata/` - The object system and metadata reader.
* `mini/` - The Just in Time Compiler.
* `profiler/` - The profiler implementation.
* `sgen/` - The SGen Garbage Collector implementation.
* `tests/` - The main runtime tests.
* `unit-tests/` - Additional runtime unit tests.
* `utils/` - Utility functions used across the runtime codebase.
* `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
The latter is experimental at the moment.
* `packaging/` - Packaging logic for the OS X and Windows Mono packages.
* `po/` - Translation files.
* `runtime/` - A directory that contains the Makefiles that link the
mono/ and mcs/ build systems.
* `samples/` -Some simple sample programs on uses of the Mono
runtime as an embedded library.
* `samples/` - Some simple sample programs on uses of the Mono
runtime as an embedded library.
* `scripts/` - Scripts used to invoke Mono and the corresponding program.
* `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
* `support/` - Various support libraries.
* `tools/` - A collection of tools, mostly used during Mono development.
Contributing to Mono
====================
@@ -174,8 +211,7 @@ section.
Reporting bugs
==============
To submit bug reports, please use [Xamarin's
Bugzilla](https://bugzilla.xamarin.com/)
To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
Please use the search facility to ensure the same bug hasn't already
been submitted and follow our
@@ -208,12 +244,12 @@ Disables the inclusion of a Boehm garbage collector.
* This defaults to `included`.
* `--with-cooperative-gc`
* `--enable-cooperative-suspend`
* If you pass this flag the Mono runtime is configured to only use
the cooperative mode of the garbage collector. If you do not pass
this flag, then you can control at runtime the use of the
cooperative GC mode by setting the `MONO_ENABLE_COOP` flag.
cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
* `--with-tls=__thread,pthread`
@@ -308,16 +344,6 @@ should be used.
* Or you can specify a path to a libgdiplus.
* `--disable-shared-memory`
* Use this option to disable the use of shared memory in
Mono (this is equivalent to setting the MONO_DISABLE_SHM
environment variable, although this removes the feature
completely).
* Disabling the shared memory support will disable certain
features like cross-process named mutexes.
* `--enable-minimal=LIST`
* Use this feature to specify optional runtime
@@ -483,6 +509,16 @@ http://code.google.com/p/nativeclient/
* Currently this is used with Mono's AOT engine as
Native Client does not support JIT engines yet.
* `--enable-wasm`
* Use this option to configure mono to run on WebAssembly. It will
set both host and target to the WebAssembly triplet. This overrides
the values passed to `--host` or `--target` and ignored what config.sub guesses.
This is a workaround to enable usage of old automake versions that don't
recognize the wasm triplet.
Working With Submodules
=======================
@@ -542,7 +578,7 @@ file for information about Microsoft's patent grant.
Mono Trademark Use Policy
=========================
The use of trademarks and logos for Mono can be found [here] (http://www.dotnetfoundation.org/legal/mono-tm).
The use of trademarks and logos for Mono can be found [here](http://www.dotnetfoundation.org/legal/mono-tm).
Maintaining the Class Library Solution Files
============================================
+2 -1
View File
@@ -5,7 +5,7 @@ CORECLR_PATH=$(ACCEPTANCE_TESTS_PATH)/coreclr
MSTESTSUITE_PATH=$(ACCEPTANCE_TESTS_PATH)/ms-test-suite
CLEANFILES = *.dll *.exe *.mdb
EXTRA_DIST=README.md SUBMODULES.json versions.mk roslyn.mk coreclr.mk ms-test-suite.mk
EXTRA_DIST=README.md SUBMODULES.json versions.mk profiler-stress.mk roslyn.mk coreclr.mk ms-test-suite.mk
CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
TOOLS_CLASS=$(mcs_topdir)/class/lib/build
@@ -14,6 +14,7 @@ RUNTIME = MONO_PATH=$(CLASS) $(abs_top_builddir)/runtime/mono-wrapper --debug
TOOLS_RUNTIME = MONO_PATH=$(TOOLS_CLASS) $(abs_top_builddir)/runtime/mono-wrapper --debug
MCS = $(TOOLS_RUNTIME) $(CSC) -nologo -noconfig -lib:$(CLASS) -r:System.dll -r:System.Core.dll -r:System.Xml.dll -r:Microsoft.CSharp.dll
ILASM = $(TOOLS_RUNTIME) $(TOOLS_CLASS)/ilasm.exe
XUNIT = $(RUNTIME) $(abs_top_builddir)/external/xunit-binaries/xunit.console.exe
include versions.mk
include profiler-stress.mk
+7 -7
View File
@@ -1,16 +1,16 @@
[
{
"name": "roslyn",
"url": "git://github.com/dotnet/roslyn.git",
"rev": "322bd5b2bbf07df6a67de35cbcb2365484412f70",
"remote-branch": "origin/master",
"branch": "master",
"url": "git://github.com/mono/roslyn.git",
"rev": "380eec412868464a132cdcd3a45ef457fab6e060",
"remote-branch": "origin/mono-testing",
"branch": "mono-testing",
"directory": "roslyn"
},
{
"name": "coreclr",
"url": "git://github.com/mono/coreclr.git",
"rev": "c7da48acf72c40c0c0ed1a80ebfacea21bb3a271",
"rev": "aa62c0382ae79562293f3ea1a94ef0f16f80f498",
"remote-branch": "origin/mono",
"branch": "mono",
"directory": "coreclr"
@@ -18,7 +18,7 @@
{
"name": "ms-test-suite",
"url": "[email protected]:xamarin/ms-test-suite.git",
"rev": "73c155f76b55839f26ba707d6d40091060e4f5d8",
"rev": "67f29dfc0741b5311dd746c75760963a2915e648",
"remote-branch": "origin/master",
"branch": "master",
"directory": "ms-test-suite"
@@ -31,4 +31,4 @@
"branch": "master",
"directory": "benchmarker"
}
]
]
+11 -8
View File
@@ -32,7 +32,7 @@ coreclr-runtest-coremanglib: coreclr-validate test-runner.exe $(CORECLR_COREMANG
check-coreclr: coreclr-compile-tests coreclr-runtest-basic coreclr-runtest-coremanglib
coreclr-gcstress: coreclr-validate GCStressTests.exe $(CORECLR_STRESSTESTSI_CS)
BVT_ROOT=$(realpath $(CORECLR_PATH)/tests/src/GC/Stress/Tests) $(RUNTIME) GCStressTests.exe $(CORECLR_PATH)/tests/src/GC/Stress/testmix_gc.config; if [ $$? -ne 100 ]; then exit 1; fi
BVT_ROOT=$(realpath $(CORECLR_PATH)/tests/src/GC/Stress/Tests) $(RUNTIME) GCStressTests.exe $(CORECLR_PATH)/tests/src/GC/Stress/$(if $(CI_PR),testmix_gc_pr.config,testmix_gc.config); if [ $$? -ne 100 ]; then exit 1; fi
# Output a variable in $(2) to the file $(1), separated by newline characters
# we need to do it in groups of 100 entries to make sure we don't exceed shell char limits
@@ -2162,7 +2162,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleepsilon.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleequals1.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleequals2.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doublegethashcode.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletoboolean.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletobyte.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletodatetime.cs \
@@ -2217,7 +2216,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcgettotalmemory.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcmaxgeneration.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcwaitforpendingfinalizers.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstday.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstfourdayweek.cs \
@@ -3243,7 +3241,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/security/securityexception/securityexceptionctor3.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/security/securityexception/securityexceptiontostring.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleepsilon.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singlegethashcode.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisinfinity.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisnan.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisnegativeinfinity.cs \
@@ -3716,7 +3713,7 @@ CORECLR_DISABLED_TEST_CS_SRC += \
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/readytorun/main.cs \
$(CORECLR_PATH)/tests/src/readytorun/test.cs
# relies on a referenced managed or native assembly, to complicated here:
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/Regressions/assemblyref/assem.cs \
@@ -3856,7 +3853,7 @@ CORECLR_DISABLED_TEST_CS_SRC += \
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/datetime/cfdatetimetools.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/datetime/datetimeisdaylightsavingtime.cs
# relies on delegatedefinitions.cs helper
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/multicastdelegate/multicastdelegatector.cs \
@@ -3964,7 +3961,7 @@ CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/CoreMangLib/system/delegate/threatmodel/public/testclass.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/system/delegate/threatmodel/tests/bindingtarget.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/system/delegate/threatmodel/tests/testclass.cs
# samples (should probably be removed upstream)
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/hosting/samples/hosting/usercode/usercode.cs \
@@ -3982,6 +3979,10 @@ CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/JIT/Directed/newarr/newarr.cs \
$(CORECLR_PATH)/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
# https://github.com/mono/mono/issues/7432
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs
CORECLR_TEST_IL_SRC = \
$(CORECLR_PATH)/tests/src/JIT/BBT/Scenario4/Not-Int32.il \
$(CORECLR_PATH)/tests/src/JIT/Directed/Convert/implicitConv.il \
@@ -4966,7 +4967,6 @@ CORECLR_TEST_IL_SRC = \
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/223862/rem.il \
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/228572/conv.il \
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/481244/foo.il \
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/481244/foo2.il \
$(CORECLR_PATH)/tests/src/JIT/jit64/regress/ddb/118414/118414.il \
$(CORECLR_PATH)/tests/src/JIT/jit64/regress/ddb/127931/127931.il \
$(CORECLR_PATH)/tests/src/JIT/jit64/regress/vsw/102974/test.il \
@@ -5058,6 +5058,9 @@ CORECLR_DISABLED_TEST_IL_SRC += \
CORECLR_DISABLED_TEST_IL_SRC += \
$(CORECLR_PATH)/tests/src/JIT/Directed/coverage/oldtests/lcliimpl.il
# We use an r4 for r4-r8 stack merge so it loses precision
CORECLR_DISABLED_TEST_IL_SRC += \
$(CORECLR_PATH)/tests/src/JIT/jit64/opt/regress/vswhidbey/481244/foo2.il
# FIXME: these tests are baselined, i.e. we don't have time to investigate
# them right now but want to make sure we don't introduce new regressions
+4 -2
View File
@@ -1,9 +1,11 @@
check-ms-test-suite: $(CLASS)/nunitlite.dll
@if $(MAKE) validate-ms-test-suite RESET_VERSIONS=1; then \
$(MAKE) -C $(MSTESTSUITE_PATH)/conformance build MCS="$(MCS) -debug:portable -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug:portable -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
$(MAKE) -C $(MSTESTSUITE_PATH)/System.Linq.Expressions build MCS="$(MCS) -debug:portable -t:library -warn:1 -r:$(CLASS)/nunitlite.dll" && \
$(MAKE) -C $(MSTESTSUITE_PATH)/conformance run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-conformance.xml" || EXIT_CODE=1; \
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup build MCS="$(MCS) -debug:portable -warn:1" && \
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run MONO="$(RUNTIME)" || EXIT_CODE=1; \
$(MAKE) -C $(MSTESTSUITE_PATH)/systemruntimebringup run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-systemruntimebringup.xml" || EXIT_CODE=1; \
$(MAKE) -C $(MSTESTSUITE_PATH)/System.Linq.Expressions run NUNIT-CONSOLE="$(RUNTIME) $(CLASS)/nunit-lite-console.exe -exclude=MonoBug,BadTest -format:nunit2" NUNIT_XML_RESULT="-result:$(abs_top_builddir)/acceptance-tests/TestResult-ms-test-suite-systemlinqexpressions.xml" || EXIT_CODE=1; \
exit $$EXIT_CODE; \
else \
echo "*** [ms-test-suite] Getting the repository failed, you probably don't have access to this Xamarin-internal resource. Skipping."; \
+1 -1
View File
@@ -9,5 +9,5 @@ SYS_REFS = \
check-profiler-stress:
@$(MAKE) validate-benchmarker RESET_VERSIONS=1
cd profiler-stress && $(MCS) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
cd profiler-stress && $(MCS) -debug -define:ARCH_$(arch_target) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
cd profiler-stress && $(RUNTIME) runner.exe
+103 -35
View File
@@ -38,79 +38,134 @@ namespace Mono.Profiling.Tests.Stress {
public ProcessStartInfo StartInfo { get; set; }
public Stopwatch Stopwatch { get; set; } = new Stopwatch ();
public int? ExitCode { get; set; }
public StringBuilder StandardOutput { get; set; } = new StringBuilder ();
public StringBuilder StandardError { get; set; } = new StringBuilder ();
public string StandardOutput { get; set; }
public string StandardError { get; set; }
}
static class Program {
static readonly string[] _options = new [] {
"domain",
"assembly",
"module",
"class",
"jit",
"exception",
"gcalloc",
"gc",
"thread",
// "calls", // Way too heavy.
"monitor",
"gc",
"gcalloc",
"gcmove",
"gcroot",
"context",
"gchandle",
"finalization",
"counter",
"gchandle",
"jit",
};
static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
static string FilterInvalidXmlChars (string text) {
const RegexOptions _regexOptions = RegexOptions.Compiled | RegexOptions.Singleline;
static readonly Dictionary<string, Predicate<Benchmark>> _filters = new Dictionary<string, Predicate<Benchmark>> {
{ "ironjs-v8", FilterNotOnArm },
{ "msbiology", FilterNever },
};
static bool FilterNever (Benchmark benchmark)
{
return false;
}
static bool FilterNotOnArm (Benchmark benchmark)
{
#if ARCH_arm || ARCH_arm64
return false;
#else
return true;
#endif
}
static bool IsSupported (Benchmark benchmark)
{
return _filters.TryGetValue (benchmark.Name, out var filter) ? filter (benchmark) : true;
}
static string ReplaceInvalidXmlChars (string text) {
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
}
static int Main ()
{
var regex = new Regex (".*", _regexOptions);
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_REGEX") is string envRegex)
regex = new Regex (envRegex, _regexOptions);
var depDir = Path.Combine ("..", "external", "benchmarker");
var benchDir = Path.Combine (depDir, "benchmarks");
var testDir = Path.Combine (depDir, "tests");
var benchmarks = Directory.EnumerateFiles (benchDir, "*.benchmark")
.Select (Benchmark.Load)
.Where (b => !b.OnlyExplicit && b.ClientCommandLine == null)
.Where (b => !b.OnlyExplicit && b.ClientCommandLine == null && IsSupported (b) && regex.IsMatch (b.Name))
.OrderBy (b => b.Name)
.ToArray ();
var monoPath = Path.GetFullPath (Path.Combine ("..", "..", "runtime", "mono-wrapper"));
var classDir = Path.GetFullPath (Path.Combine ("..", "..", "mcs", "class", "lib", "net_4_x"));
var rand = new Random ();
var seed = Environment.TickCount;
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_SEED") is string envSeed)
seed = int.Parse (envSeed);
var timeout = (int) _timeout.TotalMilliseconds;
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_TIMEOUT") is string envTimeout)
timeout = (int) TimeSpan.Parse (envTimeout).TotalMilliseconds;
string options = null;
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_OPTIONS") is string envOptions)
options = envOptions;
var suspend = false;
if (Environment.GetEnvironmentVariable ("MONO_PROFILER_STRESS_SUSPEND") is string envSuspend)
suspend = bool.Parse (envSuspend);
var rand = new Random (seed);
var cpus = Environment.ProcessorCount;
var results = new List<TestResult> (benchmarks.Length);
var sw = Stopwatch.StartNew ();
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine ($"[{sw.Elapsed.ToString ("G")}] Starting test session with seed: {seed}");
Console.ResetColor ();
var results = new List<TestResult> (benchmarks.Length);
for (var i = 0; i < benchmarks.Length; i++) {
var bench = benchmarks [i];
var sampleFreq = rand.Next (-1000, 1001);
var sampleMode = rand.Next (0, 2) == 1 ? "real" : "process";
var sampleMode = rand.Next (0, 2) == 1 ? "-real" : string.Empty;
var maxSamples = rand.Next (0, cpus * 2000 + 1);
var heapShotFreq = rand.Next (-10, 11);
var maxFrames = rand.Next (0, 33);
var options = _options.ToDictionary (x => x, _ => rand.Next (0, 2) == 1)
.Select (x => (x.Value ? string.Empty : "no") + x.Key)
.ToArray ();
var flags = _options.ToDictionary (x => x, _ => rand.Next (0, 2) == 1)
.Select (x => (x.Value ? string.Empty : "no") + x.Key)
.ToArray ();
var profOptions = $"maxframes={maxFrames},{string.Join (",", options)},output=/dev/null";
var profOptions = "nodefaults,output=/dev/null,";
if (sampleFreq > 0)
profOptions += $",sample={sampleFreq},sampling-{sampleMode},maxsamples={maxSamples}";
if (options == null) {
profOptions += $"maxframes={maxFrames},";
if (heapShotFreq > 0)
profOptions += $",heapshot={heapShotFreq}gc";
if (sampleFreq > 0)
profOptions += $"sample{sampleMode}={sampleFreq},maxsamples={maxSamples},";
if (heapShotFreq > 0)
profOptions += $"heapshot={heapShotFreq}gc,";
profOptions += string.Join (",", flags);
} else
profOptions += options;
var info = new ProcessStartInfo {
UseShellExecute = false,
@@ -124,6 +179,9 @@ namespace Mono.Profiling.Tests.Stress {
info.EnvironmentVariables.Clear ();
info.EnvironmentVariables.Add ("MONO_PATH", classDir);
if (suspend)
info.EnvironmentVariables.Add ("MONO_DEBUG", "suspend-on-native-crash,suspend-on-unhandled");
var progress = $"({i + 1}/{benchmarks.Length})";
Console.ForegroundColor = ConsoleColor.Blue;
@@ -138,14 +196,19 @@ namespace Mono.Profiling.Tests.Stress {
using (var proc = new Process ()) {
proc.StartInfo = info;
var stdout = new StringBuilder ();
var stderr = new StringBuilder ();
proc.OutputDataReceived += (sender, args) => {
if (args.Data != null)
result.StandardOutput.AppendLine (args.Data);
lock (result)
stdout.AppendLine (args.Data);
};
proc.ErrorDataReceived += (sender, args) => {
if (args.Data != null)
result.StandardError.AppendLine (args.Data);
lock (result)
stderr.AppendLine (args.Data);
};
result.Stopwatch.Start ();
@@ -155,7 +218,7 @@ namespace Mono.Profiling.Tests.Stress {
proc.BeginOutputReadLine ();
proc.BeginErrorReadLine ();
if (!proc.WaitForExit ((int) _timeout.TotalMilliseconds)) {
if (!proc.WaitForExit (timeout)) {
// Force a thread dump.
Syscall.kill (proc.Id, Signum.SIGQUIT);
Thread.Sleep (1000);
@@ -168,6 +231,11 @@ namespace Mono.Profiling.Tests.Stress {
result.ExitCode = proc.ExitCode;
result.Stopwatch.Stop ();
lock (result) {
result.StandardOutput = stdout.ToString ();
result.StandardError = stderr.ToString ();
}
}
var resultStr = result.ExitCode == null ? "timed out" : $"exited with code: {result.ExitCode}";
@@ -181,13 +249,13 @@ namespace Mono.Profiling.Tests.Stress {
Console.WriteLine ("===== stdout =====");
Console.ResetColor ();
Console.WriteLine (result.StandardOutput.ToString ());
Console.WriteLine (result.StandardOutput);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine ("===== stderr =====");
Console.ResetColor ();
Console.WriteLine (result.StandardError.ToString ());
Console.WriteLine (result.StandardError);
}
results.Add (result);
@@ -206,7 +274,7 @@ namespace Mono.Profiling.Tests.Stress {
using (var writer = XmlWriter.Create ("TestResult-profiler-stress.xml", settings)) {
writer.WriteStartDocument ();
writer.WriteComment ("This file represents the results of running a test suite");
writer.WriteComment ($"This file represents the results of running a test suite (seed: {seed})");
writer.WriteStartElement ("test-results");
writer.WriteAttributeString ("name", "profiler-stress-tests.dummy");
@@ -267,11 +335,11 @@ namespace Mono.Profiling.Tests.Stress {
writer.WriteStartElement ("failure");
writer.WriteStartElement ("message");
writer.WriteCData (FilterInvalidXmlChars (result.StandardOutput.ToString ()));
writer.WriteCData (ReplaceInvalidXmlChars (result.StandardOutput));
writer.WriteEndElement ();
writer.WriteStartElement ("stack-trace");
writer.WriteCData (FilterInvalidXmlChars (result.StandardError.ToString ()));
writer.WriteCData (ReplaceInvalidXmlChars (result.StandardError));
writer.WriteEndElement ();
writer.WriteEndElement ();
+2 -15
View File
@@ -1,18 +1,5 @@
check-roslyn:
@$(MAKE) validate-roslyn RESET_VERSIONS=1
@if [ -z $$PREFIX ]; then echo "You need to set PREFIX to the prefix of the Mono installation that should be used for testing Roslyn." && exit 1; fi
sed -i -e 's/\\4.5-api"/\\4.5"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \
export MSBuildExtensionsPath=$$PREFIX/lib/mono/xbuild; \
MONO_DOTNET_PORTABLE_DIR=$$PREFIX/lib/mono/xbuild-frameworks/.NETPortable/; \
if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v4.6" ]; then \
mkdir -p $$MONO_DOTNET_PORTABLE_DIR; \
curl -SL "http://download.mono-project.com/third-party/RoslynBuildDependencies.zip" > /tmp/RoslynBuildDependencies.zip; \
unzip -o /tmp/RoslynBuildDependencies.zip -d /tmp/RoslynBuildDependencies; \
cp -r /tmp/RoslynBuildDependencies/PortableReferenceAssemblies/* $$MONO_DOTNET_PORTABLE_DIR; \
fi; \
cd $(ROSLYN_PATH); \
sed -i -e 'N; s/bootstrapArg=".*\n.*"/bootstrapArg=""/g' cibuild.sh; \
sed -i -e 's#-xml Binaries/\$$BUILD_CONFIGURATION/xUnitResults/#-nunit $(abs_top_builddir)/acceptance-tests/TestResult-#g' cibuild.sh; \
./cibuild.sh --mono-path $$PREFIX/bin || EXIT_CODE=1; \
sed -i -e 's/\\4.5"/\\4.5-api"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \
exit $$EXIT_CODE
./mono-testing.sh "$(XUNIT)" || exit; \
echo "done"
+5 -9
View File
@@ -89,9 +89,11 @@ if test x$NOCONFIGURE = x && test -z "$*"; then
echo
fi
am_opt="--add-missing --copy --gnu -Wno-portability -Wno-obsolete"
case $CC in
xlc )
am_opt=--include-deps;;
am_opt="$am_opt --include-deps";;
esac
@@ -142,8 +144,8 @@ if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu -Wno-portability -Wno-obsolete $am_opt ||
echo "Running automake $am_opt ..."
automake $am_opt ||
{ echo "**Error**: automake failed."; exit 1; }
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
@@ -154,12 +156,6 @@ if test -d $srcdir/libgc; then
echo Done running libgc/autogen.sh ...
fi
if test -d $srcdir/eglib; then
echo Running eglib/autogen.sh ...
(cd $srcdir/eglib ; NOCONFIGURE=1 ./autogen.sh "$@")
echo Done running eglib/autogen.sh ...
fi
if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
fi
+11427
View File
File diff suppressed because it is too large. Load diff
+1583 -347
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -11,6 +11,7 @@
<dllmap dll="oci" target="libclntsh@libsuffix@" os="!windows"/>
<dllmap dll="db2cli" target="libdb2_36@libsuffix@" os="!windows"/>
<dllmap dll="MonoPosixHelper" target="$mono_libdir/libMonoPosixHelper@libsuffix@" os="!windows" />
<dllmap dll="System.Native" target="$mono_libdir/libmono-system-native@libsuffix@" os="!windows" />
<dllmap dll="libmono-btls-shared" target="$mono_libdir/libmono-btls-shared@libsuffix@" os="!windows" />
<dllmap dll="i:msvcrt" target="@LIBC@" os="!windows"/>
<dllmap dll="i:msvcrt.dll" target="@LIBC@" os="!windows"/>
+12 -12
View File
@@ -53,7 +53,7 @@ def stringify_class_name(ns, name):
if ns == "":
return name
else:
return "{}.{}".format (ns, name)
return "{0}.{1}".format (ns, name)
class ArrayPrinter:
"Print a C# array"
@@ -66,7 +66,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
class ObjectPrinter:
"Print a C# object"
@@ -96,7 +96,7 @@ class ObjectPrinter:
return (field.name, self.obj [field.name])
except:
# Superclass
return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name))))
return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name))))
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
@@ -109,7 +109,7 @@ class ObjectPrinter:
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
if class_name [-2:len(class_name)] == "[]":
return {}.__iter__ ()
gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name))
gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name))
return self._iterator(obj.cast (gdb_type))
except:
print (sys.exc_info ()[0])
@@ -129,12 +129,12 @@ class ObjectPrinter:
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name))
gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name))
except:
# Maybe there is no debug info for that type
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
#return obj.cast (gdb_type)
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
return class_name
except:
print (sys.exc_info ()[0])
@@ -154,9 +154,9 @@ class MonoMethodPrinter:
val = self.val.dereference ()
klass = val ["klass"].dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
return "\"{}:{} ()\"".format (class_name, val ["name"].string ())
return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ())
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
class MonoClassPrinter:
"Print a MonoClass structure"
@@ -169,9 +169,9 @@ class MonoClassPrinter:
return "0x0"
klass = self.val.dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
return "\"{}\"".format (class_name)
return "\"{0}\"".format (class_name)
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
def lookup_pretty_printer(val):
t = str (val.type)
@@ -245,4 +245,4 @@ exec_file = gdb.current_objfile ().filename
if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
exec_file = os.readlink (exec_file)
exec_dir = os.path.dirname (exec_file)
gdb.execute ("source {}/{}-gdbinit".format (exec_dir, os.path.basename (exec_file)))
gdb.execute ("source {0}/{1}-gdbinit".format (exec_dir, os.path.basename (exec_file)))
+16 -16
View File
@@ -48,7 +48,7 @@ def stringify_class_name(ns, name):
if ns == "":
return name
else:
return "{}.{}".format (ns, name)
return "{0}.{1}".format (ns, name)
class ArrayPrinter:
"Print a C# array"
@@ -61,7 +61,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
class ObjectPrinter:
"Print a C# object"
@@ -91,7 +91,7 @@ class ObjectPrinter:
return (field.name, self.obj [field.name])
except:
# Superclass
return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name))))
return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name))))
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
@@ -105,7 +105,7 @@ class ObjectPrinter:
if class_name [-2:len(class_name)] == "[]":
return {}.__iter__ ()
try:
gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name))
gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name))
return self._iterator(obj.cast (gdb_type))
except:
return {}.__iter__ ()
@@ -127,12 +127,12 @@ class ObjectPrinter:
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name))
gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name))
except:
# Maybe there is no debug info for that type
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
#return obj.cast (gdb_type)
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
return class_name
except:
print (sys.exc_info ()[0])
@@ -152,9 +152,9 @@ class MonoMethodPrinter:
val = self.val.dereference ()
klass = val ["klass"].dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
return "\"{}:{} ()\"".format (class_name, val ["name"].string ())
return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ())
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
class MonoClassPrinter:
"Print a MonoClass structure"
@@ -168,11 +168,11 @@ class MonoClassPrinter:
klass = self.val.dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
if add_quotes:
return "\"{}\"".format (class_name)
return "\"{0}\"".format (class_name)
else:
return class_name
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
def to_string(self):
try:
@@ -220,7 +220,7 @@ class MonoGenericClassPrinter:
method_inst_str = ""
if int(method_inst.cast (gdb.lookup_type ("guint64"))) != 0:
method_inst_str = str(method_inst)
return "{}, [{}], [{}]>".format (container_str, class_inst_str, method_inst_str)
return "{0}, [{1}], [{2}]>".format (container_str, class_inst_str, method_inst_str)
def to_string(self):
try:
@@ -250,9 +250,9 @@ class MonoTypePrinter:
info = str(t ["data"]["generic_class"])
if info != "":
return "{{{}, {}}}".format (kind, info)
return "{{{0}, {1}}}".format (kind, info)
else:
return "{{{}}}".format (kind)
return "{{{0}}}".format (kind)
except:
#print (sys.exc_info ()[0])
#print (sys.exc_info ()[1])
@@ -281,7 +281,7 @@ class MonoMethodRgctxPrinter:
if i > 0:
inst_str = inst_str + ", "
inst_str = inst_str + type_printer.to_string ()
return "MRGCTX[{}, [{}]]".format (klass_printer.to_string(), inst_str)
return "MRGCTX[{0}, [{1}]]".format (klass_printer.to_string(), inst_str)
class MonoVTablePrinter:
"Print a MonoVTable structure"
@@ -296,7 +296,7 @@ class MonoVTablePrinter:
klass = vtable ["klass"]
klass_printer = MonoClassPrinter (klass)
return "vtable({})".format (klass_printer.to_string ())
return "vtable({0})".format (klass_printer.to_string ())
def lookup_pretty_printer(val):
t = str (val.type)
+2 -2
View File
@@ -11,9 +11,9 @@ def print_frames(thread, num_frames, current_thread):
pc = str(frame.addr)
var = frame
function_name = frame.GetFunctionName()
if function_name == "ves_exec_method_with_context":
if function_name == "interp_exec_method_full":
try:
s = 'frame->runtime_method->method'
s = 'frame->imethod->method'
klassname = frame.EvaluateExpression('(char*) ' + s + '->klass->name').summary[1:-1]
methodname = frame.EvaluateExpression('(char*) ' + s + '->name').summary[1:-1]
+1 -1
View File
@@ -116,7 +116,7 @@
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
</system.net>
+1 -1
View File
@@ -132,7 +132,7 @@
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
<settings>
<ipv6 enabled="false"/>
+1 -1
View File
@@ -133,7 +133,7 @@
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
</system.net>
+2 -2
View File
@@ -11,11 +11,11 @@
<section name="assemblyBinding" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
<section name="satelliteassemblies" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
<section name="startup" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false"/>
<section name="system.codedom" type="System.CodeDom.Compiler.CodeDomConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="system.data" type="System.Data.Common.DbProviderFactoriesConfigurationHandler, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="system.diagnostics" type="System.Diagnostics.SystemDiagnosticsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
<section name="system.windows.forms" type="System.Windows.Forms.WindowsFormsSection, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="system.codedom" type="System.CodeDom.Compiler.CodeDomConfigurationHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="windows" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowLocation="false" />
<section name="strongNames" type="System.Configuration.IgnoreSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
<sectionGroup name="system.runtime.serialization" type="System.Runtime.Serialization.Configuration.SerializationSectionGroup, System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
@@ -136,7 +136,7 @@
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add prefix="ftp" type="System.Net.FtpWebRequestCreator, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</webRequestModules>
</system.net>
+10
View File
@@ -43,6 +43,16 @@
line-height: 0px;
}
.mapi-codeblock {
display: block;
padding: 5pt 5pt;
margin: 10pt;
white-space: pre;
font-family: monospace;
border: 1px solid rgba(233,233,233,1);
background-color: rgba(249,249,249,1);
}
.mapi-entry code {
border: none;
background-color: transparent;
+2 -2
View File
@@ -13,10 +13,10 @@ ASSEMBLED_DOCS = \
monoapi.tree monoapi.zip
convert.exe: $(srcdir)/convert.cs AgilityPack.dll
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -out:$@ $< -r:AgilityPack.dll
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -out:$@ $< -r:AgilityPack.dll
AgilityPack.dll:
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs
monoapi.zip: monoapi.tree
@test -f $@ || { rm -f $< && $(MAKE) $<; }
+1 -1
View File
@@ -69,5 +69,5 @@ object for filters is passed in a local variable (cfg->exvar).
throw: we first save all regs into a sigcontext struct and then call the stack
unwinding code.
catch handler: catch hanlders are always called from the stack unwinding
catch handler: catch handlers are always called from the stack unwinding
code. The exception object is passed in a local variable (cfg->exvar).
+20 -4
View File
@@ -124,6 +124,7 @@ sub process_function {
my $body = '';
my $returns = '';
my $prototype = '';
my $codeblock = 'false';
while (<$file>) {
@@ -156,7 +157,6 @@ sub process_function {
if (defined($deprecated)) {
process_formatting(\$deprecated, $file_path, $.);
}
$body =~ s/\n/ /g;
if (exists($docs->{body}->{$name})) {
my $origin = $docs->{origin}->{$name};
@@ -180,8 +180,16 @@ sub process_function {
chomp;
s/^ +\*//;
# Replace blank lines with paragraph breaks.
$_ = '<p>' if /^\s*$/;
if (/\s*\\code$/) {
$codeblock = 'true';
} elsif (/\s*\\endcode$/) {
$codeblock = 'false';
}
# Replace blank lines with paragraph breaks if we're not in a code block.
if (/^\s*$/) {
$_ = '<p>' if $codeblock eq 'false';
}
if ($section == $PARAMETER_SECTION) {
if (/\s*\\param +(\w+)(.*)/) {
@@ -210,7 +218,7 @@ sub process_function {
$returns = "\t$_\n";
$section = $RETURN_SECTION;
} else {
$body .= "\n\t$_";
$body .= "\n$_";
}
} elsif ($section == $RETURN_SECTION) {
$returns .= "\n\t$_";
@@ -227,6 +235,12 @@ sub process_formatting {
my ($content, $file_path, $current_line) = @_;
$_ = $$content;
# General formatting
s{\\b +(\w+)}{<strong>$1</strong>}g;
s{\\a +(\w+)}{<i>$1</i>}g;
s{\\e +(\w+)}{<i>$1</i>}g;
s{\\em +(\w+)}{<i>$1</i>}g;
# Constants
s{NULL}{<code>NULL</code>}g;
s{TRUE}{<code>TRUE</code>}g;
@@ -243,6 +257,8 @@ sub process_formatting {
warn "$file_path:$current_line: Old-style monodoc notation '`code`' used\n"
if s{\`((?!api:)[:.\w\*]+)\`}{<code>$1</code>}g && $WARNINGS;
s{\\c +(\S+(?<![.,:;]))}{<code>$1</code>}g;
s{\\code}{<pre><code class="mapi-codeblock">}g;
s{\\endcode}{</code></pre>}g;
$$content = $_;
}
-1
View File
@@ -37,7 +37,6 @@
<manpage name="mono-xmltool(1)" page="../man/mono-xmltool.1" />
<manpage name="mozroots(1)" page="../man/mozroots.1" />
<manpage name="permview(1)" page="../man/permview.1" />
<manpage name="prj2make(1)" page="../man/prj2make.1" />
<manpage name="resgen(1)" page="../man/resgen.1" />
<manpage name="secutil(1)" page="../man/secutil.1" />
<manpage name="setreg(1)" page="../man/setreg.1" />
+181 -61
View File
@@ -1,73 +1,193 @@
<h1>Profiling Interface</h1>
<h1>Runtime Profiler API</h1>
<h3>Profiler Operation</h3>
<p>The profiler API can be used by dynamically loaded profiler
modules to monitor different aspects of a running program. The
API is also usable by embedders without having to compile a
profiler module.
<p>The following methods can be used by dynamic profiler
methods to monitor different aspects of the program.
<h2>Profiler Modules</h2>
<p>A custom profiler will have one public method defined in
the shared library which is the entry point that Mono calls at
startup, it has the following signature:
<p>A profiler module is simply a shared library with a single
exported function which is the entry point that Mono calls at
startup. It must have the following signature:
<pre>
void mono_profiler_startup (const char *desc)
</pre>
<pre><code class="mapi-codeblock">
void mono_profiler_startup_example (const char *desc)
</code></pre>
<p>Where "desc" is the set of arguments that were passed from
the command line. This routine will call
<tt>mono_profiler_install</tt> to activate the profiler and
will install one or more filters (one of the various
<tt>mono_profiler_install_</tt> functions).
<p>Here, the <code>example</code> portion of the function name is
the name of the profiler module. It must match the shared library
name (i.e. <code>libmono-profiler-example.so</code>). <i>desc</i>
is the set of arguments that were passed from the command line.
<p>In addition, a profiler developer will typically call
<tt>mono_profiler_set_events</tt> to register which kinds of
traces should be enabled, these can be an OR-ed combination of
the following:
<p>For example, a bare bones profiler module might look like this
(<code>example.c</code>):
<pre>
MONO_PROFILE_NONE
MONO_PROFILE_APPDOMAIN_EVENTS
MONO_PROFILE_ASSEMBLY_EVENTS
MONO_PROFILE_MODULE_EVENTS
MONO_PROFILE_CLASS_EVENTS
MONO_PROFILE_JIT_COMPILATION
MONO_PROFILE_INLINING
MONO_PROFILE_EXCEPTIONS
MONO_PROFILE_ALLOCATIONS
MONO_PROFILE_GC
MONO_PROFILE_THREADS
MONO_PROFILE_REMOTING
MONO_PROFILE_TRANSITIONS
MONO_PROFILE_ENTER_LEAVE
MONO_PROFILE_COVERAGE
MONO_PROFILE_INS_COVERAGE
MONO_PROFILE_STATISTICAL
</pre>
<pre><code class="mapi-codeblock">
#include &lt;mono/metadata/profiler.h&gt;
#include &lt;stdio.h&gt;
<p>Developers can change the set of monitored events at
runtime by calling <tt>mono_profiler_set_events</tt>.
<h4><a name="api:mono_profiler_install">mono_profiler_install</a></h4>
<h4><a name="api:mono_profiler_install_allocation">mono_profiler_install_allocation</a></h4>
<h4><a name="api:mono_profiler_install_appdomain">mono_profiler_install_appdomain</a></h4>
<h4><a name="api:mono_profiler_install_assembly">mono_profiler_install_assembly</a></h4>
<h4><a name="api:mono_profiler_install_class">mono_profiler_install_class</a></h4>
<h4><a name="api:mono_profiler_install_coverage_filter">mono_profiler_install_coverage_filter</a></h4>
<h4><a name="api:mono_profiler_install_enter_leave">mono_profiler_install_enter_leave</a></h4>
<h4><a name="api:mono_profiler_install_jit_compile">mono_profiler_install_jit_compile</a></h4>
<h4><a name="api:mono_profiler_install_module">mono_profiler_install_module</a></h4>
<h4><a name="api:mono_profiler_install_thread">mono_profiler_install_thread</a></h4>
<h4><a name="api:mono_profiler_install_transition">mono_profiler_install_transition</a></h4>
<h4><a name="api:mono_profiler_install_gc">mono_profiler_install_gc</a></h4>
<h4><a name="api:mono_profiler_install_statistical">mono_profiler_install_statistical</a></h4>
<h4><a name="api:mono_profiler_set_events">mono_profiler_set_events</a></h4>
<h4><a name="api:mono_profiler_get_events">mono_profiler_get_events</a></h4>
struct _MonoProfiler {
int dummy;
}
<h3>Coverage</h3>
static MonoProfiler profiler;
<p>To support profiling modules that need to do code coverage
analysis, the following routines is provided:
<h4><a name="api:mono_profiler_coverage_get">mono_profiler_coverage_get</a></h4>
static void
runtime_inited (MonoProfiler *prof)
{
printf ("Hello World");
}
void
mono_profiler_init_example (const char *desc)
{
MonoProfilerHandle handle = mono_profiler_create (&amp;profiler);
mono_profiler_set_runtime_initialized_callback (handle, runtime_inited);
}
</code></pre>
<p>To compile this module, a C compiler must be invoked in a
similar fashion to this, on Linux:
<pre><code class="mapi-codeblock">
gcc -fPIC -shared -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
</code></pre>
<p>Or on OS X:
<pre><code class="mapi-codeblock">
gcc -undefined suppress -flat_namespace -o libmono-profiler-example.so example.c `pkg-config --cflags mono-2`
</code></pre>
<p>You can then load the module using:
<pre><code class="mapi-codeblock">
mono --profile=example hello.exe
</code></pre>
<p>(Note that adjusting <code>LD_LIBRARY_PATH</code> may be
necessary in order for the dynamic linker to find the module.)
<h2>Profiler Functions</h2>
<p>These are the functions usable for profiling programs.
<p>Each function has a note indicating whether they're async
safe. An async safe function can be invoked in a signal handler
or when the world is stopped by the GC. Conversely, a function
that is not async safe must not be invoked in such a context or
undefined behavior can occur (crashes, deadlocks, etc).
<p>Some functions may only be invoked from a profiler module's
init function (or prior to running managed code in the case of
embedding). This is noted explicitly only if applicable to a
function.
<h3>Basic Functions</h3>
<p>These functions are used to load and install profilers.
<h4><a name="api:mono_profiler_load">mono_profiler_load</a></h4>
<h4><a name="api:mono_profiler_create">mono_profiler_create</a></h4>
<h4><a name="api:mono_profiler_set_cleanup_callback">mono_profiler_set_cleanup_callback</a></h4>
<h3>Code Coverage</h3>
<p>These functions provide access to the JIT compiler's code
coverage support. This functionality can be used to collect
information about how many times certain code paths have been
executed.
<h4><a name="api:mono_profiler_enable_coverage">mono_profiler_enable_coverage</a></h4>
<h4><a name="api:mono_profiler_set_coverage_filter_callback">mono_profiler_set_coverage_filter_callback</a></h4>
<h4><a name="api:mono_profiler_get_coverage_data">mono_profiler_get_coverage_data</a></h4>
<h3>Statistical Sampling</h3>
<p>Statistical sampling can be used to interrupt managed threads
based on a certain mode and frequency for the purpose of
collecting data about their current work.
<p>One common use case for this functionality, usually referred
to as call sampling, is to collect a backtrace from every thread
when a sampling hit event arrives. This data can then be compiled
into a report indicating where a program spends most of its time.
<h4><a name="api:mono_profiler_enable_sampling">mono_profiler_enable_sampling</a></h4>
<h4><a name="api:mono_profiler_set_sample_mode">mono_profiler_set_sample_mode</a></h4>
<h4><a name="api:mono_profiler_get_sample_mode">mono_profiler_get_sample_mode</a></h4>
<p>A callback must be registered to receive sample hit events.
Please see the <i>Callback Registration</i> section below.
<h3>GC Allocations</h3>
<p>Profilers can be notified about all GC allocations performed
by a program or the Mono runtime.
<h4><a name="api:mono_profiler_enable_allocations">mono_profiler_enable_allocations</a></h4>
<p>A callback must be registered to receive allocation events.
Please see the <i>Callback Registration</i> section below.
<h3>Call Instrumentation</h3>
<p>The JIT compiler supports instrumenting managed method entry
and exit points so that a profiler callback will be invoked.
<p>While such callbacks by themselves have traditionally only
been useful for call count profiling and the like, Mono gives
these callbacks access to the arguments, locals, and return
value of instrumented methods (together referred to as the 'call
context'). This enables many profiling scenarios that would
otherwise have required explicit hooks in the base class
libraries.
<h4><a name="api:mono_profiler_set_call_instrumentation_filter_callback">mono_profiler_set_call_instrumentation_filter_callback</a></h4>
<h4><a name="api:mono_profiler_enable_call_context_introspection">mono_profiler_enable_call_context_introspection</a></h4>
<h4><a name="api:mono_profiler_call_context_get_this">mono_profiler_call_context_get_this</a></h4>
<h4><a name="api:mono_profiler_call_context_get_argument">mono_profiler_call_context_get_argument</a></h4>
<h4><a name="api:mono_profiler_call_context_get_local">mono_profiler_call_context_get_local</a></h4>
<h4><a name="api:mono_profiler_call_context_get_result">mono_profiler_call_context_get_result</a></h4>
<h4><a name="api:mono_profiler_call_context_free_buffer">mono_profiler_call_context_free_buffer</a></h4>
<p>Callbacks must be registered to receive method entry and exit
events. Please see the <i>Callback Registration</i> section
below.
<h3>Callback Registration</h3>
<p>In addition to the above functions, there's a large set of
functions for installing generic profiler event callbacks. These
are generated from C macros and so are not documented here.
Please refer to the <code>mono/metadata/profiler.h</code> and
<code>mono/metadata/profiler-events.h</code> headers for a full
listing of these.
<p>Callback registration functions are all async safe and can be
safely invoked from multiple threads at the same time, with the
caveat that altering a registered callback from one thread will
not immediately affect another thread that is already invoking
the current callback.
<h2>API Stability</h2>
<p>The profiler API does not have the same API stability
garantees that the rest of the Mono embedding API does. While
a breaking change to the profiler API is extremely rare, it has
happened in the past when changing the API in a backwards
compatible way was deemed to be too much work for too little
gain.
<p>Therefore, developers of profiler modules may rarely need to
update their code to work with new versions of the profiler API.
<p>Developers who wish to support older versions of the API can
perform a compile time check of the
<code>MONO_PROFILER_API_VERSION</code> macro and maintain code
for both old and new versions.
<p>To aid with transitioning to a new version of the profiler
API, the Mono runtime will detect and reject loading profiler
modules which were compiled against older profiler API versions.
-22
View File
@@ -1,22 +0,0 @@
/
/depcomp
/config.guess
/config.sub
/ltmain.sh
/eglib-*.tar.gz
/missing
/install-sh
/compile
/Makefile
/Makefile.in
/stamp-h1
/config.h.in
/libtool
/autom4te.cache
/aclocal.m4
/config.log
/configure
/config.h
/config.status
/INSTALL
dolt*
-17
View File
@@ -1,17 +0,0 @@
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-19
View File
@@ -1,19 +0,0 @@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(WERROR_CFLAGS)
if HOST_WIN32
SUBDIRS = m4 src
else
if PLATFORM_DARWIN
SUBDIRS = m4 src
else
if CROSS_COMPILING
SUBDIRS = m4 src
else
SUBDIRS = m4 src test
endif
endif
endif
EXTRA_DIST = autogen.sh README NEWS AUTHORS winconfig.h
-54
View File
@@ -1,54 +0,0 @@
The purpose of eglib is to be an X11-licensed subset of glib that can
be used with Mono when the Mono runtime is explicitly relicensed under
a different license by Novell.
The implementation is done from the public documentation available here:
http://developer.gnome.org/doc/API/2.0/glib/
Currently this is only being built standalone, use:
./autogen.sh --prefix=/tmp/test
Currently all the definitions go into a single file: glib.h, there are
no separate files, please try to follow the convetions in the source code
* Tests
Please read the README in tests/
* Features
The source code is designed to allow for different operating
system builds of the eglib code.
Files in src that:
* Have a plain name: are cross platform, and should work on
every operating system.
* That end in -unix.c: These files contain Unix specific code.
* That end in -win32.c: These files contain Win32 specific code.
* That end in -posix.c: Will work on both Windows and Unix,
but should not be included for other operating systems.
* Plans: short and long term.
The short term plans for eglib is to allow Mono to optionally
build with it instead of using glib, gmodule and gthread, but
the default build will continue to be done against glib 2.0.
In the long-term we are considering dropping glib as a
dependency, considering that Mono requires a modern Unix
system to run anyways (for its thread support) it would allow
us to fix some of the glib API limitations we have to live
with (explicit thread support for example), rework the API to
use types from stdint.h and we would be able to drop three
external shared libraries.
This would reduce memory usage for the handful of routines
that we use from glib, dynamic linker overhead for those and
would allow us to tune the implementation to Mono's needs.
-33
View File
@@ -1,33 +0,0 @@
* Missing code
* Process launching
3 g_shell_quote
1 g_shell_unquote
----------------------------------------------------------------------
* Should implement, for better performance:
Macros:
6 G_UNLIKELY
4 G_LIKELY
* Unimplemented, not supported currently:
(none as yet.)
* Dead Code
The GMainLoop code was no longer in use in Mono.
* Windows implementations needed
Directory, File manipulation:
g_dir_open, g_dir_close, g_dir_read_name
We're missing a native windows implementation. The unix one is in place.
* Information retrieval
1 g_win32_getlocale
-182
View File
@@ -1,182 +0,0 @@
dnl dolt, a replacement for libtool
dnl Copyright © 2007-2008 Josh Triplett <[email protected]>
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright
dnl notice and this notice are preserved.
dnl
dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
dnl installed when running autoconf on your project.
AC_DEFUN([DOLT], [
AC_REQUIRE([AC_CANONICAL_HOST])
# dolt, a replacement for libtool
# Josh Triplett <[email protected]>
AC_PATH_PROG(DOLT_BASH, bash)
AC_MSG_CHECKING([if dolt supports this host])
dolt_supported=yes
if test x$DOLT_BASH = x; then
dolt_supported=no
fi
if test x$GCC != xyes; then
dolt_supported=no
fi
case $host in
i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
pic_options='-fPIC'
;;
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
pic_options='-DDLL_EXPORT'
;;
i?86-apple-darwin*|arm-apple-darwin*)
pic_options='-fno-common'
;;
*)
dolt_supported=no
;;
esac
if test x$dolt_supported = xno ; then
AC_MSG_RESULT([no, falling back to libtool])
LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
else
AC_MSG_RESULT([yes, replacing libtool])
dnl Start writing out doltcompile.
cat <<__DOLTCOMPILE__EOF__ >doltcompile
#!$DOLT_BASH
__DOLTCOMPILE__EOF__
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
args=("$[]@")
for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
if test x"${args@<:@$arg@:>@}" = x-o ; then
objarg=$((arg+1))
break
fi
done
if test x$objarg = x ; then
echo 'Error: no -o on compiler command line' 1>&2
exit 1
fi
lo="${args@<:@$objarg@:>@}"
obj="${lo%.lo}"
if test x"$lo" = x"$obj" ; then
echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
exit 1
fi
objbase="${obj##*/}"
__DOLTCOMPILE__EOF__
dnl Write out shared compilation code.
if test x$enable_shared = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
libobjdir="${obj%$objbase}.libs"
if test ! -d "$libobjdir" ; then
mkdir_out="$(mkdir "$libobjdir" 2>&1)"
mkdir_ret=$?
if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
echo "$mkdir_out" 1>&2
exit $mkdir_ret
fi
fi
pic_object="$libobjdir/$objbase.o"
args@<:@$objarg@:>@="$pic_object"
__DOLTCOMPILE__EOF__
cat <<__DOLTCOMPILE__EOF__ >>doltcompile
"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
__DOLTCOMPILE__EOF__
fi
dnl Write out static compilation code.
dnl Avoid duplicate compiler output if also building shared objects.
if test x$enable_static = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
non_pic_object="$obj.o"
args@<:@$objarg@:>@="$non_pic_object"
__DOLTCOMPILE__EOF__
if test x$enable_shared = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
__DOLTCOMPILE__EOF__
else
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
"${args@<:@@@:>@}" || exit $?
__DOLTCOMPILE__EOF__
fi
fi
dnl Write out the code to write the .lo file.
dnl The second line of the .lo file must match "^# Generated by .*libtool"
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
{
echo "# $lo - a libtool object file"
echo "# Generated by doltcompile, not libtool"
__DOLTCOMPILE__EOF__
if test x$enable_shared = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo "pic_object='.libs/${objbase}.o'"
__DOLTCOMPILE__EOF__
else
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo pic_object=none
__DOLTCOMPILE__EOF__
fi
if test x$enable_static = xyes; then
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo "non_pic_object='${objbase}.o'"
__DOLTCOMPILE__EOF__
else
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
echo non_pic_object=none
__DOLTCOMPILE__EOF__
fi
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
} > "$lo"
__DOLTCOMPILE__EOF__
dnl Done writing out doltcompile; substitute it for libtool compilation.
chmod +x doltcompile
LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for
dnl a target, so write out a libtool wrapper to handle that case.
dnl Note that doltlibtool does not handle inferred tags or option arguments
dnl without '=', because automake does not use them.
cat <<__DOLTLIBTOOL__EOF__ > doltlibtool
#!$DOLT_BASH
__DOLTLIBTOOL__EOF__
cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool
top_builddir_slash="${0%%doltlibtool}"
: ${top_builddir_slash:=./}
args=()
modeok=false
tagok=false
for arg in "$[]@"; do
case "$arg" in
--silent) ;;
--mode=compile) modeok=true ;;
--tag=CC|--tag=CXX) tagok=true ;;
--quiet) ;;
*) args@<:@${#args[@]}@:>@="$arg" ;;
esac
done
if $modeok && $tagok ; then
. ${top_builddir_slash}doltcompile "${args@<:@@@:>@}"
else
exec ${top_builddir_slash}libtool "$[]@"
fi
__DOLTLIBTOOL__EOF__
dnl Done writing out doltlibtool; substitute it for libtool.
chmod +x doltlibtool
LIBTOOL='$(top_builddir)/doltlibtool'
fi
AC_SUBST(LTCOMPILE)
AC_SUBST(LTCXXCOMPILE)
# end dolt
])
-136
View File
@@ -1,136 +0,0 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
# Ripped off from GNOME macros version
DIE=0
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
if [ -n "$MONO_PATH" ]; then
# from -> /mono/lib:/another/mono/lib
# to -> /mono /another/mono
for i in `echo ${MONO_PATH} | tr ":" " "`; do
i=`dirname ${i}`
if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
fi
if [ -n "{i}" -a -d "${i}/bin" ]; then
PATH="${i}/bin:$PATH"
fi
done
export PATH
fi
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed to compile Mono."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
if [ -z "$LIBTOOLIZE" ]; then
LIBTOOLIZE=`which glibtoolize 2>/dev/null`
if [ ! -x "$LIBTOOLIZE" ]; then
LIBTOOLIZE=`which libtoolize`
fi
fi
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtoolize' installed to compile Mono."
echo "Get ftp://ftp.gnu.org/gnu/libtool/libtool-1.2.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
(gettext --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`gettext' installed to compile Mono."
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`automake' installed to compile Mono."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test x$NOCONFIGURE = x && test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
$LIBTOOLIZE --force --copy
fi
fi
echo "Running aclocal -I m4 $ACLOCAL_FLAGS ..."
aclocal -I m4 $ACLOCAL_FLAGS || {
echo
echo "**Error**: aclocal failed. This may mean that you have not"
echo "installed all of the packages you need, or you may need to"
echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
echo "for the prefix where you installed the packages whose"
echo "macros were not found"
exit 1
}
if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
echo "Running autoheader..."
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt ||
{ echo "**Error**: automake failed."; exit 1; }
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
conf_flags="--enable-maintainer-mode" #--enable-compile-warnings --enable-iso-c
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
else
echo Skipping configure process.
fi
-672
View File
@@ -1,672 +0,0 @@
#! /bin/sh
# Output a system dependent set of variables, describing how to set the
# run time search path of shared libraries in an executable.
#
# Copyright 1996-2010 Free Software Foundation, Inc.
# Taken from GNU libtool, 2001
# Originally by Gordon Matzigkeit <[email protected]>, 1996
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# The first argument passed to this file is the canonical host specification,
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
# should be set by the caller.
#
# The set of defined variables is at the end of this script.
# Known limitations:
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
# than 256 bytes, otherwise the compiler driver will dump core. The only
# known workaround is to choose shorter directory names for the build
# directory and/or the installation directory.
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
shrext=.so
host="$1"
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
# Code taken from libtool.m4's _LT_CC_BASENAME.
for cc_temp in $CC""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
\-*) ;;
*) break;;
esac
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's _LT_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
wl='-Wl,'
else
case "$host_os" in
aix*)
wl='-Wl,'
;;
darwin*)
case $cc_basename in
xlc*)
wl='-Wl,'
;;
esac
;;
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
;;
irix5* | irix6* | nonstopux*)
wl='-Wl,'
;;
newsos6)
;;
linux* | k*bsd*-gnu)
case $cc_basename in
ecc*)
wl='-Wl,'
;;
icc* | ifort*)
wl='-Wl,'
;;
lf95*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
wl='-Wl,'
;;
ccc*)
wl='-Wl,'
;;
como)
wl='-lopt='
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
wl='-Wl,'
;;
esac
;;
esac
;;
osf3* | osf4* | osf5*)
wl='-Wl,'
;;
rdos*)
;;
solaris*)
wl='-Wl,'
;;
sunos4*)
wl='-Qoption ld '
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
wl='-Wl,'
;;
sysv4*MP*)
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
wl='-Wl,'
;;
unicos*)
wl='-Wl,'
;;
uts4*)
;;
esac
fi
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
if test "$GCC" != yes; then
with_gnu_ld=no
fi
;;
interix*)
# we just hope/assume this is gcc and not c89 (= MSVC++)
with_gnu_ld=yes
;;
openbsd*)
with_gnu_ld=no
;;
esac
ld_shlibs=yes
if test "$with_gnu_ld" = yes; then
# Set some defaults for GNU ld with shared library support. These
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
# Unlike libtool, we use -rpath here, not --rpath, since the documented
# option of GNU ld is called -rpath, not --rpath.
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
case "$host_os" in
aix[3-9]*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# Samuel A. Falvo II <[email protected]> reports
# that the semantics of dynamic libraries on AmigaOS, at least up
# to version 4, is to share data among multiple programs linked
# with the same dynamic library. Since this doesn't match the
# behavior of shared libraries on other platforms, we cannot use
# them.
ld_shlibs=no
;;
beos*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32* | cegcc*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
interix[3-9]*)
hardcode_direct=no
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
gnu* | linux* | k*bsd*-gnu)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
netbsd*)
;;
solaris*)
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
ld_shlibs=no
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
else
ld_shlibs=no
fi
;;
esac
;;
sunos4*)
hardcode_direct=yes
;;
*)
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
:
else
ld_shlibs=no
fi
;;
esac
if test "$ld_shlibs" = no; then
hardcode_libdir_flag_spec=
fi
else
case "$host_os" in
aix3*)
# Note: this linker hardcodes the directories in LIBPATH if there
# are no directories specified by -L.
hardcode_minus_L=yes
if test "$GCC" = yes; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
hardcode_direct=unsupported
fi
;;
aix[4-9]*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
aix_use_runtimelinking=no
else
aix_use_runtimelinking=no
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
break
fi
done
;;
esac
fi
hardcode_direct=yes
hardcode_libdir_separator=':'
if test "$GCC" = yes; then
case $host_os in aix4.[012]|aix4.[012].*)
collect2name=`${CC} -print-prog-name=collect2`
if test -f "$collect2name" && \
strings "$collect2name" | grep resolve_lib_name >/dev/null
then
# We have reworked collect2
:
else
# We have old collect2
hardcode_direct=unsupported
hardcode_minus_L=yes
hardcode_libdir_flag_spec='-L$libdir'
hardcode_libdir_separator=
fi
;;
esac
fi
# Begin _LT_AC_SYS_LIBPATH_AIX.
echo 'int main () { return 0; }' > conftest.c
${CC} ${LDFLAGS} conftest.c -o conftest
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
}'`
fi
if test -z "$aix_libpath"; then
aix_libpath="/usr/lib:/lib"
fi
rm -f conftest.c conftest
# End _LT_AC_SYS_LIBPATH_AIX.
if test "$aix_use_runtimelinking" = yes; then
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
else
if test "$host_cpu" = ia64; then
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
else
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
fi
fi
;;
amigaos*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
# see comment about different semantics on the GNU ld section
ld_shlibs=no
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec=' '
libext=lib
;;
darwin* | rhapsody*)
hardcode_direct=no
if test "$GCC" = yes ; then
:
else
case $cc_basename in
xlc*)
;;
*)
ld_shlibs=no
;;
esac
fi
;;
dgux*)
hardcode_libdir_flag_spec='-L$libdir'
;;
freebsd1*)
ld_shlibs=no
;;
freebsd2.2*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
freebsd2*)
hardcode_direct=yes
hardcode_minus_L=yes
;;
freebsd* | dragonfly*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
hpux9*)
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
hpux10*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
fi
;;
hpux11*)
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
case $host_cpu in
hppa*64*|ia64*)
hardcode_direct=no
;;
*)
hardcode_direct=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
;;
esac
fi
;;
irix5* | irix6* | nonstopux*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
netbsd*)
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
;;
newsos6)
hardcode_direct=yes
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
else
case "$host_os" in
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
hardcode_libdir_flag_spec='-R$libdir'
;;
*)
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
fi
else
ld_shlibs=no
fi
;;
os2*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
;;
osf3*)
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
osf4* | osf5*)
if test "$GCC" = yes; then
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
# Both cc and cxx compiler support -rpath directly
hardcode_libdir_flag_spec='-rpath $libdir'
fi
hardcode_libdir_separator=:
;;
solaris*)
hardcode_libdir_flag_spec='-R$libdir'
;;
sunos4*)
hardcode_libdir_flag_spec='-L$libdir'
hardcode_direct=yes
hardcode_minus_L=yes
;;
sysv4)
case $host_vendor in
sni)
hardcode_direct=yes # is this really true???
;;
siemens)
hardcode_direct=no
;;
motorola)
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
;;
esac
;;
sysv4.3*)
;;
sysv4*MP*)
if test -d /usr/nec; then
ld_shlibs=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
;;
sysv5* | sco3.2v5* | sco5v6*)
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
;;
uts4*)
hardcode_libdir_flag_spec='-L$libdir'
;;
*)
ld_shlibs=no
;;
esac
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
# linker has special search rules.
library_names_spec= # the last element of library_names_spec in libtool.m4
libname_spec='lib$name'
case "$host_os" in
aix3*)
library_names_spec='$libname.a'
;;
aix[4-9]*)
library_names_spec='$libname$shrext'
;;
amigaos*)
library_names_spec='$libname.a'
;;
beos*)
library_names_spec='$libname$shrext'
;;
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32* | cegcc*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;
darwin* | rhapsody*)
shrext=.dylib
library_names_spec='$libname$shrext'
;;
dgux*)
library_names_spec='$libname$shrext'
;;
freebsd1*)
;;
freebsd* | dragonfly*)
case "$host_os" in
freebsd[123]*)
library_names_spec='$libname$shrext$versuffix' ;;
*)
library_names_spec='$libname$shrext' ;;
esac
;;
gnu*)
library_names_spec='$libname$shrext'
;;
hpux9* | hpux10* | hpux11*)
case $host_cpu in
ia64*)
shrext=.so
;;
hppa*64*)
shrext=.sl
;;
*)
shrext=.sl
;;
esac
library_names_spec='$libname$shrext'
;;
interix[3-9]*)
library_names_spec='$libname$shrext'
;;
irix5* | irix6* | nonstopux*)
library_names_spec='$libname$shrext'
case "$host_os" in
irix5* | nonstopux*)
libsuff= shlibsuff=
;;
*)
case $LD in
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
*) libsuff= shlibsuff= ;;
esac
;;
esac
;;
linux*oldld* | linux*aout* | linux*coff*)
;;
linux* | k*bsd*-gnu)
library_names_spec='$libname$shrext'
;;
knetbsd*-gnu)
library_names_spec='$libname$shrext'
;;
netbsd*)
library_names_spec='$libname$shrext'
;;
newsos6)
library_names_spec='$libname$shrext'
;;
nto-qnx*)
library_names_spec='$libname$shrext'
;;
openbsd*)
library_names_spec='$libname$shrext$versuffix'
;;
os2*)
libname_spec='$name'
shrext=.dll
library_names_spec='$libname.a'
;;
osf3* | osf4* | osf5*)
library_names_spec='$libname$shrext'
;;
rdos*)
;;
solaris*)
library_names_spec='$libname$shrext'
;;
sunos4*)
library_names_spec='$libname$shrext$versuffix'
;;
sysv4 | sysv4.3*)
library_names_spec='$libname$shrext'
;;
sysv4*MP*)
library_names_spec='$libname$shrext'
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='$libname$shrext'
;;
uts4*)
library_names_spec='$libname$shrext'
;;
esac
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
# How to pass a linker flag through the compiler.
wl="$escaped_wl"
# Static library suffix (normally "a").
libext="$libext"
# Shared library suffix (normally "so").
shlibext="$shlibext"
# Format of library name prefix.
libname_spec="$escaped_libname_spec"
# Library names that the linker finds when passed -lNAME.
library_names_spec="$escaped_library_names_spec"
# Flag to hardcode \$libdir into a binary during linking.
# This must work even if \$libdir does not exist.
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator="$hardcode_libdir_separator"
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="$hardcode_direct"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="$hardcode_minus_L"
EOF
-268
View File
@@ -1,268 +0,0 @@
#
# Copyright 2012 Xamarin Inc
#
AC_INIT(eglib, [0.3],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_CC
AM_PROG_LIBTOOL
# Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
DOLT
GNUC_PRETTY=
GNUC_UNUSED=
BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
if test x$GCC = xyes; then
GNUC_UNUSED='__attribute__((__unused__))'
GNUC_NORETURN='__attribute__((__noreturn__))'
case $host_cpu in
i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
esac
fi
AC_SUBST(GNUC_PRETTY)
AC_SUBST(GNUC_UNUSED)
AC_SUBST(GNUC_NORETURN)
AC_SUBST(BREAKPOINT)
# We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
# configure, because of autoconf brokeness
if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
CPPFLAGS=$CPPFLAGS_FOR_EGLIB
fi
if test "x$CFLAGS_FOR_EGLIB" != "x"; then
CFLAGS=$CFLAGS_FOR_EGLIB
fi
CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
platform_darwin=no
platform_android=no
case $host in
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
PATHSEP='\\'
SEARCHSEP=';'
OS="WIN32"
PIDTYPE='void *'
;;
*-*darwin*)
platform_darwin=yes
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
PIDTYPE='int'
;;
*-*-linux-android*)
platform_android=yes
AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
PIDTYPE='int'
;;
*)
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
PIDTYPE='int'
;;
esac
case $host in
*-*-solaris*)
CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
;;
esac
case $target in
arm*-darwin*|aarch64*-*)
CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
;;
i*86-*-darwin*)
ORDER=G_LITTLE_ENDIAN
;;
*-*-haiku*)
LDFLAGS="$LDFLAGS -ltextencoding"
;;
*-*-openbsd*)
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
esac
target_osx=no
target_ios=no
if test "x$platform_darwin" = "xyes"; then
AC_TRY_COMPILE([#include "TargetConditionals.h"],[
#if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
#error fail this for ios
#endif
return 0;
], [
AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
target_osx=yes
], [
AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
target_ios=yes
])
AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
fi
AC_SUBST(ORDER)
AC_SUBST(CFLAGS)
AC_SUBST(PATHSEP)
AC_SUBST(SEARCHSEP)
AC_SUBST(OS)
AC_SUBST(PIDTYPE)
AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
# Defined for all targets/platforms using classic Windows API support.
AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf strerror_r)
AC_CHECK_FUNCS(getrlimit)
AC_CHECK_FUNCS(fork execv execve)
AC_ARG_WITH([overridable-allocators], [ --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
if test x$with_overridable_allocators = xyes; then
AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
AC_MSG_NOTICE([Overridable allocator support enabled])
else
AC_MSG_NOTICE([Overridable allocator support disabled])
fi
#
# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
# removed once support for 10.6 is dropped.
#
# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
#
if test x$target_osx = xyes; then
AC_CHECK_FUNCS(getpwuid_r)
elif test x$target_ios = xno; then
AC_CHECK_FUNCS(strndup getpwuid_r)
fi
AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
AM_ICONV()
AC_SEARCH_LIBS(sqrtf, m)
# nanosleep may not be part of libc, also search it in other libraries
AC_SEARCH_LIBS(nanosleep, rt)
AC_SEARCH_LIBS(dlopen, dl)
old_ldflags="${LDFLAGS}"
LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
if test $found_export_dynamic = no; then
LDFLAGS="${old_ldflags}"
fi
AC_MSG_CHECKING(for varargs macros)
AC_TRY_COMPILE([],[
int foo (int i, int j);
#define bar(...) foo (1, __VA_ARGS__)
void main () {
bar (2);
}
],have_iso_varargs=yes,have_iso_varargs=no)
AC_MSG_RESULT($have_iso_varargs)
G_HAVE_ISO_VARARGS=0
if test "x$have_iso_varargs" = "xyes"; then
G_HAVE_ISO_VARARGS=1
fi
AC_SUBST(G_HAVE_ISO_VARARGS)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
AC_SUBST(HAVE_ALLOCA_H)
if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
GPOINTER_TO_INT="((gint) (ptr))"
GPOINTER_TO_UINT="((guint) (ptr))"
GINT_TO_POINTER="((gpointer) (v))"
GUINT_TO_POINTER="((gpointer) (v))"
GSIZE="int"
GSIZE_FORMAT='"u"'
elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
GPOINTER_TO_INT="((gint)(long) (ptr))"
GPOINTER_TO_UINT="((guint)(long) (ptr))"
GINT_TO_POINTER="((gpointer)(glong) (v))"
GUINT_TO_POINTER="((gpointer)(gulong) (v))"
GSIZE="long"
GSIZE_FORMAT='"lu"'
elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
GPOINTER_TO_INT="((gint)(long long) (ptr))"
GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
GINT_TO_POINTER="((gpointer)(long long) (v))"
GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
GSIZE="long long"
GSIZE_FORMAT='"I64u"'
else
AC_MSG_ERROR([unsupported pointer size])
fi
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
pkg_config_path=
AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom dir],
if test x$with_crosspkgdir = "x"; then
if test -s $PKG_CONFIG_PATH; then
pkg_config_path=$PKG_CONFIG_PATH
fi
else
pkg_config_path=$with_crosspkgdir
PKG_CONFIG_PATH=$pkg_config_path
export PKG_CONFIG_PATH
fi
)
AC_ARG_ENABLE(werror, [ --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
if test x$werror_flag = xyes; then
WERROR_CFLAGS="-Werror"
fi
AC_SUBST([WERROR_CFLAGS])
AC_SUBST(GPOINTER_TO_INT)
AC_SUBST(GPOINTER_TO_UINT)
AC_SUBST(GINT_TO_POINTER)
AC_SUBST(GUINT_TO_POINTER)
AC_SUBST(GSIZE)
AC_SUBST(GSIZE_FORMAT)
AC_SUBST(G_GUINT64_FORMAT)
AC_SUBST(G_GINT64_FORMAT)
AC_SUBST(G_GUINT32_FORMAT)
AC_SUBST(G_GINT32_FORMAT)
AC_OUTPUT([
Makefile
m4/Makefile
src/Makefile
src/eglib-config.h
test/Makefile
])
-7
View File
@@ -1,7 +0,0 @@
Makefile
Makefile.in
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
-1
View File
@@ -1 +0,0 @@
EXTRA_DIST = $(wildcard *.m4)
-214
View File
@@ -1,214 +0,0 @@
# iconv.m4 serial 11 (gettext-0.18.1)
dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
[
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([iconv])
])
AC_DEFUN([AM_ICONV_LINK],
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
dnl because if the user has installed libiconv and not disabled its use
dnl via --without-libiconv-prefix, he wants to use it. The first
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
am_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
[am_cv_func_iconv=yes])
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
[am_cv_lib_iconv=yes]
[am_cv_func_iconv=yes])
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
am_save_LIBS="$LIBS"
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
AC_TRY_RUN([
#include <iconv.h>
#include <string.h>
int main ()
{
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful
returns. */
{
iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
if (cd_utf8_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\342\202\254"; /* EURO SIGN */
char buf[10];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_utf8_to_88591,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
}
}
/* Test against Solaris 10 bug: Failures are not distinguishable from
successful returns. */
{
iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
if (cd_ascii_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\263";
char buf[10];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_ascii_to_88591,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
}
}
#if 0 /* This bug could be worked around by the caller. */
/* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
{
iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
char buf[50];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_88591_to_utf8,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if ((int)res > 0)
return 1;
}
}
#endif
/* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
provided. */
if (/* Try standardized names. */
iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
/* Try IRIX, OSF/1 names. */
&& iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
/* Try AIX names. */
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
/* Try HP-UX names. */
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
return 1;
return 0;
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
[case "$host_os" in
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
*) am_cv_func_iconv_works="guessing yes" ;;
esac])
LIBS="$am_save_LIBS"
])
case "$am_cv_func_iconv_works" in
*no) am_func_iconv=no am_cv_lib_iconv=no ;;
*) am_func_iconv=yes ;;
esac
else
am_func_iconv=no am_cv_lib_iconv=no
fi
if test "$am_func_iconv" = yes; then
AC_DEFINE([HAVE_ICONV], [1],
[Define if you have the iconv() function and it works.])
fi
if test "$am_cv_lib_iconv" = yes; then
AC_MSG_CHECKING([how to link with libiconv])
AC_MSG_RESULT([$LIBICONV])
else
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
dnl either.
CPPFLAGS="$am_save_CPPFLAGS"
LIBICONV=
LTLIBICONV=
fi
AC_SUBST([LIBICONV])
AC_SUBST([LTLIBICONV])
])
dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
dnl avoid warnings like
dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
dnl This is tricky because of the way 'aclocal' is implemented:
dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
dnl Otherwise aclocal's initial scan pass would miss the macro definition.
dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
dnl warnings.
m4_define([gl_iconv_AC_DEFUN],
m4_version_prereq([2.64],
[[AC_DEFUN_ONCE(
[$1], [$2])]],
[[AC_DEFUN(
[$1], [$2])]]))
gl_iconv_AC_DEFUN([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL([am_cv_proto_iconv], [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([
$am_cv_proto_iconv])
AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
[Define as const if the declaration of iconv() needs const.])
fi
])
-110
View File
@@ -1,110 +0,0 @@
# lib-ld.m4 serial 4 (gettext-0.18)
dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl Subroutines of libtool.m4,
dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
dnl with libtool.m4.
dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
AC_DEFUN([AC_LIB_PROG_LD_GNU],
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
acl_cv_prog_gnu_ld=yes ;;
*)
acl_cv_prog_gnu_ld=no ;;
esac])
with_gnu_ld=$acl_cv_prog_gnu_ld
])
dnl From libtool-1.4. Sets the variable LD.
AC_DEFUN([AC_LIB_PROG_LD],
[AC_ARG_WITH([gnu-ld],
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
# Prepare PATH_SEPARATOR.
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
echo "#! /bin/sh" >conf$$.sh
echo "exit 0" >>conf$$.sh
chmod +x conf$$.sh
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
rm -f conf$$.sh
fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
*)
ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
esac
case $ac_prog in
# Accept absolute paths.
[[\\/]* | [A-Za-z]:[\\/]*)]
[re_direlt='/[^/][^/]*/\.\./']
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL([acl_cv_path_LD],
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
acl_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
*GNU* | *'with BFD'*)
test "$with_gnu_ld" != no && break ;;
*)
test "$with_gnu_ld" != yes && break ;;
esac
fi
done
IFS="$ac_save_ifs"
else
acl_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$acl_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT([$LD])
else
AC_MSG_RESULT([no])
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_LIB_PROG_LD_GNU
])
-774
View File
@@ -1,774 +0,0 @@
# lib-link.m4 serial 21 (gettext-0.18)
dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
AC_PREREQ([2.54])
dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
dnl augments the CPPFLAGS variable.
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
pushdef([Name],[translit([$1],[./-], [___])])
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
AC_LIB_LINKFLAGS_BODY([$1], [$2])
ac_cv_lib[]Name[]_libs="$LIB[]NAME"
ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
])
LIB[]NAME="$ac_cv_lib[]Name[]_libs"
LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LIB]NAME[_PREFIX])
dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
dnl results of this search when this library appears as a dependency.
HAVE_LIB[]NAME=yes
popdef([NAME])
popdef([Name])
])
dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
dnl searches for libname and the libraries corresponding to explicit and
dnl implicit dependencies, together with the specified include files and
dnl the ability to compile and link the specified testcode. The missing-message
dnl defaults to 'no' and may contain additional hints for the user.
dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
[
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
pushdef([Name],[translit([$1],[./-], [___])])
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([$1], [$2])
dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
dnl because if the user has installed lib[]Name and not disabled its use
dnl via --without-lib[]Name-prefix, he wants to use it.
ac_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
ac_save_LIBS="$LIBS"
dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
dnl because these -l options might require -L options that are present in
dnl LIBS. -l options benefit only from the -L options listed before it.
dnl Otherwise, add it to the front of LIBS, because it may be a static
dnl library that depends on another static library that is present in LIBS.
dnl Static libraries benefit only from the static libraries listed after
dnl it.
case " $LIB[]NAME" in
*" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
*) LIBS="$LIB[]NAME $LIBS" ;;
esac
AC_TRY_LINK([$3], [$4],
[ac_cv_lib[]Name=yes],
[ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
LIBS="$ac_save_LIBS"
])
if test "$ac_cv_lib[]Name" = yes; then
HAVE_LIB[]NAME=yes
AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
AC_MSG_CHECKING([how to link with lib[]$1])
AC_MSG_RESULT([$LIB[]NAME])
else
HAVE_LIB[]NAME=no
dnl If $LIB[]NAME didn't lead to a usable library, we don't need
dnl $INC[]NAME either.
CPPFLAGS="$ac_save_CPPFLAGS"
LIB[]NAME=
LTLIB[]NAME=
LIB[]NAME[]_PREFIX=
fi
AC_SUBST([HAVE_LIB]NAME)
AC_SUBST([LIB]NAME)
AC_SUBST([LTLIB]NAME)
AC_SUBST([LIB]NAME[_PREFIX])
popdef([NAME])
popdef([Name])
])
dnl Determine the platform dependent parameters needed to use rpath:
dnl acl_libext,
dnl acl_shlibext,
dnl acl_hardcode_libdir_flag_spec,
dnl acl_hardcode_libdir_separator,
dnl acl_hardcode_direct,
dnl acl_hardcode_minus_L.
AC_DEFUN([AC_LIB_RPATH],
[
dnl Tell automake >= 1.10 to complain if config.rpath is missing.
m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
. ./conftest.sh
rm -f ./conftest.sh
acl_cv_rpath=done
])
wl="$acl_cv_wl"
acl_libext="$acl_cv_libext"
acl_shlibext="$acl_cv_shlibext"
acl_libname_spec="$acl_cv_libname_spec"
acl_library_names_spec="$acl_cv_library_names_spec"
acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
acl_hardcode_direct="$acl_cv_hardcode_direct"
acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
dnl Determine whether the user wants rpath handling at all.
AC_ARG_ENABLE([rpath],
[ --disable-rpath do not hardcode runtime library paths],
:, enable_rpath=yes)
])
dnl AC_LIB_FROMPACKAGE(name, package)
dnl declares that libname comes from the given package. The configure file
dnl will then not have a --with-libname-prefix option but a
dnl --with-package-prefix option. Several libraries can come from the same
dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
dnl macro call that searches for libname.
AC_DEFUN([AC_LIB_FROMPACKAGE],
[
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
define([acl_frompackage_]NAME, [$2])
popdef([NAME])
pushdef([PACK],[$2])
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
define([acl_libsinpackage_]PACKUP,
m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
popdef([PACKUP])
popdef([PACK])
])
dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
dnl the libraries corresponding to explicit and implicit dependencies.
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
dnl Autoconf >= 2.61 supports dots in --with options.
pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_ARG_WITH(P_A_C_K[-prefix],
[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
--without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/$acl_libdirstem"
if test "$acl_libdirstem2" != "$acl_libdirstem" \
&& ! test -d "$withval/$acl_libdirstem"; then
additional_libdir="$withval/$acl_libdirstem2"
fi
fi
fi
])
dnl Search the library and its dependencies in $additional_libdir and
dnl $LDFLAGS. Using breadth-first-seach.
LIB[]NAME=
LTLIB[]NAME=
INC[]NAME=
LIB[]NAME[]_PREFIX=
dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
dnl computed. So it has to be reset here.
HAVE_LIB[]NAME=
rpathdirs=
ltrpathdirs=
names_already_handled=
names_next_round='$1 $2'
while test -n "$names_next_round"; do
names_this_round="$names_next_round"
names_next_round=
for name in $names_this_round; do
already_handled=
for n in $names_already_handled; do
if test "$n" = "$name"; then
already_handled=yes
break
fi
done
if test -z "$already_handled"; then
names_already_handled="$names_already_handled $name"
dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
dnl or AC_LIB_HAVE_LINKFLAGS call.
uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
eval value=\"\$HAVE_LIB$uppername\"
if test -n "$value"; then
if test "$value" = yes; then
eval value=\"\$LIB$uppername\"
test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
eval value=\"\$LTLIB$uppername\"
test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
else
dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
dnl that this library doesn't exist. So just drop it.
:
fi
else
dnl Search the library lib$name in $additional_libdir and $LDFLAGS
dnl and the already constructed $LIBNAME/$LTLIBNAME.
found_dir=
found_la=
found_so=
found_a=
eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
if test -n "$acl_shlibext"; then
shrext=".$acl_shlibext" # typically: shrext=.so
else
shrext=
fi
if test $use_additional = yes; then
dir="$additional_libdir"
dnl The same code as in the loop below:
dnl First look for a shared library.
if test -n "$acl_shlibext"; then
if test -f "$dir/$libname$shrext"; then
found_dir="$dir"
found_so="$dir/$libname$shrext"
else
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
ver=`(cd "$dir" && \
for f in "$libname$shrext".*; do echo "$f"; done \
| sed -e "s,^$libname$shrext\\\\.,," \
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
| sed 1q ) 2>/dev/null`
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
found_dir="$dir"
found_so="$dir/$libname$shrext.$ver"
fi
else
eval library_names=\"$acl_library_names_spec\"
for f in $library_names; do
if test -f "$dir/$f"; then
found_dir="$dir"
found_so="$dir/$f"
break
fi
done
fi
fi
fi
dnl Then look for a static library.
if test "X$found_dir" = "X"; then
if test -f "$dir/$libname.$acl_libext"; then
found_dir="$dir"
found_a="$dir/$libname.$acl_libext"
fi
fi
if test "X$found_dir" != "X"; then
if test -f "$dir/$libname.la"; then
found_la="$dir/$libname.la"
fi
fi
fi
if test "X$found_dir" = "X"; then
for x in $LDFLAGS $LTLIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
case "$x" in
-L*)
dir=`echo "X$x" | sed -e 's/^X-L//'`
dnl First look for a shared library.
if test -n "$acl_shlibext"; then
if test -f "$dir/$libname$shrext"; then
found_dir="$dir"
found_so="$dir/$libname$shrext"
else
if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
ver=`(cd "$dir" && \
for f in "$libname$shrext".*; do echo "$f"; done \
| sed -e "s,^$libname$shrext\\\\.,," \
| sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
| sed 1q ) 2>/dev/null`
if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
found_dir="$dir"
found_so="$dir/$libname$shrext.$ver"
fi
else
eval library_names=\"$acl_library_names_spec\"
for f in $library_names; do
if test -f "$dir/$f"; then
found_dir="$dir"
found_so="$dir/$f"
break
fi
done
fi
fi
fi
dnl Then look for a static library.
if test "X$found_dir" = "X"; then
if test -f "$dir/$libname.$acl_libext"; then
found_dir="$dir"
found_a="$dir/$libname.$acl_libext"
fi
fi
if test "X$found_dir" != "X"; then
if test -f "$dir/$libname.la"; then
found_la="$dir/$libname.la"
fi
fi
;;
esac
if test "X$found_dir" != "X"; then
break
fi
done
fi
if test "X$found_dir" != "X"; then
dnl Found the library.
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
if test "X$found_so" != "X"; then
dnl Linking with a shared library. We attempt to hardcode its
dnl directory into the executable's runpath, unless it's the
dnl standard /usr/lib.
if test "$enable_rpath" = no \
|| test "X$found_dir" = "X/usr/$acl_libdirstem" \
|| test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
dnl No hardcoding is needed.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
dnl Potentially add DIR to ltrpathdirs.
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
haveit=
for x in $ltrpathdirs; do
if test "X$x" = "X$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
ltrpathdirs="$ltrpathdirs $found_dir"
fi
dnl The hardcoding into $LIBNAME is system dependent.
if test "$acl_hardcode_direct" = yes; then
dnl Using DIR/libNAME.so during linking hardcodes DIR into the
dnl resulting binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode DIR into the resulting
dnl binary.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
dnl Potentially add DIR to rpathdirs.
dnl The rpathdirs will be appended to $LIBNAME at the end.
haveit=
for x in $rpathdirs; do
if test "X$x" = "X$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
rpathdirs="$rpathdirs $found_dir"
fi
else
dnl Rely on "-L$found_dir".
dnl But don't add it if it's already contained in the LDFLAGS
dnl or the already constructed $LIBNAME
haveit=
for x in $LDFLAGS $LIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$found_dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
fi
if test "$acl_hardcode_minus_L" != no; then
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
dnl here, because this doesn't fit in flags passed to the
dnl compiler. So give up. No hardcoding. This affects only
dnl very old systems.
dnl FIXME: Not sure whether we should use
dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
dnl here.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
fi
fi
fi
fi
else
if test "X$found_a" != "X"; then
dnl Linking with a static library.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
else
dnl We shouldn't come here, but anyway it's good to have a
dnl fallback.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
fi
fi
dnl Assume the include files are nearby.
additional_includedir=
case "$found_dir" in
*/$acl_libdirstem | */$acl_libdirstem/)
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
if test "$name" = '$1'; then
LIB[]NAME[]_PREFIX="$basedir"
fi
additional_includedir="$basedir/include"
;;
*/$acl_libdirstem2 | */$acl_libdirstem2/)
basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
if test "$name" = '$1'; then
LIB[]NAME[]_PREFIX="$basedir"
fi
additional_includedir="$basedir/include"
;;
esac
if test "X$additional_includedir" != "X"; then
dnl Potentially add $additional_includedir to $INCNAME.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's /usr/local/include and we are using GCC on Linux,
dnl 3. if it's already present in $CPPFLAGS or the already
dnl constructed $INCNAME,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
for x in $CPPFLAGS $INC[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $INCNAME.
INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
fi
fi
fi
fi
fi
dnl Look for dependencies.
if test -n "$found_la"; then
dnl Read the .la file. It defines the variables
dnl dlname, library_names, old_library, dependency_libs, current,
dnl age, revision, installed, dlopen, dlpreopen, libdir.
save_libdir="$libdir"
case "$found_la" in
*/* | *\\*) . "$found_la" ;;
*) . "./$found_la" ;;
esac
libdir="$save_libdir"
dnl We use only dependency_libs.
for dep in $dependency_libs; do
case "$dep" in
-L*)
additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
dnl 3. if it's already present in $LDFLAGS or the already
dnl constructed $LIBNAME,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
&& test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
haveit=
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
|| test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
haveit=
for x in $LDFLAGS $LIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LIBNAME.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
fi
fi
haveit=
for x in $LDFLAGS $LTLIB[]NAME; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LTLIBNAME.
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
fi
fi
fi
fi
;;
-R*)
dir=`echo "X$dep" | sed -e 's/^X-R//'`
if test "$enable_rpath" != no; then
dnl Potentially add DIR to rpathdirs.
dnl The rpathdirs will be appended to $LIBNAME at the end.
haveit=
for x in $rpathdirs; do
if test "X$x" = "X$dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
rpathdirs="$rpathdirs $dir"
fi
dnl Potentially add DIR to ltrpathdirs.
dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
haveit=
for x in $ltrpathdirs; do
if test "X$x" = "X$dir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
ltrpathdirs="$ltrpathdirs $dir"
fi
fi
;;
-l*)
dnl Handle this in the next round.
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
;;
*.la)
dnl Handle this in the next round. Throw away the .la's
dnl directory; it is already contained in a preceding -L
dnl option.
names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
;;
*)
dnl Most likely an immediate library name.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
;;
esac
done
fi
else
dnl Didn't find the library; assume it is in the system directories
dnl known to the linker and runtime loader. (All the system
dnl directories known to the linker should also be known to the
dnl runtime loader, otherwise the system is severely misconfigured.)
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
fi
fi
fi
done
done
if test "X$rpathdirs" != "X"; then
if test -n "$acl_hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user must
dnl pass all path elements in one option. We can arrange that for a
dnl single library, but not when more than one $LIBNAMEs are used.
alldirs=
for found_dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
done
dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
acl_save_libdir="$libdir"
libdir="$alldirs"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
else
dnl The -rpath options are cumulative.
for found_dir in $rpathdirs; do
acl_save_libdir="$libdir"
libdir="$found_dir"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
done
fi
fi
if test "X$ltrpathdirs" != "X"; then
dnl When using libtool, the option that works for both libraries and
dnl executables is -R. The -R options are cumulative.
for found_dir in $ltrpathdirs; do
LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
done
fi
popdef([P_A_C_K])
popdef([PACKLIBS])
popdef([PACKUP])
popdef([PACK])
popdef([NAME])
])
dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
dnl unless already present in VAR.
dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
dnl contains two or three consecutive elements that belong together.
AC_DEFUN([AC_LIB_APPENDTOVAR],
[
for element in [$2]; do
haveit=
for x in $[$1]; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X$element"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
[$1]="${[$1]}${[$1]:+ }$element"
fi
done
])
dnl For those cases where a variable contains several -L and -l options
dnl referring to unknown libraries and directories, this macro determines the
dnl necessary additional linker options for the runtime path.
dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
dnl otherwise linking without libtool is assumed.
AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
[
AC_REQUIRE([AC_LIB_RPATH])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
$1=
if test "$enable_rpath" != no; then
if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
dnl Use an explicit option to hardcode directories into the resulting
dnl binary.
rpathdirs=
next=
for opt in $2; do
if test -n "$next"; then
dir="$next"
dnl No need to hardcode the standard /usr/lib.
if test "X$dir" != "X/usr/$acl_libdirstem" \
&& test "X$dir" != "X/usr/$acl_libdirstem2"; then
rpathdirs="$rpathdirs $dir"
fi
next=
else
case $opt in
-L) next=yes ;;
-L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
dnl No need to hardcode the standard /usr/lib.
if test "X$dir" != "X/usr/$acl_libdirstem" \
&& test "X$dir" != "X/usr/$acl_libdirstem2"; then
rpathdirs="$rpathdirs $dir"
fi
next= ;;
*) next= ;;
esac
fi
done
if test "X$rpathdirs" != "X"; then
if test -n ""$3""; then
dnl libtool is used for linking. Use -R options.
for dir in $rpathdirs; do
$1="${$1}${$1:+ }-R$dir"
done
else
dnl The linker is used for linking directly.
if test -n "$acl_hardcode_libdir_separator"; then
dnl Weird platform: only the last -rpath option counts, the user
dnl must pass all path elements in one option.
alldirs=
for dir in $rpathdirs; do
alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
done
acl_save_libdir="$libdir"
libdir="$alldirs"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
$1="$flag"
else
dnl The -rpath options are cumulative.
for dir in $rpathdirs; do
acl_save_libdir="$libdir"
libdir="$dir"
eval flag=\"$acl_hardcode_libdir_flag_spec\"
libdir="$acl_save_libdir"
$1="${$1}${$1:+ }$flag"
done
fi
fi
fi
fi
fi
AC_SUBST([$1])
])
-224
View File
@@ -1,224 +0,0 @@
# lib-prefix.m4 serial 7 (gettext-0.18)
dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
dnl require excessive bracketing.
ifdef([AC_HELP_STRING],
[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
dnl to access previously installed libraries. The basic assumption is that
dnl a user will want packages to use other packages he previously installed
dnl with the same --prefix option.
dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
dnl libraries, but is otherwise very convenient.
AC_DEFUN([AC_LIB_PREFIX],
[
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
dnl By default, look in $includedir and $libdir.
use_additional=yes
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
AC_LIB_ARG_WITH([lib-prefix],
[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
--without-lib-prefix don't search for libraries in includedir and libdir],
[
if test "X$withval" = "Xno"; then
use_additional=no
else
if test "X$withval" = "X"; then
AC_LIB_WITH_FINAL_PREFIX([
eval additional_includedir=\"$includedir\"
eval additional_libdir=\"$libdir\"
])
else
additional_includedir="$withval/include"
additional_libdir="$withval/$acl_libdirstem"
fi
fi
])
if test $use_additional = yes; then
dnl Potentially add $additional_includedir to $CPPFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/include,
dnl 2. if it's already present in $CPPFLAGS,
dnl 3. if it's /usr/local/include and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_includedir" != "X/usr/include"; then
haveit=
for x in $CPPFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-I$additional_includedir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_includedir" = "X/usr/local/include"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_includedir"; then
dnl Really add $additional_includedir to $CPPFLAGS.
CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
fi
fi
fi
fi
dnl Potentially add $additional_libdir to $LDFLAGS.
dnl But don't add it
dnl 1. if it's the standard /usr/lib,
dnl 2. if it's already present in $LDFLAGS,
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
haveit=
for x in $LDFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
if test "X$x" = "X-L$additional_libdir"; then
haveit=yes
break
fi
done
if test -z "$haveit"; then
if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
esac
fi
fi
if test -z "$haveit"; then
if test -d "$additional_libdir"; then
dnl Really add $additional_libdir to $LDFLAGS.
LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
fi
fi
fi
fi
fi
])
dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
dnl acl_final_exec_prefix, containing the values to which $prefix and
dnl $exec_prefix will expand at the end of the configure script.
AC_DEFUN([AC_LIB_PREPARE_PREFIX],
[
dnl Unfortunately, prefix and exec_prefix get only finally determined
dnl at the end of configure.
if test "X$prefix" = "XNONE"; then
acl_final_prefix="$ac_default_prefix"
else
acl_final_prefix="$prefix"
fi
if test "X$exec_prefix" = "XNONE"; then
acl_final_exec_prefix='${prefix}'
else
acl_final_exec_prefix="$exec_prefix"
fi
acl_save_prefix="$prefix"
prefix="$acl_final_prefix"
eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
prefix="$acl_save_prefix"
])
dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
dnl variables prefix and exec_prefix bound to the values they will have
dnl at the end of the configure script.
AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
[
acl_save_prefix="$prefix"
prefix="$acl_final_prefix"
acl_save_exec_prefix="$exec_prefix"
exec_prefix="$acl_final_exec_prefix"
$1
exec_prefix="$acl_save_exec_prefix"
prefix="$acl_save_prefix"
])
dnl AC_LIB_PREPARE_MULTILIB creates
dnl - a variable acl_libdirstem, containing the basename of the libdir, either
dnl "lib" or "lib64" or "lib/64",
dnl - a variable acl_libdirstem2, as a secondary possible value for
dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
dnl "lib/amd64".
AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
[
dnl There is no formal standard regarding lib and lib64.
dnl On glibc systems, the current practice is that on a system supporting
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
dnl the compiler's default mode by looking at the compiler's library search
dnl path. If at least one of its elements ends in /lib64 or points to a
dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
dnl Otherwise we use the default, namely "lib".
dnl On Solaris systems, the current practice is that on a system supporting
dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
AC_REQUIRE([AC_CANONICAL_HOST])
acl_libdirstem=lib
acl_libdirstem2=
case "$host_os" in
solaris*)
dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
dnl symlink is missing, so we set acl_libdirstem2 too.
AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
[AC_EGREP_CPP([sixtyfour bits], [
#ifdef _LP64
sixtyfour bits
#endif
], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
])
if test $gl_cv_solaris_64bit = yes; then
acl_libdirstem=lib/64
case "$host_cpu" in
sparc*) acl_libdirstem2=lib/sparcv9 ;;
i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
esac
fi
;;
*)
searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
if test -n "$searchpath"; then
acl_save_IFS="${IFS= }"; IFS=":"
for searchdir in $searchpath; do
if test -d "$searchdir"; then
case "$searchdir" in
*/lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
*/../ | */.. )
# Better ignore directories of this form. They are misleading.
;;
*) searchdir=`cd "$searchdir" && pwd`
case "$searchdir" in
*/lib64 ) acl_libdirstem=lib64 ;;
esac ;;
esac
fi
done
IFS="$acl_save_IFS"
fi
;;
esac
test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
])
-65
View File
@@ -1,65 +0,0 @@
noinst_LTLIBRARIES = libeglib.la
AM_CFLAGS = $(WERROR_CFLAGS)
win_files = \
eglib-config.hw \
gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
gmodule-win32.c gmodule-win32-internals.h gtimer-win32.c gunicode-win32.c
unix_files = \
gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
gmodule-unix.c gtimer-unix.c
if HOST_WIN32
os_files = $(win_files)
else
os_files = $(unix_files)
endif
libeglib_la_SOURCES = \
eglib-remap.h \
sort.frag.h \
glib.h \
garray.c \
gbytearray.c \
gerror.c \
ghashtable.c \
giconv.c \
gmem.c \
gmodule.h \
goutput.c \
gqsort.c \
gstr.c \
gslist.c \
gstring.c \
gptrarray.c \
glist.c \
gqueue.c \
gpath.c \
gshell.c \
gspawn.c \
gfile.c \
gfile-posix.c \
gpattern.c \
gmarkup.c \
gutf8.c \
gunicode.c \
unicode-data.h \
$(os_files)
libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
AM_CPPFLAGS = -I$(srcdir)
if HOST_WIN32
libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
else
if PLATFORM_ANDROID
libeglib_la_LIBADD = -llog
endif
endif
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = eglib-config.h.in $(win_files) $(unix_files)
-42
View File
@@ -1,42 +0,0 @@
#ifndef __EGLIB_CONFIG_H
#define __EGLIB_CONFIG_H
/*
* System-dependent settings
*/
#define G_GNUC_PRETTY_FUNCTION @GNUC_PRETTY@
#define G_GNUC_UNUSED @GNUC_UNUSED@
#define G_BYTE_ORDER @ORDER@
#define G_GNUC_NORETURN @GNUC_NORETURN@
#define G_SEARCHPATH_SEPARATOR_S "@SEARCHSEP@"
#define G_SEARCHPATH_SEPARATOR '@SEARCHSEP@'
#define G_DIR_SEPARATOR '@PATHSEP@'
#define G_DIR_SEPARATOR_S "@PATHSEP@"
#define G_BREAKPOINT() @BREAKPOINT@
#define G_OS_@OS@
#define GPOINTER_TO_INT(ptr) @GPOINTER_TO_INT@
#define GPOINTER_TO_UINT(ptr) @GPOINTER_TO_UINT@
#define GINT_TO_POINTER(v) @GINT_TO_POINTER@
#define GUINT_TO_POINTER(v) @GUINT_TO_POINTER@
#if @HAVE_ALLOCA_H@ == 1
#define G_HAVE_ALLOCA_H
#endif
typedef unsigned @GSIZE@ gsize;
typedef signed @GSIZE@ gssize;
#define G_GSIZE_FORMAT @GSIZE_FORMAT@
#if @G_HAVE_ISO_VARARGS@ == 1
#define G_HAVE_ISO_VARARGS
#endif
#if defined (HOST_WATCHOS)
#undef G_BREAKPOINT
#define G_BREAKPOINT()
#endif
typedef @PIDTYPE@ GPid;
#endif
-63
View File
@@ -1,63 +0,0 @@
#ifndef __EGLIB_CONFIG_H
#define __EGLIB_CONFIG_H
/*
* System-dependent settings
*/
#define G_OS_WIN32 1
#ifdef _MSC_VER
#include <io.h>
#define G_GNUC_PRETTY_FUNCTION __FUNCTION__
#define G_GNUC_UNUSED
#define G_BYTE_ORDER 1234
#define G_GNUC_NORETURN
#define G_BREAKPOINT() __debugbreak()
#define MAXPATHLEN 242
typedef uintptr_t gsize;
typedef intptr_t gssize;
typedef int pid_t;
#define G_DIR_SEPARATOR '\\'
#define G_DIR_SEPARATOR_S "\\"
#define G_SEARCHPATH_SEPARATOR_S ";"
#define G_SEARCHPATH_SEPARATOR ';'
#define G_GSIZE_FORMAT "d"
#define GPOINTER_TO_INT(ptr) ((gint)(intptr_t) (ptr))
#define GPOINTER_TO_UINT(ptr) ((guint)(intptr_t) (ptr))
#define GINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
#define GUINT_TO_POINTER(v) ((gpointer)(intptr_t) (v))
#define STDOUT_FILENO (int)(intptr_t)stdout
#define STDERR_FILENO (int)(intptr_t)stderr
/* FIXME: what should this be ?*/
#define X_OK 4 /* This is really read */
#define WNOHANG 1
#define F_SETFD 1
#define FD_CLOEXEC 1
#undef inline
#define inline __inline
#define strtok_r strtok_s
#undef G_HAVE_UNISTD_H
#undef G_HAVE_SYS_TIME_H
#undef G_HAVE_SYS_WAIT_H
#undef G_HAVE_PWD_H
#undef G_HAVE_STRNDUP
#define G_HAVE_GETOPT_H 1
/* disable the following warnings
* C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
* C4127: conditional expression is constant
*/
#pragma warning(disable:4100 4127)
#endif
typedef void * GPid;
#endif
-277
View File
@@ -1,277 +0,0 @@
/*
* Output and debugging functions
*
* Author:
* Miguel de Icaza ([email protected])
*
* (C) 2006 Novell, Inc.
* Copyright 2011 Xamarin Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
/* The current fatal levels, error is always fatal */
static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
static GLogFunc default_log_func;
static gpointer default_log_func_user_data;
static GPrintFunc stdout_handler, stderr_handler;
static void default_stdout_handler (const gchar *string);
static void default_stderr_handler (const gchar *string);
void
g_print (const gchar *format, ...)
{
char *msg;
va_list args;
va_start (args, format);
if (g_vasprintf (&msg, format, args) < 0) {
va_end (args);
return;
}
va_end (args);
if (!stdout_handler)
stdout_handler = default_stdout_handler;
stdout_handler (msg);
g_free (msg);
}
void
g_printerr (const gchar *format, ...)
{
char *msg;
va_list args;
va_start (args, format);
if (g_vasprintf (&msg, format, args) < 0) {
va_end (args);
return;
}
va_end (args);
if (!stderr_handler)
stderr_handler = default_stderr_handler;
stderr_handler (msg);
g_free (msg);
}
GLogLevelFlags
g_log_set_always_fatal (GLogLevelFlags fatal_mask)
{
GLogLevelFlags old_fatal = fatal;
fatal |= fatal_mask;
return old_fatal;
}
GLogLevelFlags
g_log_set_fatal_mask (const gchar *log_domain, GLogLevelFlags fatal_mask)
{
/*
* Mono does not use a G_LOG_DOMAIN currently, so we just assume things are fatal
* if we decide to set G_LOG_DOMAIN (we probably should) we should implement
* this.
*/
return fatal_mask;
}
void
g_logv (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, va_list args)
{
char *msg;
if (!default_log_func)
default_log_func = g_log_default_handler;
if (g_vasprintf (&msg, format, args) < 0)
return;
default_log_func (log_domain, log_level, msg, default_log_func_user_data);
g_free (msg);
}
void
g_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *format, ...)
{
va_list args;
va_start (args, format);
g_logv (log_domain, log_level, format, args);
va_end (args);
}
void
g_assertion_message (const gchar *format, ...)
{
va_list args;
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
va_end (args);
exit (0);
}
#if PLATFORM_ANDROID
#include <android/log.h>
static android_LogPriority
to_android_priority (GLogLevelFlags log_level)
{
switch (log_level & G_LOG_LEVEL_MASK)
{
case G_LOG_LEVEL_ERROR: return ANDROID_LOG_FATAL;
case G_LOG_LEVEL_CRITICAL: return ANDROID_LOG_ERROR;
case G_LOG_LEVEL_WARNING: return ANDROID_LOG_WARN;
case G_LOG_LEVEL_MESSAGE: return ANDROID_LOG_INFO;
case G_LOG_LEVEL_INFO: return ANDROID_LOG_DEBUG;
case G_LOG_LEVEL_DEBUG: return ANDROID_LOG_VERBOSE;
}
return ANDROID_LOG_UNKNOWN;
}
void
g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
{
__android_log_write (to_android_priority (log_level), log_domain, message);
if (log_level & fatal)
abort ();
}
static void
default_stdout_handler (const gchar *message)
{
/* TODO: provide a proper app name */
__android_log_write (ANDROID_LOG_ERROR, "mono", message);
}
static void
default_stderr_handler (const gchar *message)
{
/* TODO: provide a proper app name */
__android_log_write (ANDROID_LOG_ERROR, "mono", message);
}
#elif defined(HOST_IOS)
#include <asl.h>
static int
to_asl_priority (GLogLevelFlags log_level)
{
switch (log_level & G_LOG_LEVEL_MASK)
{
case G_LOG_LEVEL_ERROR: return ASL_LEVEL_CRIT;
case G_LOG_LEVEL_CRITICAL: return ASL_LEVEL_ERR;
case G_LOG_LEVEL_WARNING: return ASL_LEVEL_WARNING;
case G_LOG_LEVEL_MESSAGE: return ASL_LEVEL_NOTICE;
case G_LOG_LEVEL_INFO: return ASL_LEVEL_INFO;
case G_LOG_LEVEL_DEBUG: return ASL_LEVEL_DEBUG;
}
return ASL_LEVEL_ERR;
}
void
g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
{
asl_log (NULL, NULL, to_asl_priority (log_level), "%s", message);
if (log_level & fatal)
abort ();
}
static void
default_stdout_handler (const gchar *message)
{
asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
}
static void
default_stderr_handler (const gchar *message)
{
asl_log (NULL, NULL, ASL_LEVEL_WARNING, "%s", message);
}
#else
void
g_log_default_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer unused_data)
{
FILE *target = stdout;
fprintf (target, "%s%s%s\n",
log_domain != NULL ? log_domain : "",
log_domain != NULL ? ": " : "",
message);
if (log_level & fatal) {
fflush (stdout);
fflush (stderr);
abort ();
}
}
static void
default_stdout_handler (const gchar *string)
{
fprintf (stdout, "%s", string);
}
static void
default_stderr_handler (const gchar *string)
{
fprintf (stderr, "%s", string);
}
#endif
GLogFunc
g_log_set_default_handler (GLogFunc log_func, gpointer user_data)
{
GLogFunc old = default_log_func;
default_log_func = log_func;
default_log_func_user_data = user_data;
return old;
}
GPrintFunc
g_set_print_handler (GPrintFunc func)
{
GPrintFunc old = stdout_handler;
stdout_handler = func;
return old;
}
GPrintFunc
g_set_printerr_handler (GPrintFunc func)
{
GPrintFunc old = stderr_handler;
stderr_handler = func;
return old;
}
-44
View File
@@ -1,44 +0,0 @@
EXTRA_DIST = UTF-8.txt UTF-16BE.txt UTF-16LE.txt UTF-32BE.txt UTF-32LE.txt
SOURCES = \
test.c \
test.h \
tests.h \
driver.c \
hashtable.c \
string-util.c \
string.c \
slist.c \
sizes.c \
ptrarray.c \
list.c \
array.c \
fake.c \
path.c \
queue.c \
shell.c \
spawn.c \
timer.c \
file.c \
pattern.c \
dir.c \
markup.c \
unicode.c \
utf8.c \
endian.c \
module.c \
memory.c
test_eglib_SOURCES = $(SOURCES)
test_eglib_CFLAGS = -Wall -DEGLIB_TESTS=1 -D_FORTIFY_SOURCE=2 -I$(srcdir)/../src -I../src -DDRIVER_NAME=\"EGlib\"
test_eglib_LDADD = ../src/libeglib.la $(LIBICONV)
run-eglib: all
srcdir=`readlink -f $(srcdir)` ./test-eglib
noinst_PROGRAMS = test-eglib
run-both: run-eglib
MAINTAINERCLEANFILES = Makefile.in
-255
View File
@@ -1,255 +0,0 @@
/*
* EGLib Unit Test Driver
*
* Author:
* Aaron Bockover ([email protected])
*
* (C) 2006 Novell, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include "test.h"
#ifndef DRIVER_EXTERNAL_TESTS
#include "tests.h"
#endif
#include <stdio.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#ifndef DRIVER_NAME
#define DRIVER_NAME "EGlib"
#endif
typedef struct _StringArray {
gchar **strings;
gint length;
} StringArray;
static StringArray *
string_array_append(StringArray *array, gchar *string)
{
if(array == NULL) {
array = g_new0(StringArray, 1);
array->length = 1;
array->strings = g_malloc(sizeof(gchar *) * 2);
} else {
array->length++;
array->strings = g_realloc(array->strings, sizeof(gchar *)
* (array->length + 1));
}
array->strings[array->length - 1] = string;
array->strings[array->length] = NULL;
return array;
}
gint global_passed = 0, global_tests = 0;
static void
string_array_free(StringArray *array)
{
g_free(array->strings);
g_free(array);
}
static void print_help(char *s)
{
gint i;
printf("Usage: %s [OPTION]... [TESTGROUP]...\n\n", s);
printf("OPTIONS are:\n");
printf(" -h, --help show this help\n");
printf(" -t, --time time the tests\n");
printf(" -i, --iterations number of times to run tests\n");
printf(" -q, --quiet do not print test results; "
"final time always prints\n");
printf(" -n, --no-labels print final time without labels, "
"nice for scripts\n");
printf(" -d, --debug do not run tests, "
"debug the driver itself for valgrind\n\n");
printf("TESTGROUPS available:\n");
for(i = 0; test_groups[i].name != NULL; i++) {
if(test_groups[i].handler != fake_tests_init) {
printf(" %s\n", test_groups[i].name);
}
}
printf("\n");
}
#ifdef DRIVER_EXTERNAL_MAIN
gint run_tests_main(gint argc, gchar **argv)
#else
gint main(gint argc, gchar **argv)
#endif
{
gint i, j, c, iterations = 1;
StringArray *tests_to_run = NULL;
gdouble time_start;
gboolean report_time = FALSE;
gboolean quiet = FALSE;
gboolean global_failure = FALSE;
gboolean no_final_time_labels = FALSE;
gboolean debug = FALSE;
#if HAVE_GETOPT_H
static struct option long_options [] = {
{"help", no_argument, 0, 'h'},
{"time", no_argument, 0, 't'},
{"quiet", no_argument, 0, 'q'},
{"iterations", required_argument, 0, 'i'},
{"debug", no_argument, 0, 'd'},
{"no-labels", no_argument, 0, 'n'},
{0, 0, 0, 0}
};
while((c = getopt_long(argc, argv, "dhtqni:", long_options, NULL)) != -1) { switch(c) {
case 'h':
print_help(argv[0]);
return 1;
case 't':
report_time = TRUE;
break;
case 'i':
iterations = atoi(optarg);
break;
case 'q':
quiet = TRUE;
break;
case 'n':
no_final_time_labels = TRUE;
break;
case 'd':
debug = TRUE;
break;
}
}
for(i = optind; i < argc; i++) {
if(argv[i][0] == '-') {
continue;
}
tests_to_run = string_array_append(tests_to_run, argv[i]);
}
#endif
time_start = get_timestamp();
for(j = 0; test_groups[j].name != NULL; j++) {
gboolean run = TRUE;
gchar *tests = NULL;
gchar *group = NULL;
if(tests_to_run != NULL) {
gint k;
run = FALSE;
for(k = 0; k < tests_to_run->length; k++) {
gchar *user = tests_to_run->strings[k];
const gchar *table = test_groups[j].name;
size_t user_len = strlen(user);
size_t table_len = strlen(table);
if(strncmp(user, table, table_len) == 0) {
if(user_len > table_len && user[table_len] != ':') {
break;
}
run = TRUE;
group = tests_to_run->strings[k];
break;
}
}
}
if(run) {
gboolean passed;
gchar **split = NULL;
if(debug && test_groups[j].handler != fake_tests_init) {
printf("Skipping %s, in driver debug mode\n",
test_groups[j].name);
continue;
} else if(!debug && test_groups[j].handler == fake_tests_init) {
continue;
}
if(group != NULL) {
split = eg_strsplit(group, ":", -1);
if(split != NULL) {
gint m;
for(m = 0; split[m] != NULL; m++) {
if(m == 1) {
tests = strdup(split[m]);
break;
}
}
eg_strfreev(split);
}
}
passed = run_group(&(test_groups[j]),
iterations, quiet, report_time, tests);
if(tests != NULL) {
g_free(tests);
}
if(!passed && !global_failure) {
global_failure = TRUE;
}
}
}
if(!quiet) {
gdouble pass_percentage = ((gdouble)global_passed / (gdouble)global_tests) * 100.0;
printf("=============================\n");
printf("Overall result: %s : %d / %d (%g%%)\n", global_failure ? "FAILED" : "OK", global_passed, global_tests, pass_percentage);
}
if(report_time) {
gdouble duration = get_timestamp() - time_start;
if(no_final_time_labels) {
printf("%g\n", duration);
} else {
printf("%s Total Time: %g\n", DRIVER_NAME, duration);
}
}
if(tests_to_run != NULL) {
string_array_free(tests_to_run);
}
return global_tests - global_passed;
}
-438
View File
@@ -1,438 +0,0 @@
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "test.h"
RESULT
test_list_length ()
{
GList *list = g_list_prepend (NULL, "foo");
if (g_list_length (list) != 1)
return FAILED ("length failed. #1");
list = g_list_prepend (list, "bar");
if (g_list_length (list) != 2)
return FAILED ("length failed. #2");
list = g_list_append (list, "bar");
if (g_list_length (list) != 3)
return FAILED ("length failed. #3");
g_list_free (list);
return NULL;
}
RESULT
test_list_nth ()
{
char *foo = "foo";
char *bar = "bar";
char *baz = "baz";
GList *nth, *list;
list = g_list_prepend (NULL, baz);
list = g_list_prepend (list, bar);
list = g_list_prepend (list, foo);
nth = g_list_nth (list, 0);
if (nth->data != foo)
return FAILED ("nth failed. #0");
nth = g_list_nth (list, 1);
if (nth->data != bar)
return FAILED ("nth failed. #1");
nth = g_list_nth (list, 2);
if (nth->data != baz)
return FAILED ("nth failed. #2");
nth = g_list_nth (list, 3);
if (nth)
return FAILED ("nth failed. #3: %s", nth->data);
g_list_free (list);
return OK;
}
RESULT
test_list_index ()
{
int i;
char *foo = "foo";
char *bar = "bar";
char *baz = "baz";
GList *list;
list = g_list_prepend (NULL, baz);
list = g_list_prepend (list, bar);
list = g_list_prepend (list, foo);
i = g_list_index (list, foo);
if (i != 0)
return FAILED ("index failed. #0: %d", i);
i = g_list_index (list, bar);
if (i != 1)
return FAILED ("index failed. #1: %d", i);
i = g_list_index (list, baz);
if (i != 2)
return FAILED ("index failed. #2: %d", i);
g_list_free (list);
return OK;
}
RESULT
test_list_append ()
{
GList *list = g_list_prepend (NULL, "first");
if (g_list_length (list) != 1)
return FAILED ("Prepend failed");
list = g_list_append (list, "second");
if (g_list_length (list) != 2)
return FAILED ("Append failed");
g_list_free (list);
return OK;
}
RESULT
test_list_last ()
{
GList *foo = g_list_prepend (NULL, "foo");
GList *bar = g_list_prepend (NULL, "bar");
GList *last;
foo = g_list_concat (foo, bar);
last = g_list_last (foo);
if (last != bar)
return FAILED ("last failed. #1");
foo = g_list_concat (foo, g_list_prepend (NULL, "baz"));
foo = g_list_concat (foo, g_list_prepend (NULL, "quux"));
last = g_list_last (foo);
if (strcmp ("quux", last->data))
return FAILED ("last failed. #2");
g_list_free (foo);
return OK;
}
RESULT
test_list_concat ()
{
GList *foo = g_list_prepend (NULL, "foo");
GList *bar = g_list_prepend (NULL, "bar");
GList *list = g_list_concat (foo, bar);
if (g_list_length (list) != 2)
return FAILED ("Concat failed. #1");
if (strcmp (list->data, "foo"))
return FAILED ("Concat failed. #2");
if (strcmp (list->next->data, "bar"))
return FAILED ("Concat failed. #3");
if (g_list_first (list) != foo)
return FAILED ("Concat failed. #4");
if (g_list_last (list) != bar)
return FAILED ("Concat failed. #5");
g_list_free (list);
return OK;
}
static gint
compare (gconstpointer a, gconstpointer b)
{
char *foo = (char *) a;
char *bar = (char *) b;
if (strlen (foo) < strlen (bar))
return -1;
return 1;
}
RESULT
test_list_insert_sorted ()
{
GList *list = g_list_prepend (NULL, "a");
list = g_list_append (list, "aaa");
/* insert at the middle */
list = g_list_insert_sorted (list, "aa", compare);
if (strcmp ("aa", list->next->data))
return FAILED ("insert_sorted failed. #1");
/* insert at the beginning */
list = g_list_insert_sorted (list, "", compare);
if (strcmp ("", list->data))
return FAILED ("insert_sorted failed. #2");
/* insert at the end */
list = g_list_insert_sorted (list, "aaaa", compare);
if (strcmp ("aaaa", g_list_last (list)->data))
return FAILED ("insert_sorted failed. #3");
g_list_free (list);
return OK;
}
RESULT
test_list_copy ()
{
int i, length;
GList *list, *copy;
list = g_list_prepend (NULL, "a");
list = g_list_append (list, "aa");
list = g_list_append (list, "aaa");
list = g_list_append (list, "aaaa");
length = g_list_length (list);
copy = g_list_copy (list);
for (i = 0; i < length; i++)
if (strcmp (g_list_nth (list, i)->data,
g_list_nth (copy, i)->data))
return FAILED ("copy failed.");
g_list_free (list);
g_list_free (copy);
return OK;
}
RESULT
test_list_reverse ()
{
guint i, length;
GList *list, *reverse;
list = g_list_prepend (NULL, "a");
list = g_list_append (list, "aa");
list = g_list_append (list, "aaa");
list = g_list_append (list, "aaaa");
length = g_list_length (list);
reverse = g_list_reverse (g_list_copy (list));
if (g_list_length (reverse) != length)
return FAILED ("reverse failed #1");
for (i = 0; i < length; i++){
guint j = length - i - 1;
if (strcmp (g_list_nth (list, i)->data,
g_list_nth (reverse, j)->data))
return FAILED ("reverse failed. #2");
}
g_list_free (list);
g_list_free (reverse);
return OK;
}
RESULT
test_list_remove ()
{
GList *list = g_list_prepend (NULL, "three");
char *one = "one";
list = g_list_prepend (list, "two");
list = g_list_prepend (list, one);
list = g_list_remove (list, one);
if (g_list_length (list) != 2)
return FAILED ("Remove failed");
if (strcmp ("two", list->data) != 0)
return FAILED ("Remove failed");
g_list_free (list);
return OK;
}
RESULT
test_list_remove_link ()
{
GList *foo = g_list_prepend (NULL, "a");
GList *bar = g_list_prepend (NULL, "b");
GList *baz = g_list_prepend (NULL, "c");
GList *list = foo;
foo = g_list_concat (foo, bar);
foo = g_list_concat (foo, baz);
list = g_list_remove_link (list, bar);
if (g_list_length (list) != 2)
return FAILED ("remove_link failed #1");
if (bar->next != NULL)
return FAILED ("remove_link failed #2");
g_list_free (list);
g_list_free (bar);
return OK;
}
RESULT
test_list_insert_before ()
{
GList *foo, *bar, *baz;
foo = g_list_prepend (NULL, "foo");
foo = g_list_insert_before (foo, NULL, "bar");
bar = g_list_last (foo);
if (strcmp (bar->data, "bar"))
return FAILED ("1");
baz = g_list_insert_before (foo, bar, "baz");
if (foo != baz)
return FAILED ("2");
if (strcmp (g_list_nth_data (foo, 1), "baz"))
return FAILED ("3: %s", g_list_nth_data (foo, 1));
g_list_free (foo);
return OK;
}
#define N_ELEMS 101
static int intcompare (gconstpointer p1, gconstpointer p2)
{
return GPOINTER_TO_INT (p1) - GPOINTER_TO_INT (p2);
}
static gboolean verify_sort (GList *list, int len)
{
int prev;
if (list->prev)
return FALSE;
prev = GPOINTER_TO_INT (list->data);
len--;
for (list = list->next; list; list = list->next) {
int curr = GPOINTER_TO_INT (list->data);
if (prev > curr)
return FALSE;
prev = curr;
if (!list->prev || list->prev->next != list)
return FALSE;
if (len == 0)
return FALSE;
len--;
}
return len == 0;
}
RESULT
test_list_sort ()
{
int i, j, mul;
GList *list = NULL;
for (i = 0; i < N_ELEMS; ++i)
list = g_list_prepend (list, GINT_TO_POINTER (i));
list = g_list_sort (list, intcompare);
if (!verify_sort (list, N_ELEMS))
return FAILED ("decreasing list");
g_list_free (list);
list = NULL;
for (i = 0; i < N_ELEMS; ++i)
list = g_list_prepend (list, GINT_TO_POINTER (-i));
list = g_list_sort (list, intcompare);
if (!verify_sort (list, N_ELEMS))
return FAILED ("increasing list");
g_list_free (list);
list = g_list_prepend (NULL, GINT_TO_POINTER (0));
for (i = 1; i < N_ELEMS; ++i) {
list = g_list_prepend (list, GINT_TO_POINTER (i));
list = g_list_prepend (list, GINT_TO_POINTER (-i));
}
list = g_list_sort (list, intcompare);
if (!verify_sort (list, 2*N_ELEMS-1))
return FAILED ("alternating list");
g_list_free (list);
list = NULL;
mul = 1;
for (i = 1; i < N_ELEMS; ++i) {
mul = -mul;
for (j = 0; j < i; ++j)
list = g_list_prepend (list, GINT_TO_POINTER (mul * j));
}
list = g_list_sort (list, intcompare);
if (!verify_sort (list, (N_ELEMS*N_ELEMS - N_ELEMS)/2))
return FAILED ("wavering list");
g_list_free (list);
return OK;
}
static gint
find_custom (gconstpointer a, gconstpointer b)
{
return(strcmp (a, b));
}
RESULT
test_list_find_custom ()
{
GList *list = NULL, *found;
char *foo = "foo";
char *bar = "bar";
char *baz = "baz";
list = g_list_prepend (list, baz);
list = g_list_prepend (list, bar);
list = g_list_prepend (list, foo);
found = g_list_find_custom (list, baz, find_custom);
if (found == NULL)
return FAILED ("Find failed");
g_list_free (list);
return OK;
}
static Test list_tests [] = {
{ "length", test_list_length},
{ "nth", test_list_nth},
{ "index", test_list_index},
{ "last", test_list_last},
{ "append", test_list_append},
{ "concat", test_list_concat},
{"insert_sorted", test_list_insert_sorted},
{"insert_before", test_list_insert_before},
{ "copy", test_list_copy},
{ "reverse", test_list_reverse},
{ "remove", test_list_remove},
{ "remove_link", test_list_remove_link},
{ "remove_link", test_list_remove_link},
{ "sort", test_list_sort},
{ "find_custom", test_list_find_custom},
{NULL, NULL}
};
DEFINE_TEST_GROUP_INIT(list_tests_init, list_tests)
-107
View File
@@ -1,107 +0,0 @@
/* config.h. Generated by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
#ifndef _MSC_VER
#include "cygconfig.h"
#else
#ifndef HAVE_WINAPI_FAMILY_SUPPORT
#define HAVE_WINAPI_FAMILY_SUPPORT
/* WIN API Family support */
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define HAVE_CLASSIC_WINAPI_SUPPORT 1
#define HAVE_UWP_WINAPI_SUPPORT 0
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 1
#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
#error Unsupported WINAPI family
#endif
#else
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 0
#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
#error Unsupported WINAPI family
#endif
#endif
#endif
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <pwd.h> header file. */
/* #undef HAVE_PWD_H 1 */
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
/* #undef HAVE_STRLCPY */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
/* #undef HAVE_SYS_TIME_H */
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
/* #undef HAVE_SYS_WAIT_H */
/* Define to 1 if you have the <unistd.h> header file. */
/* #undef HAVE_UNISTD_H */
/* Name of package */
#define PACKAGE "eglib"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
/* The size of a `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 4
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.1"
#define HAVE_STRTOK_R 1
#endif
+1 -1
+1 -1
+1 -1
+1 -1
+1 -1
+3 -1
View File
@@ -1,9 +1,11 @@
AM_CPPFLAGS = $(GLIB_CFLAGS)
glib_libs = $(top_builddir)/mono/eglib/libeglib.la
lib_LTLIBRARIES = libikvm-native.la
libikvm_native_la_SOURCES = jni.c os.c jni.h
libikvm_native_la_LDFLAGS = -avoid-version
libikvm_native_la_LIBADD = $(GLIB_LIBS)
libikvm_native_la_LIBADD = $(glib_libs)
+1 -1
View File
@@ -49,7 +49,7 @@ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \
backgraph.c win32_threads.c \
pthread_support.c pthread_stop_world.c darwin_stop_world.c \
openbsd_stop_world.c mach_dep.c $(asm_libgc_sources)
mach_dep.c $(asm_libgc_sources)
# Include THREADDLLIBS here to ensure that the correct versions of
# linuxthread semaphore functions get linked:
+5 -4
View File
@@ -74,12 +74,13 @@ if test x$NOCONFIGURE = x && test -z "$*"; then
echo
fi
am_opt="--add-missing --copy --gnu -Wno-obsolete"
case $CC in
xlc )
am_opt=--include-deps;;
am_opt="$am_opt --include-deps";;
esac
if grep "^AC_PROG_LIBTOOL" configure.ac >/dev/null; then
if test -z "$NO_LIBTOOLIZE" ; then
echo "Running libtoolize..."
@@ -104,8 +105,8 @@ if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu -Wno-obsolete $am_opt ||
echo "Running automake $am_opt ..."
automake $am_opt ||
{ echo "**Error**: automake failed."; exit 1; }
echo "Running autoconf ..."
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
+4
View File
@@ -104,6 +104,10 @@ case "$THREADS" in
AC_DEFINE(GC_AIX_THREADS)
AC_DEFINE(_REENTRANT)
;;
*-*-haiku*)
AC_DEFINE(GC_HAIKU_THREADS)
AC_DEFINE(_REENTRANT)
;;
*-*-hpux*)
AC_MSG_WARN("Only HP/UX 11 threads are supported.")
AC_DEFINE(GC_HPUX_THREADS)
+20 -2
View File
@@ -59,7 +59,7 @@
!(defined(FREEBSD) && defined(__ELF__)) && \
!(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \
!(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \
!defined(DARWIN)
!defined(DARWIN) && !defined(HAIKU)
--> We only know how to find data segments of dynamic libraries for the
--> above. Additional SVR4 variants might not be too
--> hard to add.
@@ -396,7 +396,8 @@ GC_bool GC_register_main_static_data()
# if (defined(LINUX) || defined (__GLIBC__) || defined(NACL)) /* Are others OK here, too? */ \
&& (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
|| (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) \
|| defined(OPENBSD)
/* We have the header files for a glibc that includes dl_iterate_phdr. */
/* It may still not be available in the library on the target system. */
@@ -1258,6 +1259,23 @@ GC_bool GC_register_main_static_data()
#endif /* DARWIN */
#if defined(HAIKU)
#include <kernel/image.h>
void GC_register_dynamic_libraries()
{
image_info info;
int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK)
{
void *data = info.data;
GC_add_roots_inner(data, data + info.data_size, TRUE);
}
}
#endif /* HAIKU */
#else /* !DYNAMIC_LOADING */
#ifdef PCR
+12 -1
View File
@@ -93,7 +93,6 @@ GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
/* pointer to a previously allocated heap */
/* object. */
// Keep somewhat in sync with mono/metadata/profiler.h:enum MonoGCEvent
typedef enum {
GC_EVENT_START,
GC_EVENT_MARK_START,
@@ -836,6 +835,18 @@ typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
GC_API GC_PTR GC_call_with_alloc_lock
GC_PROTO((GC_fn_type fn, GC_PTR client_data));
/*
* These are similar to GC_do_blocking () in upstream bdwgc. The design is
* simpler in that there is no distinction between active and inactive stack
* frames; instead, while a thread is in blocking state, it promises to not
* interact with the GC at all, and to not keep any pointers to GC memory
* around from before entering blocking state. Additionally, these can be
* called unbalanced (they simply set a flag internally).
*/
GC_API void GC_start_blocking GC_PROTO((void));
GC_API void GC_end_blocking GC_PROTO((void));
/* The following routines are primarily intended for use with a */
/* preprocessor which inserts calls to check C pointer arithmetic. */
/* They indicate failure by invoking the corresponding _print_proc. */
+1 -1
View File
@@ -57,7 +57,7 @@
defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \
defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \
defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \
defined(GC_OPENBSD_THREADS) || \
defined(GC_OPENBSD_THREADS) || defined(GC_HAIKU_THREADS) ||\
(defined(GC_WIN32_THREADS) && defined(__CYGWIN32__))
# define GC_PTHREADS
# endif
+2
View File
@@ -1979,6 +1979,8 @@ void GC_err_puts GC_PROTO((GC_CONST char *s));
/* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */
# define SIG_SUSPEND SIGPWR
# endif
# elif defined(GC_OPENBSD_THREADS)
# define SIG_SUSPEND SIGXFSZ
# else /* !GC_LINUX_THREADS */
# if defined(_SIGRTMIN)
# define SIG_SUSPEND _SIGRTMIN + 6
+34 -3
View File
@@ -238,6 +238,16 @@
# define BEOS
# define mach_type_known
# endif
# if defined(__HAIKU__) && defined(_X86_)
# define I386
# define HAIKU
# define mach_type_known
# endif
# if defined(__HAIKU__) && defined(__amd64__)
# define X86_64
# define HAIKU
# define mach_type_known
# endif
# if defined(LINUX) && (defined(i386) || defined(__i386__))
# define I386
# define mach_type_known
@@ -733,7 +743,7 @@
# if defined(__GLIBC__)&& __GLIBC__>=2
# define SEARCH_FOR_DATA_START
# else /* !GLIBC2 */
# if defined(PLATFORM_ANDROID)
# if defined(HOST_ANDROID)
# define __environ environ
# endif
extern char **__environ;
@@ -1164,6 +1174,15 @@
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# endif
# ifdef HAIKU
# define OS_TYPE "HAIKU"
# include <OS.h>
# define GETPAGESIZE() B_PAGE_SIZE
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# define DYNAMIC_LOADING
# define MPROTECT_VDB
# endif
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int _etext[], _end[];
@@ -1965,7 +1984,7 @@
# include <features.h>
# if defined(__GLIBC__) && __GLIBC__ >= 2
# define SEARCH_FOR_DATA_START
# elif defined(PLATFORM_ANDROID)
# elif defined(HOST_ANDROID)
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;
@@ -2134,6 +2153,15 @@
/* There seems to be some issues with trylock hanging on darwin. This
should be looked into some more */
# endif
# ifdef HAIKU
# define OS_TYPE "HAIKU"
# include <OS.h>
# define GETPAGESIZE() B_PAGE_SIZE
extern int etext[];
# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff))
# define DYNAMIC_LOADING
# define MPROTECT_VDB
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# ifndef GC_FREEBSD_THREADS
@@ -2251,7 +2279,7 @@
# if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \
|| defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
|| defined(DGUX) || defined(BSD) || defined(SUNOS4) \
|| defined(_AIX) || defined(DARWIN) || defined(OSF1)
|| defined(_AIX) || defined(DARWIN) || defined(OSF1) || defined(HAIKU)
# define UNIX_LIKE /* Basic Unix-like system calls work. */
# endif
@@ -2507,6 +2535,9 @@
# if defined(SN_TARGET_PS3)
extern void *ps3_get_mem (size_t size);
# define GET_MEM(bytes) (struct hblk*) ps3_get_mem (bytes)
# elif defined(HAIKU)
ptr_t GC_haiku_get_mem(GC_word bytes);
# define GET_MEM(bytes) (struct hblk*)GC_haiku_get_mem(bytes)
# else
extern ptr_t GC_unix_get_mem(word size);
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
@@ -1,12 +0,0 @@
#ifndef GC_OPENBSD_STOP_WORLD_H
#define GC_OPENBSD_STOP_WORLD_H
#if !defined(GC_OPENBSD_THREADS)
#error openbsd_stop_world.h included without GC_OPENBSD_THREADS defined
#endif
struct thread_stop_info {
ptr_t stack_ptr; /* Valid only when stopped. */
};
#endif
+1 -3
View File
@@ -8,8 +8,6 @@
#if defined(GC_DARWIN_THREADS)
# include "private/darwin_stop_world.h"
#elif defined(GC_OPENBSD_THREADS)
# include "private/openbsd_stop_world.h"
#else
# include "private/pthread_stop_world.h"
#endif
@@ -45,7 +43,7 @@ typedef struct GC_Thread_Rep {
/* guaranteed to be dead, but we may */
/* not yet have registered the join.) */
pthread_t id;
#ifdef PLATFORM_ANDROID
#ifdef HOST_ANDROID
pid_t kernel_id;
#endif
/* Extra bookkeeping information the stopping code uses */
-161
View File
@@ -1,161 +0,0 @@
#include "private/pthread_support.h"
/* derived from pthread_stop_world.c */
# if defined(GC_OPENBSD_THREADS)
#define THREAD_EQUAL(id1, id2) pthread_equal(id1, id2)
/* We hold allocation lock. Should do exactly the right thing if the */
/* world is stopped. Should not fail if it isn't. */
void GC_push_all_stacks()
{
GC_bool found_me = FALSE;
size_t nthreads = 0;
int i;
GC_thread p;
ptr_t lo, hi;
pthread_t me = pthread_self();
if (!GC_thr_initialized) GC_thr_init();
# if DEBUG_THREADS
GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me);
# endif
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (p -> flags & FINISHED) continue;
++nthreads;
if (THREAD_EQUAL(p -> id, me)) {
# ifdef SPARC
lo = (ptr_t)GC_save_regs_in_stack();
# else
lo = GC_approx_sp();
# endif
found_me = TRUE;
} else {
lo = p -> stop_info.stack_ptr;
}
if ((p -> flags & MAIN_THREAD) == 0) {
hi = p -> stack_end;
} else {
/* The original stack. */
hi = GC_stackbottom;
}
# if DEBUG_THREADS
GC_printf("Stack for thread 0x%x = [%p,%p)\n",
(unsigned)(p -> id), lo, hi);
# endif
if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
# ifdef STACK_GROWS_UP
/* We got them backwards! */
GC_push_all_stack(hi, lo);
# else
GC_push_all_stack(lo, hi);
# endif
}
}
if (!found_me && !GC_in_thread_creation)
ABORT("Collecting from unknown thread.");
}
/* We hold the allocation lock. Suspend all threads that might */
/* still be running. */
void GC_suspend_all()
{
int i;
GC_thread p;
int result;
pthread_t my_thread = pthread_self();
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (!THREAD_EQUAL(p -> id, my_thread)) {
if (p -> flags & FINISHED) continue;
if (p -> thread_blocked) /* Will wait */ continue;
# if DEBUG_THREADS
GC_printf("Suspending thread 0x%x\n",
(unsigned)(p -> id));
# endif
if (pthread_suspend_np(p -> id) != 0)
ABORT("pthread_suspend_np failed");
/*
* This will only work for userland pthreads. It will
* fail badly on rthreads. Perhaps we should consider
* a pthread_sp_np() function that returns the stack
* pointer for a suspended thread and implement in
* both pthreads and rthreads.
*/
p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET);
}
}
}
}
void GC_stop_world()
{
int i;
GC_ASSERT(I_HOLD_LOCK());
# if DEBUG_THREADS
GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self());
# endif
/* Make sure all free list construction has stopped before we start. */
/* No new construction can start, since free list construction is */
/* required to acquire and release the GC lock before it starts, */
/* and we have the lock. */
# ifdef PARALLEL_MARK
GC_acquire_mark_lock();
GC_ASSERT(GC_fl_builder_count == 0);
/* We should have previously waited for it to become zero. */
# endif /* PARALLEL_MARK */
GC_suspend_all();
# ifdef PARALLEL_MARK
GC_release_mark_lock();
# endif
#if DEBUG_THREADS
GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self());
#endif
}
/* Caller holds allocation lock, and has held it continuously since */
/* the world stopped. */
void GC_start_world()
{
pthread_t my_thread = pthread_self();
register int i;
register GC_thread p;
register int result;
# if DEBUG_THREADS
GC_printf("World starting\n");
# endif
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (!THREAD_EQUAL(p -> id, my_thread)) {
if (p -> flags & FINISHED) continue;
if (p -> thread_blocked) continue;
#if DEBUG_THREADS
GC_printf("Resuming thread 0x%x\n",
(unsigned)(p -> id));
#endif
if (pthread_resume_np(p -> id) != 0)
ABORT("pthread_kill failed");
}
}
}
# if DEBUG_THREADS
GC_printf("World started\n");
# endif
}
void GC_stop_init() {
}
#endif
+31 -9
View File
@@ -609,7 +609,7 @@ void GC_enable_signals(void)
&& !defined(MACOS) && !defined(DJGPP) && !defined(DOS4GW) \
&& !defined(NOSYS) && !defined(ECOS) && !defined(SN_TARGET_PS3)
# if defined(sigmask) && !defined(UTS4) && !defined(HURD)
# if defined(sigmask) && !defined(UTS4) && !defined(HURD) && !defined(HAIKU)
/* Use the traditional BSD interface */
# define SIGSET_T int
# define SIG_DEL(set, signal) (set) &= ~(sigmask(signal))
@@ -764,14 +764,14 @@ ptr_t GC_get_stack_base()
# endif /* MS Windows */
# ifdef BEOS
# ifdef HAIKU
# include <kernel/OS.h>
ptr_t GC_get_stack_base(){
thread_info th;
get_thread_info(find_thread(NULL),&th);
return th.stack_end;
}
# endif /* BEOS */
# endif /* HAIKU */
# ifdef OS2
@@ -1122,7 +1122,7 @@ void *GC_set_stackbottom = NULL;
#endif /* FREEBSD_STACKBOTTOM */
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
#if !defined(HAIKU) && !defined(AMIGA) && !defined(MSWIN32) \
&& !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \
&& !defined(GC_OPENBSD_THREADS)
@@ -1182,7 +1182,7 @@ ptr_t GC_get_stack_base()
# endif /* STACKBOTTOM */
}
# endif /* ! AMIGA, !OS 2, ! MS Windows, !BEOS, !NOSYS, !ECOS */
# endif /* ! AMIGA, !OS 2, ! MS Windows, !HAIKU, !NOSYS, !ECOS */
#if defined(GC_OPENBSD_THREADS)
@@ -1957,6 +1957,19 @@ word bytes;
}
# endif
#if defined(HAIKU)
#include <stdlib.h>
ptr_t GC_haiku_get_mem(word bytes)
{
void* mem;
if (posix_memalign(&mem, GC_page_size, bytes) == 0)
return mem;
else
return NULL;
}
#endif
#ifdef USE_MUNMAP
/* For now, this only works on Win32/WinCE and some Unix-like */
@@ -2393,7 +2406,9 @@ GC_bool is_ptrfree;
# include <sys/mman.h>
# include <signal.h>
# include <sys/syscall.h>
# if !defined(HAIKU)
# include <sys/syscall.h>
# endif
# define PROTECT(addr, len) \
if (mprotect((caddr_t)(addr), (size_t)(len), \
@@ -2450,13 +2465,13 @@ GC_bool is_ptrfree;
#endif /* SUNOS4 || (FREEBSD && !SUNOS5SIGS) */
#if defined(SUNOS5SIGS) || defined(OSF1) || defined(LINUX) \
|| defined(HURD)
|| defined(HURD) || defined(HAIKU)
# ifdef __STDC__
typedef void (* SIG_PF)(int);
# else
typedef void (* SIG_PF)();
# endif
#endif /* SUNOS5SIGS || OSF1 || LINUX || HURD */
#endif /* SUNOS5SIGS || OSF1 || LINUX || HURD || HAIKU */
#if defined(MSWIN32)
typedef LPTOP_LEVEL_EXCEPTION_FILTER SIG_PF;
@@ -2634,6 +2649,13 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
/* architectures. */
# endif /* LINUX */
# if defined(HAIKU)
# include <errno.h>
# define CODE_OK TRUE
# define SIG_OK (sig == SIGSEGV)
void GC_write_failt_handler(int sig, siginfo_t *scp, void * context)
#endif /* HAIKU */
# if defined(SUNOS5SIGS)
# ifdef __STDC__
void GC_write_fault_handler(int sig, SIGINFO_T *scp, void * context)
@@ -2679,7 +2701,7 @@ SIG_PF GC_old_segv_handler; /* Also old MSWIN32 ACCESS_VIOLATION filter */
# if defined(OSF1) && defined(ALPHA)
char * addr = (char *) (scp -> sc_traparg_a0);
# endif
# ifdef SUNOS5SIGS
# if defined(SUNOS5SIGS) || defined(HAIKU)
char * addr = (char *) (scp -> si_addr);
# endif
# ifdef LINUX
+4 -5
View File
@@ -2,8 +2,7 @@
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
&& !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS) \
&& !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS) \
&& !defined(GC_OPENBSD_THREADS)
&& !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS)
#include <signal.h>
#include <semaphore.h>
@@ -337,7 +336,7 @@ void GC_push_all_stacks()
pthread_t GC_stopping_thread;
int GC_stopping_pid;
#ifdef PLATFORM_ANDROID
#ifdef HOST_ANDROID
static
int android_thread_kill(pid_t tid, int sig)
{
@@ -379,7 +378,7 @@ int GC_suspend_all()
GC_printf1("Sending suspend signal to 0x%lx\n", p -> id);
#endif
#ifndef PLATFORM_ANDROID
#ifndef HOST_ANDROID
result = pthread_kill(p -> id, SIG_SUSPEND);
#else
result = android_thread_kill(p -> kernel_id, SIG_SUSPEND);
@@ -658,7 +657,7 @@ static void pthread_start_world()
GC_printf1("Sending restart signal to 0x%lx\n", p -> id);
#endif
#ifndef PLATFORM_ANDROID
#ifndef HOST_ANDROID
result = pthread_kill(p -> id, SIG_THR_RESTART);
#else
result = android_thread_kill(p -> kernel_id, SIG_THR_RESTART);
+2 -4
View File
@@ -764,7 +764,7 @@ GC_thread GC_new_thread(pthread_t id)
}
if (result == 0) return(0);
result -> id = id;
#ifdef PLATFORM_ANDROID
#ifdef HOST_ANDROID
result -> kernel_id = gettid();
#endif
result -> next = GC_threads[hv];
@@ -1135,7 +1135,7 @@ void GC_thr_init()
# if defined(GC_HPUX_THREADS)
GC_nprocs = pthread_num_processors_np();
# endif
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS)
# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) || defined(GC_HAIKU_THREADS)
GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN);
if (GC_nprocs <= 0) GC_nprocs = 1;
# endif
@@ -1245,7 +1245,6 @@ void GC_start_blocking(void) {
GC_thread me;
LOCK();
me = GC_lookup_thread(pthread_self());
GC_ASSERT(!(me -> thread_blocked));
# ifdef SPARC
me -> stop_info.stack_ptr = (ptr_t)GC_save_regs_in_stack();
# else
@@ -1273,7 +1272,6 @@ void GC_end_blocking(void) {
GC_thread me;
LOCK(); /* This will block if the world is stopped. */
me = GC_lookup_thread(pthread_self());
GC_ASSERT(me -> thread_blocked);
me -> thread_blocked = FALSE;
UNLOCK();
}
+47 -1
View File
@@ -48,6 +48,7 @@ struct GC_thread_Rep {
/* 0 ==> entry not valid. */
/* !in_use ==> stack_base == 0 */
GC_bool suspended;
GC_bool thread_blocked;
# ifdef CYGWIN32
void *status; /* hold exit value until join in case it's a pointer */
@@ -174,6 +175,7 @@ static GC_thread GC_new_thread(void) {
/* the world, wait here. Hopefully this can't happen on any */
/* systems that don't allow us to block here. */
while (GC_please_stop) Sleep(20);
GC_ASSERT(!thread_table[i]->thread_blocked);
return thread_table + i;
}
@@ -223,7 +225,6 @@ static void GC_delete_thread(DWORD thread_id) {
}
}
#ifdef CYGWIN32
/* Return a GC_thread corresponding to a given pthread_t. */
@@ -245,6 +246,20 @@ static GC_thread GC_lookup_thread(pthread_t id)
return thread_table + i;
}
#else
static GC_thread GC_lookup_thread(DWORD id)
{
int i;
LONG max = GC_get_max_thread_index();
for (i = 0; i <= max; i++)
if (thread_table[i].in_use && thread_table[i].id == id)
return &thread_table[i];
return NULL;
}
#endif /* CYGWIN32 */
void GC_push_thread_structures GC_PROTO((void))
@@ -264,6 +279,35 @@ void GC_push_thread_structures GC_PROTO((void))
# endif
}
/* Wrappers for functions that are likely to block for an appreciable */
/* length of time. Must be called in pairs, if at all. */
/* Nothing much beyond the system call itself should be executed */
/* between these. */
void GC_start_blocking(void) {
GC_thread me;
LOCK();
#ifdef CYGWIN32
me = GC_lookup_thread(pthread_self());
#else
me = GC_lookup_thread(GetCurrentThreadId());
#endif
me->thread_blocked = TRUE;
UNLOCK();
}
void GC_end_blocking(void) {
GC_thread me;
LOCK(); /* This will block if the world is stopped. */
#ifdef CYGWIN32
me = GC_lookup_thread(pthread_self());
#else
me = GC_lookup_thread(GetCurrentThreadId());
#endif
me->thread_blocked = FALSE;
UNLOCK();
}
/* Defined in misc.c */
extern CRITICAL_SECTION GC_write_cs;
@@ -281,6 +325,8 @@ void GC_stop_world()
for (i = 0; i <= GC_get_max_thread_index(); i++)
if (thread_table[i].stack_base != 0
&& thread_table[i].id != thread_id) {
if (thread_table [i].thread_blocked)
continue;
# ifdef MSWINCE
/* SuspendThread will fail if thread is running kernel code */
while (SuspendThread(thread_table[i].handle) == (DWORD)-1)
+1
View File
@@ -1,2 +1,3 @@
/Makefile
/Makefile.in
/llvm_config.mk
+42 -22
View File
@@ -1,30 +1,50 @@
#
# Conditional submodule for llvm
#
# make reset-llvm will checkout a version of llvm which is suitable for this version of mono
# into $top_srcdir/llvm/llvm.
#
LLVM_PATH=llvm
EXTRA_DIST=SUBMODULES.json build.mk build_llvm_config.sh
SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
include $(top_srcdir)/scripts/submodules/versions.mk
if ENABLE_LLVM
$(eval $(call ValidateVersionTemplate,llvm,LLVM))
if HOST_WIN32
llvm_config=llvm-config.exe
else
llvm_config=llvm-config
endif
# Bump the given submodule to the revision given by the REV make variable
# If COMMIT is 1, commit the change
bump-llvm: __bump-version-llvm
if HAVE_ZLIB
llvm_extra_libs=-lz
else
llvm_extra_libs=
endif
# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
# If COMMIT is 1, commit the change
bump-branch-llvm: __bump-branch-llvm
if INTERNAL_LLVM
# Bump the given submodule to its current GIT version
# If COMMIT is 1, commit the change
bump-current-llvm: __bump-current-version-llvm
all-local: configure-llvm build-llvm install-llvm llvm_config.mk
clean-local:
$(RM) -r $(LLVM_PATH)
clean-local: clean-llvm clean-llvm-config
EXTRA_DIST=SUBMODULES.json
$(mono_build_root)/llvm/llvm_config.mk: install-llvm
$(top_srcdir)/llvm/build_llvm_config.sh "$(top_srcdir)/llvm/usr/bin/$(llvm_config)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@
else
all-local: llvm_config.mk
clean-local: clean-llvm-config
$(mono_build_root)/llvm/llvm_config.mk: $(top_srcdir)/llvm/Makefile.am
$(top_srcdir)/llvm/build_llvm_config.sh "$(EXTERNAL_LLVM_CONFIG)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@
endif
llvm_config.mk: $(mono_build_root)/llvm/llvm_config.mk
clean-llvm-config:
- rm -rf llvm_config.mk
else
all-local:
clean-local:
endif
# Override this so we don't try to re-copy llvm when we install mono
install:
include build.mk
+3 -3
View File
@@ -2,9 +2,9 @@
{
"name": "llvm",
"url": "git://github.com/mono/llvm.git",
"rev": "9f79399f87282524fee099b328bd8cbf07929daf",
"remote-branch": "origin/master",
"branch": "master",
"rev": "c97510286a58f9aaa116fcfdb8b693d5f61910d2",
"remote-branch": "origin/release_60",
"branch": "release_60",
"directory": "llvm"
}
]
+83
View File
@@ -0,0 +1,83 @@
#
# Conditional submodule for llvm
#
# make reset-llvm will checkout a version of llvm which is suitable for this version of mono
# into $top_srcdir/llvm/llvm.
#
top_srcdir ?= $(abspath $(CURDIR)/..)
LLVM_PATH ?= $(abspath $(top_srcdir)/external/llvm)
LLVM_BUILD ?= $(abspath $(top_srcdir)/llvm/build)
LLVM_PREFIX ?= $(abspath $(top_srcdir)/llvm/usr)
# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(NEEDED_LLVM_BRANCH)/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz
LLVM_DOWNLOAD_LOCATION = "http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz"
CMAKE := $(or $(CMAKE),$(shell which cmake))
NINJA := $(shell which ninja)
SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
include $(top_srcdir)/scripts/submodules/versions.mk
$(eval $(call ValidateVersionTemplate,llvm,LLVM))
# Bump the given submodule to the revision given by the REV make variable
# If COMMIT is 1, commit the change
bump-llvm: __bump-version-llvm
# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
# If COMMIT is 1, commit the change
bump-branch-llvm: __bump-branch-llvm
# Bump the given submodule to its current GIT version
# If COMMIT is 1, commit the change
bump-current-llvm: __bump-current-version-llvm
$(LLVM_BUILD) $(LLVM_PREFIX):
mkdir -p $@
$(LLVM_PATH):
$(MAKE) -f build.mk reset-llvm
$(LLVM_PATH)/CMakeLists.txt: | $(LLVM_PATH)
# -DLLVM_ENABLE_LIBXML2=Off is needed because xml2 is not used and it breaks 32-bit builds on 64-bit Linux hosts
$(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(LLVM_PATH)/CMakeLists.txt | $(LLVM_BUILD)
cd $(LLVM_BUILD) && $(CMAKE) \
$(if $(NINJA),-G Ninja) \
-DCMAKE_INSTALL_PREFIX="$(LLVM_PREFIX)" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_TESTS=Off \
-DLLVM_INCLUDE_TESTS=Off \
-DLLVM_BUILD_EXAMPLES=Off \
-DLLVM_INCLUDE_EXAMPLES=Off \
-DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
-DLLVM_ENABLE_ASSERTIONS=$(if $(INTERNAL_LLVM_ASSERTS),On,Off) \
-DLLVM_ENABLE_LIBXML2=Off \
-DHAVE_FUTIMENS=0 \
$(LLVM_CMAKE_ARGS) \
$(dir $<)
.PHONY: configure-llvm
configure-llvm: $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile)
# The DESTDIR fix is to prevent the build from trying to install this out-of-build-tree
# as the DESTDIR hasn't been created when we're building mono
.PHONY: build-llvm
build-llvm: configure-llvm
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD)
.PHONY: install-llvm
install-llvm: build-llvm | $(LLVM_PREFIX)
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install
.PHONY: download-llvm
download-llvm:
(wget --no-verbose -O - $(LLVM_DOWNLOAD_LOCATION) || curl -L $(LLVM_DOWNLOAD_LOCATION)) | tar -xzf - -C $(dir $(LLVM_PREFIX))
.PHONY: clean-llvm
clean-llvm:
$(RM) -r $(LLVM_BUILD) $(LLVM_PREFIX)
+172
View File
@@ -0,0 +1,172 @@
#!/bin/bash
llvm_config=$1
llvm_codegen_libs="$2"
llvm_extra_libs="${@:3}"
use_llvm_config=1
llvm_host_win32=0
llvm_host_win32_wsl=0
llvm_host_win32_cygwin=0
function win32_format_path {
local formatted_path=$1
if [[ $llvm_host_win32_wsl = 1 ]] && [[ $1 != "/mnt/"* ]]; then
# if path is not starting with /mnt under WSL it could be a windows path, convert using wslpath.
formatted_path="$(wslpath -a "$1")"
elif [[ $llvm_host_win32_cygwin = 1 ]] && [[ $1 != "/cygdrive/"* ]]; then
# if path is not starting with /cygdrive under CygWin it could be a windows path, convert using cygpath.
formatted_path="$(cygpath -a "$1")"
fi
echo "$formatted_path"
}
if [[ $llvm_config = *".exe" ]]; then
llvm_host_win32=1
# llvm-config is a windows binary. Check if we are running CygWin or WSL since then we might still be able to run llvm-config.exe
host_uname="$(uname -a)"
case "$host_uname" in
*Microsoft*)
use_llvm_config=1
llvm_host_win32_wsl=1
;;
CYGWIN*)
use_llvm_config=1
llvm_host_win32_cygwin=1
;;
*)
use_llvm_config=0
esac
fi
if [[ $llvm_host_win32 = 1 ]]; then
llvm_config=$(win32_format_path "$llvm_config")
fi
if [[ $use_llvm_config = 1 ]]; then
llvm_api_version=`$llvm_config --mono-api-version` || "0"
with_llvm=`$llvm_config --prefix`
llvm_config_cflags=`$llvm_config --cflags`
llvm_system=`$llvm_config --system-libs`
llvm_core_components=`$llvm_config --libs analysis core bitwriter`
if [[ $llvm_api_version -lt 600 ]]; then
llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null`
else
llvm_old_jit=`$llvm_config --libs mcjit 2>>/dev/null`
fi
llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null`
if [[ ! -z $llvm_codegen_libs ]]; then
llvm_extra=`$llvm_config --libs $llvm_codegen_libs`
fi
# When building for Windows subsystem using WSL or CygWin the path returned from llvm-config.exe
# could be a Windows style path, make sure to format it into a path usable for WSL/CygWin.
if [[ $llvm_host_win32 = 1 ]]; then
with_llvm=$(win32_format_path "$with_llvm")
fi
fi
# When cross compiling for Windows on system not capable of running Windows binaries, llvm-config.exe can't be used to query for
# LLVM parameters. In that scenario we will need to fallback to default values.
if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then
# Assume we have llvm-config sitting in llvm-install-root/bin directory, get llvm-install-root directory.
with_llvm="$(dirname $llvm_config)"
with_llvm="$(dirname $with_llvm)"
llvm_config_path=$with_llvm/include/llvm/Config/llvm-config.h
# llvm-config.exe --mono-api-version
llvm_api_version=`awk '/MONO_API_VERSION/ { print $3 }' $llvm_config_path`
# llvm-config.exe --cflags, returned information currently not used.
llvm_config_cflags=
# llvm-config.exe --system-libs
if [[ $llvm_api_version -lt 600 ]]; then
llvm_system="-limagehlp -lpsapi -lshell32"
else
llvm_system="-lpsapi -lshell32 -lole32 -luuid -ladvapi32"
fi
# llvm-config.exe --libs analysis core bitwriter
if [[ $llvm_api_version -lt 600 ]]; then
llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport"
else
llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
fi
# llvm-config.exe --libs mcjit jit
if [[ $llvm_api_version -lt 600 ]]; then
llvm_old_jit="-lLLVMJIT -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport"
else
# Current build of LLVM 60 for cross Windows builds doesn't support LLVM JIT.
llvm_old_jit=
fi
# LLVM 36 doesn't support new JIT and LLVM 60 is build without LLVM JIT support for cross Windows builds.
llvm_new_jit=
# Check codegen libs and add needed libraries.
case "$llvm_codegen_libs" in
*x86codegen*)
# llvm-config.exe --libs x86codegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMObject -lLLVMBitReader -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport"
else
llvm_extra="-lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
fi
;;
*armcodegen*)
# llvm-config.exe --libs armcodegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMARMCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMMC -lLLVMSupport"
else
llvm_extra="-lLLVMARMCodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMMC -lLLVMSupport -lLLVMDemangle"
fi
;;
*aarch64codegen*)
# llvm-config.exe --libs aarch64codegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport"
else
llvm_extra="-lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lLLVMDemangle"
fi
;;
*)
llvm_extra=$llvm_codegen_libs
esac
fi
if [[ $llvm_config_cflags = *"stdlib=libc++"* ]]; then
llvm_libc_c="-stdlib=libc++"
llvm_libc_link="-lc++"
else
llvm_libc_c=""
llvm_libc_link="-lstdc++"
fi
if [[ $llvm_host_win32 = 1 ]]; then
host_cxxflag_additions="-std=gnu++11"
host_cflag_additions="-DNDEBUG"
else
host_cxxflag_additions="-std=c++11"
host_cflag_additions=""
fi
if [[ ! -z $llvm_extra_libs ]]; then
llvm_extra="$llvm_extra $llvm_extra_libs"
fi
# llvm-config --clfags adds warning and optimization flags we don't want
cflags_additions="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=$llvm_api_version $llvm_libc_c $host_cflag_additions"
cxxflag_additions="-fno-rtti -fexceptions $host_cxxflag_additions"
ldflags="-L$with_llvm/lib"
llvm_lib_components="$llvm_core_components $llvm_old_jit $llvm_new_jit $llvm_extra"
echo "LLVM_CFLAGS_INTERNAL=$cflags_additions"
echo "LLVM_CXXFLAGS_INTERNAL=$cflags_additions $cxxflag_additions"
echo "LLVM_LDFLAGS_INTERNAL=$ldflags"
echo "LLVM_LIBS_INTERNAL=$llvm_lib_components $ldflags $llvm_system $llvm_libc_link"
+1 -1
View File
@@ -1 +1 @@
EXTRA_DIST = iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 $(wildcard *.m4)
EXTRA_DIST = lib-ld.m4 lib-link.m4 lib-prefix.m4 $(wildcard *.m4)
+74
View File
@@ -0,0 +1,74 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
# Check whether the given FLAG works with the current language's compiler
# or gives an error. (Warnings, however, are ignored)
#
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
# If EXTRA-FLAGS is defined, it is added to the current language's default
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <[email protected]>
# Copyright (c) 2011 Maarten Bosmans <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 5
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.63)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
-214
View File
@@ -1,214 +0,0 @@
# iconv.m4 serial 11 (gettext-0.18.1)
dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl From Bruno Haible.
AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
[
dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
AC_REQUIRE([AC_LIB_RPATH])
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_LIB_LINKFLAGS_BODY([iconv])
])
AC_DEFUN([AM_ICONV_LINK],
[
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
dnl those with the standalone portable GNU libiconv installed).
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
dnl accordingly.
AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
dnl Add $INCICONV to CPPFLAGS before performing the following checks,
dnl because if the user has installed libiconv and not disabled its use
dnl via --without-libiconv-prefix, he wants to use it. The first
dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
am_save_CPPFLAGS="$CPPFLAGS"
AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
am_cv_func_iconv="no, consider installing GNU libiconv"
am_cv_lib_iconv=no
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
[am_cv_func_iconv=yes])
if test "$am_cv_func_iconv" != yes; then
am_save_LIBS="$LIBS"
LIBS="$LIBS $LIBICONV"
AC_TRY_LINK([#include <stdlib.h>
#include <iconv.h>],
[iconv_t cd = iconv_open("","");
iconv(cd,NULL,NULL,NULL,NULL);
iconv_close(cd);],
[am_cv_lib_iconv=yes]
[am_cv_func_iconv=yes])
LIBS="$am_save_LIBS"
fi
])
if test "$am_cv_func_iconv" = yes; then
AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
am_save_LIBS="$LIBS"
if test $am_cv_lib_iconv = yes; then
LIBS="$LIBS $LIBICONV"
fi
AC_TRY_RUN([
#include <iconv.h>
#include <string.h>
int main ()
{
/* Test against AIX 5.1 bug: Failures are not distinguishable from successful
returns. */
{
iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
if (cd_utf8_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\342\202\254"; /* EURO SIGN */
char buf[10];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_utf8_to_88591,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
}
}
/* Test against Solaris 10 bug: Failures are not distinguishable from
successful returns. */
{
iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
if (cd_ascii_to_88591 != (iconv_t)(-1))
{
static const char input[] = "\263";
char buf[10];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_ascii_to_88591,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if (res == 0)
return 1;
}
}
#if 0 /* This bug could be worked around by the caller. */
/* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
{
iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
if (cd_88591_to_utf8 != (iconv_t)(-1))
{
static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
char buf[50];
const char *inptr = input;
size_t inbytesleft = strlen (input);
char *outptr = buf;
size_t outbytesleft = sizeof (buf);
size_t res = iconv (cd_88591_to_utf8,
(char **) &inptr, &inbytesleft,
&outptr, &outbytesleft);
if ((int)res > 0)
return 1;
}
}
#endif
/* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
provided. */
if (/* Try standardized names. */
iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
/* Try IRIX, OSF/1 names. */
&& iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
/* Try AIX names. */
&& iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
/* Try HP-UX names. */
&& iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
return 1;
return 0;
}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
[case "$host_os" in
aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
*) am_cv_func_iconv_works="guessing yes" ;;
esac])
LIBS="$am_save_LIBS"
])
case "$am_cv_func_iconv_works" in
*no) am_func_iconv=no am_cv_lib_iconv=no ;;
*) am_func_iconv=yes ;;
esac
else
am_func_iconv=no am_cv_lib_iconv=no
fi
if test "$am_func_iconv" = yes; then
AC_DEFINE([HAVE_ICONV], [1],
[Define if you have the iconv() function and it works.])
fi
if test "$am_cv_lib_iconv" = yes; then
AC_MSG_CHECKING([how to link with libiconv])
AC_MSG_RESULT([$LIBICONV])
else
dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
dnl either.
CPPFLAGS="$am_save_CPPFLAGS"
LIBICONV=
LTLIBICONV=
fi
AC_SUBST([LIBICONV])
AC_SUBST([LTLIBICONV])
])
dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
dnl avoid warnings like
dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
dnl This is tricky because of the way 'aclocal' is implemented:
dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
dnl Otherwise aclocal's initial scan pass would miss the macro definition.
dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
dnl warnings.
m4_define([gl_iconv_AC_DEFUN],
m4_version_prereq([2.64],
[[AC_DEFUN_ONCE(
[$1], [$2])]],
[[AC_DEFUN(
[$1], [$2])]]))
gl_iconv_AC_DEFUN([AM_ICONV],
[
AM_ICONV_LINK
if test "$am_cv_func_iconv" = yes; then
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL([am_cv_proto_iconv], [
AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([
$am_cv_proto_iconv])
AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
[Define as const if the declaration of iconv() needs const.])
fi
])
+3 -1
View File
@@ -13,6 +13,7 @@ man_MANS = \
genxs.1 \
httpcfg.1 \
ilasm.1 \
illinkanalyzer.1 \
lc.1 \
macpack.1 \
makecert.1 \
@@ -58,6 +59,7 @@ man_MANS = \
mono-configuration-crypto.1 \
ccrewrite.1 \
cccheck.1 \
mono-symbolicate.1
mono-symbolicate.1 \
mono-profilers.1
EXTRA_DIST = $(man_MANS)
+132
View File
@@ -0,0 +1,132 @@
.TH illinkanalyzer 1
.SH NAME
illinkanalyzer \- Mono's linker analyzer tool
.SH SYNOPSIS
.B illinkanalyzer
\fR[\fIoptions\fR] <\fIlinker-dependency-file.xml.gz\fR>
.SH DESCRIPTION
Linker analyzer is a command line tool to analyze dependencies, which
were recorded during linker processing, and led linker to mark an item
to keep it in the resulting linked assembly.
.PP
It works on an oriented graph of dependencies, which are collected and
dumped during the linker run. The vertices of this graph are the items
of interest like assemblies, types, methods, fields, linker steps,
etc. The edges represent the dependencies.
.SH HOW TO DUMP DEPENDENCIES
The linker analyzer needs a linker dependencies file as an input. It
can be retrieved by enabling dependencies dumping during linking of a
Xamarin.Android or a Xamarin.iOS project.
.PP
That can be done on the command line by setting LinkerDumpDependencies
property to true and building the project. (make sure the
LinkAssemblies task is called, it might require cleaning the project
sometimes) Usually it is enough to build the project like this:
.PP
.nf
.RS
rm -f obj/Release/link.flag
msbuild /p:LinkerDumpDependencies=true /p:Configuration=Release YourAppProject.csproj
.RE
.fi
.PP
After a successful build, there will be a linker-dependencies.xml.gz
file created, containing the information for the analyzer.
.SH OPTIONS
.nf
.RS
-a, --alldeps show all dependencies
--csvoutput=VALUE outputs types and optionally size analysis to CSV
file
-h, --help show this message and exit.
-l, --linkedpath=VALUE sets the linked assemblies directory path. Enables
displaying size estimates.
-r, --rawdeps=VALUE show raw vertex dependencies. Raw vertex VALUE is
in the raw format written by linker to the
dependency XML file. VALUE can be regular
expression
--roots show root dependencies.
--stat show statistic of loaded dependencies.
--tree reduce the dependency graph to the tree.
--types show all types dependencies.
-t, --typedeps=VALUE show type dependencies. The VALUE can be regular
expression
-f, --flat show all dependencies per vertex and their distance
-v, --verbose be more verbose. Enables stat and roots options.
.RE
.fi
.SH EXAMPLES
Let say you would like to know, why a type, Android.App.Activity for
example, was marked by the linker. So run the analyzer like this:
.PP
.nf
.RS
illinkanalyzer -t Android.App.Activity linker-dependencies.xml.gz
.fi
.RE
.PP
Output:
.PP
.nf
.RS
Loading dependency tree from: linker-dependencies.xml.gz
--- Type dependencies: 'Android.App.Activity' -----------------------
--- TypeDef:Android.App.Activity dependencies -----------------------
Dependency #1
TypeDef:Android.App.Activity
| TypeDef:XA.App.MainActivity [2 deps]
| Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [3 deps]
| Other:Mono.Linker.Steps.ResolveFromAssemblyStep
.fi
.RE
.PP
The output contains dependencies string(s), starting with the type and
continuing with the item of interest, which depends on the type. The
dependency could be result of multiple reasons. For example the type
was referenced from a method, or the type was listed in the linker xml
file to be protected.
.PP
In our example there is only one dependency string called Dependency
#1. It shows us that the type Android.App.Activity was marked during
processing of type XA.App.MainActivity by the linker. In this case
because the MainActivity type is based on the Activity type and thus
the linker marked it and kept it in the linked assembly. We can also
see that there are 2 dependencies for the MainActivity class. Note
that in the string (above) we see only 1st dependency of the 2, the
dependency on the assembly XA.App. And finally the assembly vertex
depends on the ResolveFromAssemblyStep vertex. So we see that the
assembly was processed in the ResolveFromAssembly linker step.
.PP
Now we might want to see the MainActivity dependencies. That could be done by the following analyzer run:
.PP
.nf
.RS
illinkanalyzer -r TypeDef:XA.App.MainActivity linker-dependencies.xml.gz
.fi
.RE
.PP
Output:
.PP
.nf
.RS
Loading dependency tree from: linker-dependencies.xml.gz
--- Raw dependencies: 'TypeDef:XA.App.MainActivity' -----------------
--- TypeDef:XA.App.MainActivity dependencies ------------------------
Dependency #1
TypeDef:XA.App.MainActivity
| Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [3 deps]
| Other:Mono.Linker.Steps.ResolveFromAssemblyStep
Dependency #2
TypeDef:XA.App.MainActivity
| TypeDef:XA.App.MainActivity/<>c__DisplayClass1_0 [2 deps]
| TypeDef:XA.App.MainActivity [2 deps]
| Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [3 deps]
| Other:Mono.Linker.Steps.ResolveFromAssemblyStep
.fi
.RE
.SH SEE ALSO
\fBmsbuild\fR(1)
+12 -11
View File
@@ -4,26 +4,27 @@
..
.TH mcs 1 "6 January 2001"
.SH NAME
mcs \- Mono C# Compiler
mcs \- Turbo C# Compiler
.SH SYNOPSIS
.B mcs
[option] [source-files]
.SH DESCRIPTION
mcs is the Mono C# compiler, an implementation of the ECMA-334
language specification. You can pass one or more options to drive the
compiler, and a set of source files. Extra options or arguments can
be provided in a response file. Response files are referenced by
prepending the @ symbol to the response file name.
mcs is the Turbo C# compiler (also known as the Mono C# compiler), it
is an implementation of the ECMA-334 language specification. You can
pass one or more options to drive the compiler, and a set of source
files. Extra options or arguments can be provided in a response file.
Response files are referenced by prepending the @ symbol to the
response file name.
.PP
The
.I mcs
compiler is used to compile against the latest Mono Base Class Library
version and fully implements C# 1.0, 2.0, 3.0, 4.0, 5.0 and 6.0
specifications.
specifications with partial support for C# 7.0.
.PP
See the section on packages for more information.
.PP
The Mono C# compiler accepts the same command line options that the
The Turbo C# compiler accepts the same command line options that the
Microsoft C# compiler does. Those options can start with a slash or a
dash (/checked is the same as -checked). Additionally some GNU-like
options are supported, those begin with "--". All MCS-specific flags
@@ -37,13 +38,13 @@ for partial compilation. To achieve the benefits of partial
compilation, you should compile programs into their own assemblies,
and later reference them with the "-r" flag.
.PP
The Mono C# compiler generates images (.exe files) that contain CIL
The Turbo C# compiler generates images (.exe files) that contain CIL
byte code that can be executed by any system that implements a Common
Language Infrastructure virtual machine such as the Microsoft .NET
runtime engine on Windows or the Mono runtime engine on Unix systems.
Executables are not bound to a specific CPU or operating system.
.PP
The Mono C# compiler by default only references three assemblies:
The Turbo C# compiler by default only references three assemblies:
mscorlib.dll, System.dll and System.Xml.dll. If you want to
reference extra libraries you must manually specify them using the
-pkg: command line option or the -r: command line option.
@@ -53,7 +54,7 @@ use the -pkg:dotnet command line option.
.SH OPTIONS
.TP
.I \-\-about
Displays information about the Mono C# compiler
Displays information about the Turbo C# compiler
.TP
.I \-\-addmodule:MODULE1[,MODULE2]
Includes the specified modules in the resulting assembly. Modules are
+147 -18
View File
@@ -111,10 +111,11 @@ directory.
.SH OPTIONS
.TP
.I "--config FILE"
Specifies that a machine.config file must be bundled as well.
Typically this is $prefix/etc/mono/1.0/machine.config or
$prefix/etc/mono/2.0/machine.config depending on the profile that you
are using (1.0 or 2.0)
Specifies that a DLLMAP Mono config file must be bundled as well. In
the simple and cross compiler modes, if no config file is specified
the one for the current target is picked (either the system one in the
case of the simple mode, or the one that came from the cross
compilation target for the cross compiling mode).
.TP
.I "--config-dir DIR"
When passed, DIR will be set for the MONO_CFG_DIR environment variable
@@ -177,7 +178,9 @@ same as for the compiler -lib: or -L flags.
Embeds the dynamic library file pointed to by `PATH' and optionally
give it the name `LIB' into the bundled executable. This is used to
ship native library dependencies that are unpacked at startup and
loaded from the runtime.
loaded from the runtime. Multiple libraries should be specified in
dependency order, where later ones on the command line depend on
earlier ones.
.TP
.I "--lists-targets"
Lists all of the available local cross compilation targets available
@@ -186,15 +189,45 @@ as precompiled binaries on the Mono distribution server.
.I "--local-targets"
Lists all of the available local cross compilation targets.
.TP
.I "--cil-strip PATH"
Provides a CIL stripper that mkbundle will use if able to.
The intended use is to help reduce file size on AOT.
.TP
.I "--in-tree path/to/mono/source/root"
Provides mkbundle with a mono source repository from which to pull the necessary headers for compilation.
This allows mkbundle to run out of the project's source tree, useful for working with multiple runtimes and for
testing without installing.
.TP
.I "--managed-linker PATH"
Provides mkbundle access to a managed linker to preprocess the assemblies.
.TP
.I "--machine-config FILE"
Uses the given FILE as the machine.config file for the generated
application.
application. The machine config contains an XML file that is used by
System.Configuration APIs to configure the .NET stack. Typically this
is
.I $prefix/etc/mono/4.5/machine.config.
.Sp
If you want to disable this automatic bundling, you can use the
.I "--no-machine-config"
flag. In the simple and cross compiler modes, if no machine.config file is specified
the one for the current target is picked (either the system one in the
case of the simple mode, or the one that came from the cross
compilation target for the cross compiling mode).
.TP
.I "--no-config"
In simple or cross compiling mode, this prevents mkbundle from
automatically bundling a config file.
.TP
.I "--nodeps"
This is the default: \fImkbundle\fP will only include the assemblies that
were specified on the command line to reduce the size of the resulting
image created.
.TP
.I "--no-machine-config"
In simple or cross compiling mode, this prevents mkbundle from
automatically bundling a machine.config file.
.TP
.I "-o filename"
Places the output on `out'. If the flag -c is specified, this is the
C host program. If not, this contains the resulting executable.
@@ -238,6 +271,36 @@ This flag is mutually exlusive with
By default the mkbundle tool will download from a Mono server the
target runtimes, you can specify a different server to provide
cross-compiled runtimes.
.TP
.I "--mono-api-struct-path FILE"
FILE points to a file with the definition of the \fIBundleMonoAPI\fP structure which contains the
required pointers to various Mono API functions used throughout the generated code. This mechanism
is meant to be used by third parties which embed the Mono runtime and dynamically load and initialize
it as part of the application startup, in which case the Mono APIs will not be available for the shared
library loader and the bundle will fail to work (one example of such an embedding third party is
Xamarin.Android).
After providing the definition FILE, the embedder must call the \fIvoid initialize_mono_api (const BundleMonoAPI *info)\fP
function found in the generated code
.B before
calling \fIvoid mono_mkbundle_init ()\fP. The structure passed to \fIinitialize_mono_api\fP doesn't need
to be dynamically allocated as its contents is copied to the local structure in the generated code and no
pointer to the passed structure is retained or used after \fIinitialize_mono_api\fP returns.
The list of pointers is not documented here. Instead, please look at the \fIbundle-mono-api.inc\fP file
found in the mkbundle source directory in your Mono source tree (\fImcs/tools/mkbundle\fP) or in the Mono's
GitHub repository, https://github.com/mono/mono/blob/master/mcs/tools/mkbundle/bundle-mono-api.inc
Please note that your structure must match the one expected by your version of the Mono runtime.
The file must also define the \fImkbundle_log_error\fP function with the following signature:
.nf
static void mkbundle_log_error (const char *format, ...) {}
.fi
The function should implement logging API specific to the embedder.
.SH OLD EMBEDDING
.PP
The old embedding system compiles a small C stub that embeds the
@@ -306,34 +369,100 @@ causes it to statically link instead.
Compresses the assemblies before embedding. This results in smaller
executable files, but increases startup time and requires zlib to be
installed on the target system.
.SH AOT Options
These options support an mkbundle using AOT compilation with static linking. A native compiler
toolchain is required.
.TP
.I "--aot-runtime PATH"
Provide the path to the mono runtime to use for AOTing assemblies.
.TP
.I "--aot-dedup"
(Experimental) Deduplicate AOT'ed methods based on a unique mangling of method names.
.TP
.I "--aot-mode MODE"
MODE can be either "full" or "llvmonly" at this time.
Currently, mkbundle supports three AOT modes. The default mode (this option unset)
will AOT methods but will fall back on runtime codegen where it is much faster or offers
a more full compatibility profile. The "full" setting will generate the necessary stubs to
not require runtime code generation. The "llvmonly" setting does the same, but forces all codegen
to go through the llvm backend.
.SH WINDOWS
If you are using the old embedding on Windows systems, it it necessary
to have Unix-like toolchain to be installed for \fImkbundle\fP to
work. You can use cygwin's and install gcc, gcc-mingw and as
packages.
If you are using the old embedding on Windows systems, it possible to use
a Unix-like toolchain like cygwin's and install gcc, gcc-mingw packages or
use Visual Studio 2015/2017 VC toolchain together with Clang for Visual Studio as assembler.
Clang can be installed as an individual component, "Clang/C2", using Visual Studio installer.
.PP
Using Visual Studio toolchain, mkbundle will, by default, use latest installed Visual Studio compiler
and linker as well as Windows SDK. If executed from one of the Visual Studio developer command prompts,
mkbundle will retrieve information directly from that build environment.
.SH ENVIRONMENT VARIABLES
.TP
.I "AS"
Assembler command. The default is "as".
Assembler command. The default is "as". For Visual Studio, default is "clang.exe".
If "clang.exe" for Visual Studio is not installed, mkbundle will fall back using "as".
.TP
.I "CC"
C compiler command. The default is "cc" under Linux and "gcc"
under Windows.
C compiler command. The default is "cc" for Linux, "gcc"
for cygwin and "cl.exe" for Visual Studio.
.TP
.I "MONO_BUNDLED_OPTIONS"
Options to be passed to the bundled
Mono runtime, separated by spaces. See the mono(1) manual page or run mono --help.
.SH WINDOWS VISUAL STUDIO ENVIRONMENT VARIABLES
.TP
.I "VisualStudioVersion"
Visual Studio version used in mkbundle build.
Default, latest installed Visual Studio version.
Values, "14.0" for Visual Studio 2015 or "15.0" for Visual Studio 2017.
.TP
.I "WindowsSdkVersion"
Windows SDK version used in mkbundle build.
Default/unknown, latest installed Windows SDK.
Values, "8.1", "10.0.10240.0", "10.0.15063.0" etc.
.TP
.I "VSCMD_ARG_TGT_ARCH"
Output target architecture used in mkbundle build.
Default/unknown, use architecture of .NET runtime executing mkbundle.
Values, "x86" or "x64".
NOTE, when running from a Visual Studio command prompt, this variable should already be set
by the command prompt and match the rest of that build environment.
.TP
.I "INCLUDE"
Override all custom include paths passed to "cl.exe".
Predefined by Visual Studio developer command prompt or auto detected by mkbundle when undefined.
.TP
.I "LIB"
Override all custom library paths passed to "link.exe".
Predefined by Visual Studio developer command prompt or auto detected by mkbundle when undefined.
.TP
.I "MONOPREFIX"
Use a custom Mono SDK install root matching the output target architecture (x86/x64).
Default, mkbundle will look for installed Mono SDK’s matching targeted architecture.
.TP
.I "MONOLIB"
Use a different mono library name or an absolute path to the mono library passed to linker.
Default, mkbundle will use default mono library name depending on mkbundle dynamic/static use case.
NOTE, supplied mono library needs to match mkbundle dynamic/static use case and target architecture.
.TP
.I "VCCRT"
Override C-runtime library linker settings.
Default "MD", mkbundle will use dynamic C-runtime linking on Windows compatible with Mono SDK distribution.
If a custom built Mono runtime using static C-Runtime linkage is used, setting this variable to "MT"
will link using static C-runtime libraries.
.TP
.I "VCSUBSYSTEM"
Override Windows subsystem.
Default, "windows". If console subsystem is preferred, use "console".
NOTE, if console output is expected from output target process then
set this variable to "console".
.SH FILES
This program will load referenced assemblies from the Mono assembly
cache.
.PP
Targets are loaded from ~/.mono/targets/TARGETNAME/mono
.SH BUGS
The option "--static" is not supported under Windows when using the
old embedding.
Moreover, a full cygwin environment containing at least "gcc" and "as"
is required for the build process. The generated executable does not
depend on cygwin.
.SH MAILING LISTS
Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details.
.SH WEB SITE
+375
View File
@@ -0,0 +1,375 @@
.TH mono-profilers 1
.SH NAME
mono\-profilers \- Mono's bundled profiler modules
.SH SYNOPSIS
\fBmono\ \-\-profile=log\fR[:\fIoption\fR,...] \fIprogram.exe\fR [\fIargs\fR]...
.PP
\fBmono\ \-\-profile=coverage\fR[:\fIoption\fR,...] \fIprogram.exe\fR [\fIargs\fR]...
.PP
\fBmono\ \-\-profile=aot\fR[:\fIoption\fR,...] \fIprogram.exe\fR [\fIargs\fR]...
.SH DESCRIPTION
Mono ships with a few profiler modules that enable most typical
profiling scenarios. This page describes each of them in the sections
below.
.SH LOG PROFILER
The log profiler is Mono's general-purpose performance profiler. It
can collect a wide variety of data that can be analyzed by tools such
as \fBmprof\-report\fR(1) or the Xamarin Profiler.
.PP
By default, the log profiler writes its output to \fIoutput.mlpd\fR.
Refer to the \fImono/profiler/log.h\fR file in the Mono source tree
for documentation on the log profiler's file format.
.PP
A default invocation of the log profiler gathers only basic data:
Metadata load and unload events, thread start and stop events,
performance counter samples, exception throws, etc. Most users will
want to enable some of the heavier features such as GC allocation
recording, statistical sampling, heap snapshotting (heapshots), or
method entry and exit instrumentation. See the \fBOptions\fR
sub-section.
.PP
Note that, in most realistic scenarios, the log profiler will record
a vast amount of data. This can lead to very large log files. (The
\fBzip\fR and \fBreport\fR options can help deal with this.)
.SS Options
The log profiler supports the following options:
.TP
\fBhelp\fR
Print usage instructions.
.TP
\fBoutput\fR=[\fI+\fR|\fI#\fR|\fI|\fR]\fIfile\fR
Write log data to \fIfile\fR. The optional modifiers are:
.RS
.ne 8
.TP
\fB+\fR
The program PID is appended to the file name. For example,
\fBoutput=+out.mlpd\fR outputs to \fIout.mlpd.1234\fR if the PID is
\fB1234\fR.
.TP
\fB#\fR
\fIfile\fR is parsed as a file descriptor number, which is opened
with \fBfdopen\fR(3). This is mainly useful in embedding scenarios.
.TP
\fB|\fR
\fIfile\fR is treated as a program name. It will be started with
\fBpopen\fR(3) and the log data will be piped to its standard input.
.RE
.TP
\fBreport\fR
Generate a report directly instead of writing the log data to a file.
If this option is used together with the \fBoutput\fR option, the
report will be written to the specified file instead of the log data.
.TP
\fBzip\fR
Compress the output file with \fBgzip\fR(1).
.TP
\fBport\fR=\fIport\fR
Use \fIport\fR to listen for command server connections. See the
\fBCommand server\fR sub-section.
.TP
\fBnodefaults\fR
Disables pre Mono 5.6 compatibility. In particular, this disables
exception events and performance counter sampling by default. It also
makes it so that GC move events won't be enabled by default when
heapshots are enabled. To use this option, it must be the first
option given to the log profiler.
.IP
This option will be the default in a future version of the log
profiler.
.TP
[\fBno\fR]\fIevent\fR
Enable or disable gathering data for \fIevent\fR, which can be one
of:
.RS
.TP
\fBexception\fR
Exception throw and clause (\fBcatch\fR, \fBfinally\fR, etc)
evaluation events. Enabled by default unless \fBnodefaults\fR is
used.
.TP
\fBmonitor\fR
Monitor lock contention, acquisition, and release events.
.TP
\fBgc\fR
GC start, progress, stop, and resize events.
.TP
\fBgcalloc\fR
GC allocation events.
.TP
\fBgcmove\fR
GC move events.
.TP
\fBgcroot\fR
GC root report events. Generated on every collection if enabled,
unless \fBnodefaults\fR is used, in which case, they're only
generated on heapshots.
.TP
\fBgchandle\fR
GC handle creation and deletion events.
.TP
\fBfinalization\fR
Object finalization events.
.TP
\fBcounter\fR
Performance counter sample events. Enabled by default unless
\fBnodefaults\fR is used.
.TP
\fBjit\fR
JIT code buffer events.
.TP
\fBalloc\fR
Alias for \fBgc\fR, \fBgcalloc\fR, and \fBgcmove\fR.
.TP
\fBlegacy\fR
Alias for \fBexception\fR, \fBmonitor\fR, \fBgc\fR, \fBgcmove\fR,
\fBgcroot\fR, \fBgchandle\fR, \fBfinalization\fR, and \fBcounter\fR.
.RE
.TP
\fBsample\fR[\fB\-real\fR][=\fIfreq\fR]
Enable statistical sampling. The default is to sample at a frequency
of 100 Hz, but \fIfreq\fR can be used to override this.
.IP
By default, sampling uses process time (i.e., the more work a process
does, the more samples are collected). The \fB-real\fR variant uses
wall clock time instead. Wall clock time is better for programs that
are I/O-bound.
.TP
\fBmaxsamples\fR=\fInum\fR
Limit the number of reusable sample events to \fInum\fR allocations.
A value of zero means no limit. By default, the value of this setting
is based on the number of CPU cores. Some tinkering with this setting
may be necessary for programs with an unusually high amount of
threads.
.TP
\fBcalls\fR
Enable method entry and exit instrumentation. This is an alternative
to statistical sampling when you need more precise information. Note
that this mode is extremely heavy and can slow most programs to a
crawl.
.TP
\fBcallspec\fR=\fIspec\fR
Limit method entry and exit instrumentation to methods matching the
specified call spec. This uses the same syntax as the \fB--trace\fR
option for \fBmono\fR(1), so refer to that page for more information.
.TP
\fBcalldepth\fR=\fInum\fR
Limit method entry and exit event collection to a call depth of
\fInum\fR.
.TP
\fBmaxframes\fR=\fInum\fR
Limit backtraces in various events (including statistical samples) to
\fInum\fR frames.
.TP
\fBheapshot\fR[=\fImode\fR]
Enable heap snapshots. \fImode\fR, if given, can be one of:
.RS
.TP
\fBondemand\fR
Only perform a heapshot when receiving a command via the command
server or when triggered through the managed library.
.TP
\fInum\fR\fBgc\fR
Perform a heapshot on every \fInum\fR collections of the major
generation.
.TP
\fInum\fR\fBms\fR
Perform a heapshot on a major generation collection if \fInum\fR
milliseconds have passed since the last heapshot.
.RE
.IP
If \fImode\fR is not given, a heapshot will be performed on every
collection of the major generation.
.TP
\fBheapshot-on-shutdown\fR
In addition to any other heapshot settings, also perform a heapshot
on runtime shutdown.
.TP
\fBdebug\fR
Print detailed debugging information. Most users should not use this
option.
.SS Command server
The log profiler features a simple command server that currently is
only used to trigger manual heapshots (typcally when using the
on-demand mode, but also usable with the other modes). A random port
will be used to listen for connections unless the \fBport\fR option
is used. To trigger a heapshot, open a TCP connection to the command
server and send the C string \fB"heapshot\\n"\fR.
.PP
The command server supports multiple simultaneous connections.
.SS Managed library
The log profiler comes with a managed library called
\fBMono.Profiler.Log\fR. This library allows easily reading log files
in managed code (e.g., C#) as well as interacting with the profiler
at run-time.
.PP
With the ability to easily read log files, users can write all sorts
of interesting analyses that might not be provided by the standard
tools (e.g., \fBmprof\-report\fR(1)).
.PP
The \fBLogProfiler\fR class allows users to reconfigure profiler
settings at run-time. For example, certain event types can be toggled
on or off, the mode and frequency of heapshots and sampling can be
changed, etc. Heapshots can also be triggered manually.
.PP
To use this library, simply pass \fB\-r:Mono.Profiler.Log\fR when
compiling your code.
.SS Example
Collect GC allocation and sampling data for a program, then generate
a report:
.PP
.nf
.RS
mono \-\-profile=log:alloc,sample program.exe
mprof\-report output.mlpd
.RE
.fi
.PP
Perform a heapshot on every 5th collection and generate a report
directly:
.PP
.nf
.RS
mono \-\-profile=log:heapshot=5gc,report program.exe
.RE
.fi
.PP
.SH COVERAGE PROFILER
The code coverage profiler collects information about how often code
paths are executed. This is done by instrumenting JIT-compiled code
at all sequence points. On program exit, the coverage profiler
collects all execution count information and outputs it to an XML
file. The main use case for the coverage profiler is unit testing: By
running unit test suites with the coverage profiler, it is possible
to determine whether the unit tests actually cover all the code that
they should.
.PP
By default, the coverage profiler writes its output to
\fIcoverage.xml\fR. Refer to the \fImono/profiler/coverage.c\fR file
in the Mono source tree for documentation on the schema.
.PP
Please note that the coverage profiler currently does not support
instrumenting AOT-compiled code. When collecting coverage data, one
may wish to run Mono with the \fB-O=-aot\fR option to disable loading
AOT-compiled code.
.SS Options
The coverage profiler supports the following options:
.TP
\fBhelp\fR
Print usage instructions.
.TP
\fBoutput\fR=[\fI+\fR|\fI#\fR|\fI|\fR]\fIfile\fR
Write coverage data to \fIfile\fR. The optional modifiers are:
.RS
.ne 8
.TP
\fB+\fR
The program PID is appended to the file name. For example,
\fBoutput=+cov.xml\fR outputs to \fIcov.xml.1234\fR if the PID is
\fB1234\fR.
.TP
\fB#\fR
\fIfile\fR is parsed as a file descriptor number, which is opened
with \fBfdopen\fR(3). This is mainly useful in embedding scenarios.
.TP
\fB|\fR
\fIfile\fR is treated as a program name. It will be started with
\fBpopen\fR(3) and the coverage data will be piped to its standard
input.
.RE
.TP
\fBcovfilter-file\fR=\fIfile\fR
Supply a coverage filter file. This option can be given multiple
times. See the \fBFilter files\fR sub-section.
.SS Filter files
Filter files can be used to pick and choose which types should be
considered for coverage instrumentation. A filter file consists of a
series of lines of the form:
.PP
.nf
.RS
\fB+\fR|\fB\-\fR\fB[\fR\fIimage_name\fR\fB]\fR\fItype_name_prefix\fR
.RE
.fi
.PP
Here, \fIimage_name\fR is something like \fBmscorlib\fR.
\fItype_name_prefix\fR can be something like \fBSystem.Int32\fR for
a specific type or \fBSystem.App\fR to pick all types starting with
\fBApp\fR in the \fBSystem\fR namespace.
.PP
Lines starting with \fB+\fR indicate that a type should be
instrumented for coverage, whereas lines starting with \fB\-\fR
indicate the opposite. Lines starting with \fB+\fR always override
lines starting with \fB\-\fR regardless of the order they appear in.
.PP
Lines not starting with either character are ignored. This can be
used to write comments. For example, this is a valid file:
.PP
.nf
.RS
# Ignore coverage in network-related code, except HTTP client code.
-[MyProgram]MyProgram.Net
+[MyProgram]MyProgram.Net.Http.HttpClient
.RE
.fi
.SS Example
Coverage data for a program can be collected like this:
.PP
.nf
.RS
mono \-O=\-aot \-\-profile=coverage:output=cov.xml program.exe
.RE
.fi
.PP
\fIcov.xml\fR will now contain the coverage data.
.SH AOT PROFILER
The AOT profiler will record which generic instantiations a program
makes use of and save the information to a specified file. This data
can then be used by the AOT compiler to compile those generic
instantiations ahead of time to reduce program startup time.
.PP
By default, the AOT profiler writes its output to
\fIoutput.aotprofile\fR. Refer to the \fImono/profiler/aot.h\fR file
in the Mono source tree for documentation on the AOT profiler's file
format.
.SS Options
The AOT profiler supports the following options:
.TP
\fBhelp\fR
Print usage instructions.
.TP
\fBoutput\fR=[\fI+\fR|\fI#\fR|\fI|\fR]\fIfile\fR
Write output data to \fIfile\fR. The optional modifiers are:
.RS
.ne 8
.TP
\fB+\fR
The program PID is appended to the file name. For example,
\fBoutput=+out.aotprofile\fR outputs to \fIout.aotprofile.1234\fR if
the PID is \fB1234\fR.
.TP
\fB#\fR
\fIfile\fR is parsed as a file descriptor number, which is opened
with \fBfdopen\fR(3). This is mainly useful in embedding scenarios.
.TP
\fB|\fR
\fIfile\fR is treated as a program name. It will be started with
\fBpopen\fR(3) and the log data will be piped to its standard input.
.RE
.TP
\fBverbose\fR
Print detailed debugging information. Most users should not use this
option.
.SS Example
A profile can be collected and used like this:
.PP
.nf
.RS
mono \-\-profile=aot:output=program.aotprofile program.exe
mono \-\-aot=profile=program.aotprofile program.exe
mono program.exe
.RE
.fi
.PP
.SH SEE ALSO
\fBmono\fR(1), \fBmprof\-report\fR(1)
-5
View File
@@ -26,11 +26,6 @@ and execution can be resumed by sending the SIGUSR2 signal. The
service can be cleanly shutdown by sending the SIGTERM signal to the
process.
.PP
Mono programs started with mono-service run with the
.B MONO_DISABLE_SHM
variable set. This means that certain Mono features that depend on
it are not available to services.
.PP
The following options can be used to control the service:
.TP
.I "-d:DIRECTORY"
Loaded 100 of 5695 files, more files were not shown because too many files have changed in this diff. Show more