Compare commits

...
1648 Commits
Author SHA1 Message Date
Jo Shields a76b50e5fa Append .1 to version number 2019-03-14 16:18:35 -04:00
Jo Shields 5888bf9acc Include libgdiplus 5.6.1 2019-03-14 16:13:15 -04:00
Alexis Christoforides 91be8bb746 [MacSDK] Bump Nuget to 4.8.2 2019-03-13 14:50:37 +01:00
Alexander Köplinger 9d4aa950aa [ci] Use dl.internalx.com when building on private Jenkins 2019-02-26 11:19:43 +01:00
Alexander Köplinger aac8e69534 [ci] Support building the OSX .pkg on private Jenkins
(cherry picked from commit 7f5125179d)
2019-02-12 16:12:32 +01:00
Alexander Köplinger f880f9f120 [ci] Bump bockbuild to get fontconfig url fix 2019-02-12 16:11:34 +01:00
Lee Culver a4e486da0b Add back missing stack frames to mono MERP reports
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-04 17:46:34 +01:00
monojenkins 077179a5dc [jit] Fix a buffer overflow in mini_get_gsharedvt_out_sig_wrapper_signature (). (#12140)
Fixes https://github.com/mono/mono/issues/12130.
2019-01-14 13:40:20 +01:00
Alexander Kyte cf22cf26f6 [crash] Remove missing LLVM_API_SUPPORT symbol usage (#12396) 2019-01-12 12:10:22 +01:00
Alexander Kyte 4ff5c09c29 [2018-06] [merp] Batch of fixes (#12037)
* [crash] Early exit if callbacks not set

* [crash] Report which thread was crashing

* [runtime] Make sure lldb/gdb dump happens when MERP fails

* [crash] Create supervisor thread for crash dumper

* [runtime] Add waitpid to probed-for libc functions

* [crash] Add crash reporter logger

* [crash] Disable mono-merp when disabling crash reporting

* [crash] Switch merp dumper to no-allocate file writer

- Pass merp directory to backend (optional)
- Adds tests that needed the named change

* [crash] Make mono-state use non-allocating format strings

* [crash] Add json formatting validators to mono/tests

* [crash] Make crash-sending icalls use const strings

* [crash] Use fork+exec for merp

* [crash] Throw exception when unable to contact merp

* [runtime] Remove duplicate merp invoke line

Backport of #12036

* [crash] Disable merp-json-valid test on non-OSX

* [crash] Fix state disabler on OSX

* [crash] Fix mono-state writer trailing comma

* [crash] Add missing entry for native method reporting

* [crash] Disable crash logger test on linux

* [backport] Revert API change, disable test
2019-01-11 16:04:38 -02:00
Alexander Köplinger bba4ca2a7c [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)
2019-01-11 11:36:42 +01:00
monojenkins c6816aab10 [2018-06] [MacSDK] Bump NuGet to 4.8.1 (#12135)
Backport of #12034.
2018-12-20 13:24:18 +01:00
monojenkins 1dedd6fe94 [aot] Emit runtime invoke wrappers for up to 40 parameters for bitcode, newly added tests depend on it. (#11893)
[2018-06] [aot] Emit runtime invoke wrappers for up to 40 parameters for bitcod…

…e, newly added tests depend on it.

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



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


Backport of #11891.

/cc @vargaz
2018-12-18 18:40:28 -05:00
monojenkins ad3edd3484 [crash] Add managed exception class name (#11822) 2018-11-30 13:28:26 -08:00
Bernhard Urban 3b3c10f34e [interp] Compile method for errors when needed (#11836)
[2018-06] [interp] Compile method for errors when needed

Partial backport of https://github.com/mono/mono/pull/10095

This change is also needed for the following situation: On a native-to-managed transition the interpreter executes the `NATIVE_TO_MANAGED` wrapper. This wrapper makes sure that the thread is attached. However, doing `transform` requires an attached thread in some cases (e.g. when you run with `--debug`). This commit makes sure that we transform the `InterpMethod` when the thread is attached, that is, when the entry point for the native-to-managed transition is requested.

FYI: This is already in `2018-08` and up.
2018-11-29 15:35:45 -05:00
Bernhard Urban 6755978fe4 [interp] Don't include internal frames in stack trace (#11795)
For handled exceptions. On unhandled exceptions we leave them for debugging purposes.

Fixes exception18.cs
2018-11-27 14:33:28 -08:00
Bernhard Urban 7aadce3fad [mini] use AOT trampolines in interp mixed mode (#11767) (#11784)
[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. 
```
2018-11-26 12:37:57 -08:00
monojenkins 4bc42a8767 [interp] Don't throw exception on -1 division (#11777)
Backport of #9656.
2018-11-26 16:34:44 +01:00
Bernhard Urban b63e5378e3 [2018-06][ios] fix path for llvm invocation (#11737)
Seems like this change got lost when backporting https://github.com/mono/mono/pull/10445. The other branches, 2018-06 and 2018-10, are fine.

This should make the LLVM step on the iOS SDK lane green again.

Context: https://github.com/mono/mono/pull/10440#issuecomment-439461353
2018-11-19 17:31:14 -05:00
monojenkins bb3ae37d71 [interp] attempt to intrinsify again after a method is resolved regarding generics (#11715)
[2018-06] [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 15:15:35 -05:00
monojenkins 78eb5303e8 [2018-06] [aot] image is usable without debug flag when interpreter is used (#11711)
Backport of #11705.
2018-11-16 12:10:49 +01:00
monojenkins 54cc205dd9 [2018-06] [crash] Remove duplicated il_offset (#11703)
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:43 +01:00
monojenkins 279ac406e7 [2018-06] [runtime] Fix the size calculation in mono_debug_add_method (). (#11686)
Backport of #11672.
2018-11-15 16:12:37 +01:00
Bernhard Urban 1ac52d1827 [2018-06] [llvm] bump for armhf callingconv fix (#11610)
* [llvm] bump for armhf callingconv fix

Commit list for mono/llvm:

* mono/llvm@f80899cb3e [mono] respect hardfloat/softloat setting in ARM ABI (#16)
* mono/llvm@f80899cb3e (HEAD -> master, origin/master) [mono] respect hardfloat/softloat setting in ARM ABI (#16)
* mono/llvm@37e14bd72e Fix the mono calling convention on arm64+linux.
* mono/llvm@acb33f3436 Pack 32bits llc, opt and llvm-dis in archive as well
* mono/llvm@9b92b4b876 Merge pull request #14 from lateralusX/lateralusX/build-llvm-windows-x64
* mono/llvm@e2ae3309b0 Fixes Mono LLVM usage on Windows x64.
* mono/llvm@384caa9849 Build LLVM Windows x64 using CMake + VS2015 or VS2017.
* mono/llvm@0b3cb8ac12 Emit an LSDA for methods without landing pads too since we need the information about the 'this' register.fbbfbae4fea [ci] Enable x86/amd64 backends. (#9)
* mono/llvm@8e14f6654a Add 3.9 Packaging Scripts and Cross Compilation Support (#8)
* mono/llvm@bdb3a116db Change some code slighly in AArch64InstrInfo.cpp to work around a gcc optimizer problem. https://github.com/xamarin/xamarin-android/issues/1182.
* mono/llvm@3b82b3c904 [ci] Really compile the 32 bit llvm as 32 bit.
* mono/llvm@73c983a02a [ci] Distribute 32 bit llvm-config.
* mono/llvm@0692a5ea23 [ci] Install 64-bit binaries into usr64 for consistency.
* mono/llvm@804c869e6b [ci] Fix 32 bit build.8dfa8ebfc25 [ci] Compile a 32 bit version of llvm as well.07582cba7cc [ci] Package llvm-config as well.
* mono/llvm@a9cfb50e5a [ci] Fix an rm statement which can fail.
* mono/llvm@a21fcae962 Add a jenkins build script.
* mono/llvm@21492ec92e Revert "Add a workaround to the problem where the amd64 JIT would make all calls as register indirect."
* mono/llvm@6aa74ae572 Fix a regression caused by:
* mono/llvm@5056b9f2bc Rename the temp labels used by DwarfMonoException so they don't collide with the ones used by the GNU EH frame.
* mono/llvm@975e3a6903 Align the size of the Mono EH table to 8 to prevent an ld assertion. Fixes #55553.
* mono/llvm@dbb6fdffde [arm] Handle CallingConv::Mono in getEffectiveCallingConv (), previously it would be handled by the default branch, which would fall through to the next switch case because llvm_unreachable() was a noop in release builds.
* mono/llvm@5b94bc7097 Avoid making the EH table symbol global, its not needed any more.
* mono/llvm@8b1520c8aa Merge pull request #6 from Xaltotun/feature/cmake_build
* mono/llvm@8d00fd3845 Fixed MONO_API_VERSION define for the cmake build. For #cmakedefine to work, the variable needs to be declared in the cmake script otherwise it will be commented out in the generated file.
* mono/llvm@73df95d02d Merge pull request #5 from alexanderkyte/mastere
* mono/llvm@51cd999c98 [mono] Fix MONO_API_VERSION usage with cmake

Diff: https://github.com/mono/llvm/compare/9f79399f87282524fee099b328bd8cbf07929daf...f80899cb3eb75f7f5640b4519e83bd96991bffb8

* [arm64] Pass small stack args correctly on linux. Fixes pinvoke.exe with llvm+full aot.

Backport of #10674.
2018-11-14 17:44:05 -05:00
Bernhard Urban eee1d634e8 [ios] remove DISABLE_POLICY_EVIDENCE (#11580)
[2018-06] [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
2018-11-07 00:55:36 -05:00
Alexander Köplinger 4d7b7ab375 [ci] Fix Windows .msi build
(cherry picked from commit c8d59d1d1d)
2018-11-06 10:41:47 +01:00
monojenkins 21dc7470bc [bcl] avoid false pinning in GCTest (#11534) 2018-11-05 21:00:59 -05:00
monojenkins d9779c1df6 [interp] accept typed-by-ref as return type from a JIT call (#11538) 2018-11-05 20:59:34 -05:00
monojenkins e7e14a7929 [interp] transform delegate invoke in method body too (#11549) 2018-11-05 20:58:52 -05:00
Alexander Köplinger cadeaf43da [ci] Switch to new syntax of Azure Storage plugin
(cherry picked from commit de2cb5fdde)
2018-11-05 18:24:00 +01:00
monojenkins 709b46e333 [tests] reduce recursion depth (#11484)
so it doesn't trigger a stack overflow on Xamarin.iOS with interpreter on a debug build (`CFLAGS=-O0`).
2018-10-31 12:46:02 +01:00
Alexander Kyte b291519422 [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:31:16 +01:00
Alexander Kyte 149206a5ee [crash] Fix merp invocation (#11436)
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.
2018-10-30 19:23:53 +01:00
monojenkins 2f2615ffc8 [2018-06] [delegates] do not use CEE_CALLVIRT for non-virtual methods (#11450)
Backport of #11433.

/cc @lewurm 

Description:
2018-10-30 18:25:49 +01:00
Bernhard Urban 47eb7c55eb [2018-06] [interp] Overflow fixes (#11426)
* [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

* [interp] throw overflow exception when {float,double}.NaN is converted to an int type (#11380)

[interp] throw overflow exception when {float,double}.NaN is converted to an int type

A comparison with NaN is always `false`.
2018-10-29 18:37:56 -04:00
Bernhard Urban 3ae42fc38d [2018-06] [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode (#11362)
[2018-06] [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode

Backport of https://github.com/mono/mono/pull/11321
2018-10-25 15:25:39 -04:00
monojenkins c4f7644e97 [tests] lower recursion depth of PerformNoPinAction (#11325)
so it doesn't overflow the stack when running on macOS with `clang -O0`.
2018-10-25 00:27:40 +02:00
Marek Habersack adeaf3e033 [SDKS, LLVM] Disable detection and use of libxml2 (#11341)
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.
2018-10-25 00:24:09 +02:00
Aleksey Kliger (λgeek) 32d1539629 [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:24:57 +02:00
monojenkins c0fe724379 [aot] Reenable recursion checking when initing shared got entries (#11295)
[2018-06] [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 17:55:37 -04:00
monojenkins f55f7e53e3 [interp] use unsigned conversion for nuint (#11285)
[2018-06] [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-20 14:05:32 -04:00
Bernhard Urban 5986920bdb [2018-06] [arm64] Remove the limitation on the number of nullable arguments for dyncalls (#11266)
* [arm64] Remove the limitation on the number of nullable arguments for dyncalls. (#11186)

* [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:51:57 +02:00
markusbeth 665a308c39 [WinForms] Propagate the flags from DrawTextInternal to MeasureTextInternal (#11251)
Flags to DrawText never reached MeasureText therefore strings with '&' were measured incorrect when drawn with flag TextFormatFlags.NoPrefix.
Fixes #6352
2018-10-19 12:58:02 +02:00
Alexander Kyte 5ed4143b4f [2018-06] Crash Reporter V2 (#11162)
* [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 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 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] Fix string races with DumpTotal icall

* [crash] Fix space in crash file name

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

* [runtime] Make sequence point lookup lockless

* [crash] Fix managed exception dumper icall format

* [crash] Add tests for concurrent dumping

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

* [crash] Copy safer strings with crash privacy disabled

* [crash] Fix BindingFlags undefined with mcs+linux x64

* [crash] Fix icall declarations for new style

* [crash] Squashed support for  RegisterReportingForNativeLib

* [crash] Disable tests on linux / non-osx platforms
2018-10-19 00:59:38 +02:00
Vlad Brezae f0db92c2b6 [interp] Implement interpreter entry trampolines on amd64 (#10978) (#11165)
* [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:37 -04:00
Alexander Köplinger c1f1a7bfed [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:45:05 +02:00
monojenkins d80ced607b [aot] Ensure shared got entries are initialized before loading methods (#11225)
[2018-06] [aot] Ensure shared got entries are initialized before loading methods

Backport of #11190.

/cc @luhenry @BrzVlad

Description:
Executing aot code that uses them would crash. Fixes random csc crashes.



<!--
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-18 03:15:29 -04:00
monojenkins d07c626a74 [pkg] Add preinstall which removes existing Mono of the same version (#11209)
Fixes #https://github.com/mono/mono/issues/11202
2018-10-17 22:37:58 +02:00
Ludovic Henry cda3acc57c [sdks] futimens and futimes symbols are missing on anything earlier than 10.13 (#11174)
This breaks when LLVM is built on 10.13+ and the runtimes are built on 10.12.
2018-10-15 22:59:53 -04:00
Alexander Köplinger 226e91a064 Bump xunit-binaries 2018-10-11 17:11:27 -04:00
Ludovic Henry 2343f26706 [sdks] Add cmake toolchain file for LLVM MXE builds (#11056)
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-10 20:32:11 -04:00
Ludovic Henry 46b723d6b0 [2018-06] [sdks] Create archive targets for pre-building on CI (#10936)
* [sdks] Remove redundant --enable-cxx

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

* [sdks] Build BCL profiles without configure flags

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

* [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] Use archive-{android,ios,wasm} on CI

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

* [sdks] Add download/pack capabilities for LLVM

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

* [sdks] Simplify call to BclTemplate

* Put xunit tests in mcs/class/lib/PROFILE/tests too

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.

* [sdks] Build LLVM with make in parallel

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

* [build] Switch to netstandard based xunit
2018-10-10 13:35:45 -04:00
monojenkins ab3c897d68 Merge pull request #10997 from lewurm/2018-06-interp-fixes-for-native-type
[2018-06] [interp] fixes for native type

Backport of https://github.com/mono/mono/pull/10749
2018-10-05 15:35:20 +02:00
Bernhard Urban 914a62ab2e [interp] introduce float R4 stack type 2018-10-05 11:04:55 +02:00
Bernhard Urban 62f23a8365 [interp] support ntype.ToString () 2018-10-05 11:04:07 +02:00
Bernhard Urban 2c48c62e66 [interp] support nfloat.*Infinity 2018-10-05 11:04:06 +02:00
Bernhard Urban 5c5a48b144 [interp] support ntype.Equals () 2018-10-05 11:04:06 +02:00
Bernhard Urban 13e412ee52 [interp] support ntype.CompareTo () 2018-10-05 11:04:05 +02:00
Bernhard Urban a576a799b1 [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.
2018-10-05 11:04:03 +02:00
Rolf Bjarne Kvinge 1d9378713e [sdks/ios] Build libMonoPosixHelper for device architectures, so that zlib-helper.o is created. (#10921) (#10970)
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:32 -04:00
monojenkins 6e48ad4f7b Merge pull request #10905 from monojenkins/backport-pr-10899-to-2018-06
[2018-06] [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 17:05:46 +02:00
Vlad Brezae d050e323ed [runtime] Fix undefined pthread_main_np (#10930)
It is exported only when _DARWIN_C_SOURCE is defined.
2018-10-03 10:37:23 +03:00
Maxim Lipnin b549fa7f32 [Reflection] Fix issue with finding types in module using an asterisk as filter criteria 2018-10-02 14:56:01 +02:00
Marek Safar 0dffbef269 Bump corefx to disable more tests 2018-10-02 12:24:05 +02:00
Vlad Brezae 6c46acfe69 [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
monojenkins 46e0249d4c [sdks] One more update to get XA PR builds working on Linux (#10855)
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:33 -04:00
Marek Safar 910395a05f corefx bump 2018-09-27 17:00:39 +02:00
monojenkins 2cdfb380a3 [2018-06] [System]: Make sure HttpWebRequest observes exceptions on timeout. #10488. (#10732)
* [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.

* Add `TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.OnlyOnCanceled` as suggested by Marek.

* Use 'OnlyFaulted' only.
2018-09-27 10:32:25 -04:00
monojenkins aebef84fa2 [merp] Fix return value handling of posix_spawn (#10828) 2018-09-27 10:30:42 -04:00
monojenkins 59f2dbf28b [sdks] Debian Linux doesn't need to build MXE (#10819)
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:07 -04:00
Ankit Jain 401bce867d Bump msbuild to track mono-2018-06 2018-09-27 11:56:16 +02:00
Marek Safar 65737564b0 Bump corefx 2018-09-26 08:07:56 +02:00
monojenkins 40d991c325 [SDKS] Build host runtime with correct bitness (#10742)
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-24 13:52:54 -04:00
Alexander Kyte 1a71d5101f [crash] Fix summarize_frame assertion 2018-09-21 09:26:33 +02:00
Egor Bogatov 8f36212ad3 [2018-06] Ignore some xunit tests for XA (non compatible with xunit 2.4) (#10721)
* disable some not compatible with xunit 2.4 tests

* bump corefx
2018-09-20 16:51:48 -04:00
Marek Safar 410792459a [corlib] Makes remoting test more robust (and disable it on mobile) 2018-09-20 17:49:26 +02:00
monojenkins 7dd65f79a5 [mono-api-html] Render something for fields with marshalling info. (#10698)
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:29 -04:00
monojenkins 7c898271e7 [offset-tool] Error out when parsing fails. (#10696) 2018-09-19 17:16:02 -04:00
monojenkins adbb8f72c8 [2018-06] Implement IEnumerable for ConditionalWeakTable (#10657)
* Implement IEnumerable for ConditionalWeakTable

* Update ConditionalWeakTable.cs
2018-09-19 12:16:35 -04:00
monojenkins 1b18f39e46 [arm64] Fix the alignment of valuetypes passed after small primitive types on IOS. (#10591)
Fixes https://github.com/xamarin/xamarin-macios/issues/4347.
2018-09-14 08:23:23 -04:00
monojenkins e0221129db [runtime] Fix Marshal.SizeOf (typeof (void)). (#10601)
Fixes https://github.com/mono/mono/issues/10303.
2018-09-14 08:21:24 -04:00
Marek Safar fbaeba4fec [2018-06][Facades] Removes duplicate entry 2018-09-13 13:54:00 +02:00
monojenkins e944415e26 [csproj] Update project files 2018-09-13 09:37:14 +02:00
monojenkins 01d8b4ca55 Bump API snapshot submodule 2018-09-13 09:37:14 +02:00
Marek Safar b84f201e1b [Facades] Adds System.Buffers mobile facade
and sets up facades without corresponding nuget _._ for conflict
resolution done by msbuild
2018-09-13 09:37:14 +02:00
monojenkins e6e4f15474 Treat EXDEV from clonefile the same way as ENOTSUP. (#10530)
Backport of #10528.

/cc @akoeplinger
2018-09-12 13:56:56 -04:00
Zoltan Varga 89cabf4205 [arm64] Add dyncall support for ArgVtypeByRefOnStack arguments.
Fixes https://github.com/mono/mono/issues/10483.
2018-09-11 08:57:27 +02:00
Ankit Jain 8d13a8428d Bump msbuild 2018-06 branch to track xplat-master (#10383) 2018-09-07 23:55:47 +02:00
Alexander Köplinger 5e81afa90d [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:19:52 +02:00
monojenkins 6b3dfce0c8 [2018-06] Ensure the finalization in DeflateStream is performed in the correct order. (#10491)
* 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:15 -04:00
Alexander Köplinger b34a4d9f57 [2018-06] Bump corefx to get https://github.com/mono/corefx/pull/131 (#10473) 2018-09-06 18:46:53 -04:00
Alexander Kyte 033a5184d1 [2018-06] [runtime] Fix mxe+release_60 llvm build (#10402)
* 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.

* Fix build issue on OSX.

* [llvm] Fix build with MXE

* [runtime] Fix mxe+release_60 llvm build

* [sdks] Enable package-android-cross-{arm,arm64,x86,x86_64}-win builds on CI

* [llvm] Fix mxe+release_60 build
2018-09-06 13:52:51 -04:00
monojenkins 9439ee6dca Merge pull request #10455 from lewurm/2018-06-osx-clonefile
[2018-06] Use clonefile instead of copyfile on macOS

* Revert of https://github.com/mono/mono/pull/10010 
* Backport of https://github.com/mono/mono/pull/10020

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


/cc @filipnavara
2018-09-05 07:35:06 -04:00
Neale Ferguson d02452fc8f Reapply #10254 to 2018-06 and include change in #10393 (#10469)
The early change to make MonoTlsStream IDisposable had to be backed out of 2018-06. This restores that fix and includes the fix from #10393 that fixed the reason for the back out.
2018-09-05 08:24:51 +02:00
Alexander Köplinger 3671c04b8e Update framework assemblies list in assembly.c 2018-09-04 16:16:54 +02:00
Martin Baulig 6029509bab [System]Fix MonoBtlsProvider.CheckValidationResult () logic. 2018-09-04 16:15:57 +02:00
monojenkins 4cd817955f [2018-06] Truncate MachineName (and UserDomainName) at first period (#10419)
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:21:03 +02:00
monojenkins fc2c8b6435 [2018-06] [corlib] Bring back String.Concat with __arglist (#10458)
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:23 +02:00
Filip Navara 0d9c68bf13 Use clonefile instead of copyfile on macOS. (#10020)
* Use clonefile instead of copyfile on macOS.

* Address PR review comments.

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

* RTLD_DEFAULT - > libc_handle
2018-09-03 23:53:01 +02:00
Bernhard Urban 99f3086330 Revert "[w32file] Fix usage of copyfile (#10010)"
This reverts commit 341142d765.
2018-09-03 23:43:53 +02:00
Ludovic Henry 330eec3b4c Bump to llvm/master/acb33f34 (#10440) 2018-09-02 07:07:12 -04:00
monojenkins 3a18dce583 [interp] white list nfloat::IsNaN () (#10384) 2018-09-01 10:03:54 -04:00
monojenkins b7043700bf [sgen] Fix string size inconsistency between alloc/scan (#10409)
This could lead to crashes when having strings with size at the LOS boundary.

https://github.com/mono/mono/issues/10309
2018-09-01 10:03:35 -04:00
Ludovic Henry b5fa84934f [2018-06] [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA + Unify provisioning of LLVM for both Android and iOS. (#10398)
* [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
2018-09-01 09:31:54 -04:00
Jo Shields ac8b05bd71 Merge pull request #10420 from directhex/fix-make-dist-wasm-debugger
Fix `make dist`, broken by 6dc01610e5
2018-08-31 12:13:02 -04:00
Jo Shields d25f967908 Fix make dist, broken by 6dc01610e5 2018-08-31 12:11:17 -04:00
Martin Baulig c8b810e9d7 Revert "[2018-06] [System]: MonoTlsStream is now IDisposable and cleans up on error. (#10391)
Revert PR #10336.

This reverts commit 3bb7817ffd.
2018-08-30 21:22:56 +02:00
monojenkins 633db89a80 Merge pull request #10347 from lewurm/2018-06-interp-fix-ftnptr-eh-callback
[2018-06] [interp] fix ftnptr_eh_callback

Backport of https://github.com/mono/mono/pull/10224
2018-08-30 12:16:17 -04:00
Alexander Köplinger 324d70ea30 [runtime] Run update_submodules.sh earlier (#10365)
Backport of #9646
2018-08-30 11:21:43 +02:00
Ludovic Henry 43e7e83cb1 [sdks] Allow for overwriting llvm-{llvm32,llvm64} CC and CXX (#10360) 2018-08-29 22:11:14 -04:00
Bernhard Urban 58ca70df3b [2018-06] [mini] fix memory dumping on devices (#10351)
[2018-06] [mini] fix memory dumping on devices 

Backport of https://github.com/mono/mono/pull/10316
2018-08-29 19:40:11 -04:00
Zoltan Varga f9c42ea716 [2018-06] [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i… (#10102)
* [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes.

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

* [llvm] Fix the special casing of OP_LCOMPARE_IMM, its not needed.
2018-08-29 14:41:51 +02:00
monojenkins 3bb7817ffd [2018-06] [System]: MonoTlsStream is now IDisposable and cleans up on error. (#10336)
Backport of #10254.

/cc @marek-safar
2018-08-29 14:01:42 +02:00
Bernhard Urban fb2708d019 [interp] turn off optimizations for callers of INTERP_PUSH_LMF_WITH_CTX 2018-08-29 11:13:16 +02:00
Bernhard Urban 6dc01610e5 [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 11:11:58 +02:00
Bernhard Urban 12940800a9 [exceptions] pop lmf stack before executing ftnptr_eh_callback 2018-08-29 11:08:37 +02:00
Zoltan Varga ca79abc9b8 [jit] Disable tail calls from gsharedvt code for now.
Fixes https://github.com/mono/mono/issues/9870.
2018-08-28 12:00:16 +02:00
Alexander Kyte 57e9fc6413 [2018-06] Add pipeline to convert managed exception into telemetry format (#10247) 2018-08-27 15:57:06 -04:00
monojenkins 02bc3c5101 [2018-06] System.Windows.Forms: Fix regressions in layout code and TextBox Font handling (#10306)
Backport of #10238.

/cc @filipnavara
2018-08-27 21:32:45 +02:00
Marek Habersack 421e62dd05 [eglib] Fix URI to file name conversion
Hexadecimal ASCII to decimal integer conversion must be 10-based.
2018-08-24 09:22:38 +02:00
Alexander Köplinger 0955dd2307 Bump xunit-binaries
Gets in fix for invalid NUnit xml output generated by xunit
2018-08-22 13:14:04 +02:00
monojenkins a51f37f6c5 An implementation of the ChainStatus property for Btls. (#10216)
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:47:59 +02:00
Alexander Köplinger 16dceddbb9 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:22 +02:00
monojenkins 2fbd56f437 Fix process leak in process enumeration. Dispose rejected ones. (#10187)
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:15 +02:00
monojenkins baf5e7d9e9 [System.Xml.Linq] Fix namespace conflict with new Xamarin.Mac namespace in test code. (#10183)
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:10:05 +02:00
monojenkins 680c35dae9 [sdks] Fix local testing for Android (#10175) 2018-08-19 12:11:26 -04:00
monojenkins 192987859f [2018-06] [reflection] Assembly.LoadFile should throw ArgumentException for relative paths (#10083)
* [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:34 -04:00
Ludovic Henry b59ae60011 [sdks] Fix llvm build with MXE (#10106) 2018-08-15 08:39:20 -04:00
Aleksey Kliger (λgeek) 53a0e8f7a8 [2018-06][reflection] Implement RuntimeType.IsSubclassOf in native (#10078)
* [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 00:09:20 -04:00
monojenkins bf5706e3da [bcl] Disable a test which fails with linking. (#10104)
Fixes https://github.com/xamarin/xamarin-macios/issues/4617.
2018-08-15 01:04:35 +02:00
Alexander Köplinger 6dc3229b41 Add .gitignore for mono/tests/assembly-load-reference 2018-08-14 16:53:20 +02:00
monojenkins 7a9c54ebd4 [ppc] Lower OP_LMUL_IMM. (#10067) 2018-08-13 17:43:51 +02:00
Zoltan Varga 3707b814d2 [sdb] Disable an assert to avoid breaking debugging. (#9987)
Fixes https://github.com/mono/mono/issues/8848.
Fixes https://github.com/mono/mono/issues/9262.
Fixes https://github.com/mono/mono/issues/8627.

Backport of https://github.com/mono/mono/pull/9983.
2018-08-10 13:12:02 -04:00
monojenkins 341142d765 [w32file] Fix usage of copyfile (#10010)
When passing COPYFILE_CLONE, copyfile will not follow a symbolic link on the src file. This is a problem since it breaks File.Copy assumption which, when passed a symbolic link, follows the symbolic link instead of copying it. The bug is visible as soon as you use <Copy /> with msbuild and you try to access the copied file with <Touch /> for example
2018-08-10 11:46:32 -04:00
monojenkins 0456d75b08 [w32file] Fix typo (#10002)
Backport of #10001.

/cc @luhenry
2018-08-09 16:43:05 -04:00
monojenkins 333df6b381 [coop] Thread.JoinInternal should not call mono_error_set_pending_exception (#9972)
[2018-06] [coop] Thread.JoinInternal should not call mono_error_set_pending_exception

Backport of #9948.

/cc @lambdageek
2018-08-09 20:55:23 +02:00
monojenkins bd3321192a [2018-06] [Facades] Adds System.Threading.Tasks.Extensions for mobile profiles (#9977)
* [Facades] Adds System.Threading.Tasks.Extensions for mobile profile

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-09 00:14:23 +02:00
Marek Safar a8b65e127b [build] Bump bootstrap mcs version 2018-08-08 10:42:02 +02:00
Zoltan Varga 679f19711d [sdks] Install the llvm36 versions of opt/llc as well. 2018-08-08 10:12:39 +02:00
Zoltan Varga 925d10ba9c [sdks] Make download-llvm36.sh use different temporary files/directories. 2018-08-07 09:44:21 +02:00
Zoltan Varga 481131ab0d [sdks] Switch the 32 bit cross compilers back to the old llvm 3.6, the new version has too many problems. 2018-08-07 09:44:21 +02:00
Aleksey Kliger 9ae1e9e796 [tests] AOT assembly-load-reference tests 2018-08-07 09:43:45 +02:00
Aleksey Kliger 263244a53a [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-07 09:43:45 +02:00
Aleksey Kliger 88ef07a501 [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-07 09:43:45 +02:00
Aleksey Kliger aa33b264e0 [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-07 09:43:45 +02:00
Aleksey Kliger 5d3dd6494c [utils] Add mono_path_filename_in_basedir 2018-08-07 09:43:45 +02:00
Aleksey Kliger efe65c3d32 [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-07 09:43:45 +02:00
Aleksey Kliger 2d8bc639e2 [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-07 09:43:45 +02:00
Aleksey Kliger 0713611287 [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-07 09:43:45 +02:00
Aleksey Kliger c2b0be8c25 [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-07 09:43:45 +02:00
monojenkins 36665cc777 [llvm] Fix OP_ABSF. (#9882)
Fixes https://github.com/mono/mono/issues/9869.
2018-08-06 12:52:24 +02:00
EgorBo 093c0dc3b7 backport #9800 to 2018-06 2018-08-03 14:24:36 +02:00
Ankit Jain e59ebf5413 [msbuild] Bump to point to HEAD of mono-2018-04 msbuild … (#9846)
.. once, msbuild has an updated branch for 2018-06/master, then this
will point to that.

This also picks up fix for https://github.com/xamarin/xamarin-android/issues/1845 .
2018-08-02 00:33:47 +02:00
Vlad Brezae dc815ae562 [interp] Fix span exception throwing 2018-08-01 22:13:32 +02:00
Bernhard Urban 0e0e4a68f9 [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:18 +02:00
Zoltan Varga 7bcda192a0 Bump llvm to release_60/fc854b8ec5873d294b80afa3e6cf6a88c5c48886. (#9786). (#9804) 2018-07-30 22:36:22 +02:00
monojenkins 23e95ec7ad Apply F# portable pdb debug fix for pinvokes & bump (#9797)
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:53 +02:00
monojenkins 295f6d32af [2018-06] [MacOS] On Mac, use the copyfile API to copy files (#9696)
Backport of #9642.

/cc @lewurm
2018-07-25 21:07:25 +02:00
monojenkins 7d5f4b6136 [2018-06] [interp] add Span\u003cT\u003e intrinsics for get_Item and get_Length (#9686)
[2018-06] [interp] add Span\u003cT\u003e intrinsics for get_Item and get_Length

Backport of #9644.

/cc @lewurm
2018-07-23 08:40:15 -04:00
Bernhard Urban 1569c8957e [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-23 11:28:48 +02:00
Vlad Brezae cd7f2e39ce [interp] Remove unused code added recently 2018-07-20 10:40:36 -04:00
Vlad Brezae 07144a0840 [interp] Simplify call
Needed also for exception checking, which is done in the wrapper, instead of pinvoke interp code.
2018-07-20 10:40:36 -04:00
Vlad Brezae 31bb7caeb5 [interp] Remove exception checking from pinvoke code
Exception checking is done by the m2n wrapper
2018-07-20 10:40:36 -04:00
Vlad Brezae 3b2e09e46a [interp] Fix stackframe iteration
Interp to managed are not real frames
2018-07-20 10:40:36 -04:00
Vlad Brezae 78b279d3ac [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-20 10:40:36 -04:00
Vlad Brezae b02990a2b6 [interp] Move MINT_CALLRUN emitting inside transform
Also optimize MINT_CALLRUN a bit
2018-07-20 10:40:36 -04:00
Vlad Brezae 3c7dbafd13 [interp] Extract some code from big function 2018-07-20 10:40:36 -04:00
Bernhard Urban 428eb39755 [TermInfo] fix reading integer value for new file format
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 17:55:11 -04:00
Marek Safar ab1a051d85 Bump bockbuild 2018-07-19 14:52:12 -04:00
monojenkins e2c2b51c5d [llvm] Avoid using the preserveall calling convention in another place on watchos. (#9577)
Fixes https://github.com/mono/mono/issues/9318.
2018-07-19 12:44:17 +02:00
Bernhard Urban 2ae7a8d425 [2018-06] interp delegate fixes (#9600)
[2018-06] interp delegate fixes

Backport of https://github.com/mono/mono/pull/9029 and https://github.com/mono/mono/pull/9409. The former makes backporting of the latter easier.
2018-07-19 06:39:09 -04:00
Marek Safar f4dbef76c9 [System] Update mobile tests to reflect missing DesignerAttribute
Fixes #8407
2018-07-19 09:31:20 +02:00
Alexander Köplinger a98fecbb2b [corlib] Remove incorrectly included Interop.GetRandomBytes.Mono.cs file from .sources
It was added in https://github.com/mono/mono/commit/2e3c4398a9d0d8e3f86b60e753f3da6393a26897 but doesn't actually exist in 2018-06.
2018-07-18 17:42:32 +02:00
monojenkins 0266011065 Fix LogcatTextWriter_Log interpreting messages it logs, potentially writing random garbage and/or crashing (introduced by https://github.com/mono/mono/commit/984f6484666c2ee6fefec949c81fdff1189c9488) (Fixes https://github.com/xamarin/xamarin-android/issues/1951) (#9615) 2018-07-18 11:41:34 -04:00
monojenkins db81ac1b42 [runtime] Make sigterm dumper send file to merp (#9609) 2018-07-18 11:39:41 -04:00
monojenkins 6716456162 [csproj] Update project files 2018-07-17 19:12:07 +02:00
Marek Safar 49a36f9414 [corlib] Include all span helpers optimizations (#9548) 2018-07-17 19:12:07 +02:00
Zoltan Varga bb47db880f [runtime] Allow --enable-llvm to work with newer llvm versions as well. 2018-07-17 12:59:25 +02:00
monojenkins e74de955c2 [csproj] Update project files 2018-07-16 22:46:08 +02:00
monojenkins 38b9b1a203 Bump API snapshot submodule 2018-07-16 22:46:08 +02:00
Marek Safar a1eb29aff4 Bump corert 2018-07-16 22:46:08 +02:00
Marek Safar 894e552a6b Fixes windows build 2018-07-16 22:46:08 +02:00
Marek Safar de669c45a1 [mscorlib] Adds PreserveDependencyAttribute 2018-07-16 22:46:08 +02:00
Marek Safar 2e3c4398a9 [corlib] Default to fast Span<T> (#9204) 2018-07-16 22:46:08 +02:00
Marek Safar d7985272b7 [System.Data] Add missing API in PNS version of SqlConnection 2018-07-15 22:25:01 +02:00
Zoltan Varga b9dd9d11a7 [sdb] Add back the mono_debugger_agent_parse_options () API function which was mistakenly removed by #7673. 2018-07-14 20:35:27 +02:00
monojenkins d735f2f104 [2018-06] [sdks] add interp-mixed to iOS SDK (#9514)
* [sdks] add interp-mixed to iOS SDK

AOT compile mscorlib, everything else runs in the interpreter

* [interp] fix class accessor
2018-07-14 10:49:36 +02:00
monojenkins 2214d1fa74 [2018-06] [dist] Ensure gensources.cs is included in tarballs (#9516)
* [dist] Ensure gensources.cs is included in tarballs

* Add gensources.sh
2018-07-14 10:46:25 +02:00
monojenkins c25f8e3289 [arm64] Make OP_CHECK_THIS read only a byte, to prevent unaligned access errors. (#9544) 2018-07-14 10:44:51 +02:00
monojenkins 32ce5c4dfc [2018-06] [interp] Optimise allocation path (#9513)
Backport of #9443.

/cc @marek-safar
2018-07-13 23:15:07 +02:00
Atsushi Eno f126e2e3c7 [sdk] Do not fix android platform-tools version. Make it configurable. 2018-07-13 22:43:46 +02:00
Jay Krell fa45833f9b Restore the ability to regenerate opcode.def form Perl/XML, though CI cannot and does not. 2018-07-13 22:43:09 +02:00
Alexander Köplinger 604d5e516b Merge pull request #9485 from alexanderkyte/2018-06-merp_params
[Backport 2018-06] Add merp parameters
2018-07-12 21:16:21 +02:00
monojenkins 7c379ca7ca [2018-06] [jit] Add Span\u003cT\u003e intrinsics. (#9515)
[2018-06] [jit] Add Span\u003cT\u003e intrinsics.

Backport of #9086.

/cc @marek-safar
2018-07-12 14:55:50 -04:00
Marek Safar d1db5c5c90 [mcs] Implements awaited expression check for indirections 2018-07-12 12:22:49 +02:00
Alexander Kyte 633745f1b7 [runtime] Enable application to register path for MERP restart 2018-07-11 17:12:45 -04:00
Alexander Kyte 81499e9509 [runtime] Make merp eventType icall argument 2018-07-11 17:12:45 -04:00
Zoltan Varga 308794335c Mixed testing
backport of https://github.com/mono/mono/pull/9021
2018-07-11 16:40:42 -04:00
Bernhard Urban 8bb5d2b97e [ios sdk] add interp-only support
backport of https://github.com/mono/mono/pull/9427
2018-07-11 16:40:42 -04:00
Bernhard Urban 28c3ba27b9 [interp] fullaotmixedcheck fixes
backport of https://github.com/mono/mono/pull/9461
2018-07-11 16:40:42 -04:00
Zoltan Varga 78a5be344a [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)
backport of https://github.com/mono/mono/pull/9019
2018-07-11 16:40:42 -04:00
Bernhard Urban a520836ddb [sdks] build more runtimes, simulators and cross compilers on CI 2018-07-11 10:50:25 +02:00
Bernhard Urban a5370bdc53 [bitcode] fix build regression of tvos and watchos
caused by 5e9af502c0
2018-07-11 10:50:25 +02:00
Zoltan Varga 69640dfafd [llvm] Avoid using the preserveall calling convention on watchos, xcode10 asserts on it.
Fixes https://github.com/mono/mono/issues/9318.
2018-07-10 10:59:19 +02:00
Bernhard Urban de745ad3e3 [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-07-10 10:58:34 +02:00
Bernhard Urban 6e514dcc64 [mini] make interp work with AOT image generated with aot=interp
backport of https://github.com/mono/mono/pull/9295
2018-07-10 10:12:19 +02:00
Bernhard Urban adf9b386ad [mini] signature cache does not do need_direct_wrapper and virtual_. but needs info to identify signatures for valuetypes 2018-07-09 18:30:33 +02:00
Bernhard Urban 7c3a3b100e [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-09 18:30:33 +02:00
Alexis Christoforides 2115f2790c Merge pull request #9446 from monojenkins/backport-pr-9440-to-2018-06
[2018-06] Add another Darwin file system
2018-07-06 19:03:17 -04:00
Miguel de Icaza 329ff0292b Add another Darwin file system
This prevents a test failure when Time Machine partitions are mounted on the
host running the test.
2018-07-06 14:49:07 +00:00
Alexander Köplinger 9cf74ba929 Bump bockbuild 2018-07-02 23:17:01 +02:00
monojenkins 972cb658d4 [mini] add workaround for AMD Ryzen Threadripper issue (#9359)
[2018-06] [mini] add workaround for AMD Ryzen Threadripper issue

Backport of #9321.

/cc @lewurm
2018-06-30 08:25:07 -04:00
Marek Safar 6da47b0ac0 [build] Skips RemoteExecuted bases tests on monodroid
The proper implementation will be written later
2018-06-29 14:34:01 +02:00
monojenkins bff2c0f348 [2018-06] [sdks] Only rebuild MXE when it doesn't exist, not when we just cloned the sources (#9366)
* [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-29 14:16:04 +02:00
monojenkins 331fd2a800 [2018-06] Make requested MERP file format changes (#9331)
* [merp] Change and emit event type

* [merp] Change XML file output path
2018-06-28 17:36:03 +02:00
Marek Safar 3a56983dc7 Bump linker 2018-06-28 14:49:14 +02:00
monojenkins 8df9adc649 [runtime] Make mono-state dumper abandon stuck threads (#9272)
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-27 12:29:27 +02:00
monojenkins 04d8499a2f [2018-06] [runtime] Package merp params in 3 ways needed (#9269)
* [runtime] Package merp params in 3 ways needed

* [runtime] Use GUID rather than assembly name in json
2018-06-27 12:29:09 +02:00
Alexander Köplinger ebf5f386c9 Formatting 2018-06-26 13:03:35 +02:00
Kadirov Yurij 907ca9a609 Fixes #9277 with @marek-safar recommendations 2018-06-26 13:03:35 +02:00
Kadirov Yurij 2e15d8e879 Unix-only exception on Windows fix #9277 2018-06-26 13:03:35 +02:00
monojenkins b5483fb5e9 [profiler] account for nullbyte in allocated buffer (#9201)
Backport of #9166.
2018-06-25 23:18:43 +02:00
monojenkins fcc7e6f763 [2018-06] [System]: HttpWebRequest now throws WebExceptionStatus.RequestCanceled on abort. (#9294)
* [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`.

* Fix the incorrect behavior in this test.

Backport of #9212.
2018-06-25 23:17:13 +02:00
monojenkins 18906e7242 [2018-06] [System]: Renegotiation in AppleTls requires OS X 10.12+. (#9255)
* [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

Backport of #9254.
2018-06-25 23:09:57 +02:00
monojenkins d4471210ac [2018-06] [System]: Fix bug in WebResponseStream.GetResponse() that will make some people happy. (#9242)
* [System]Fix bug in `WebResponseStream.GetResponse()` that will make some people happy.

* Cosmetic improvements of the debugging code.
2018-06-22 18:09:46 +02:00
Ankit Jain df1b71eff4 Bump msbuild to track xplat-master (#9247) 2018-06-22 01:12:48 +02:00
Aleksey Kliger 9ec4d30693 [loader] LoadFrom of problematic images should reprobe (correctly)
This reverts commit a2bed67b6b
which itself reverted 9ad5255338

Additionally cherrypick 60f06e6ca2: refonly load
of problematic image is allowed.
2018-06-19 16:41:06 -04:00
Rodrigo Kumpera 3ee5a5cc3d [corlib] Allow DM with an extra param to have the first one bound to null. Fixes #9033. 2018-06-19 10:34:31 +02:00
Bernhard Urban bedea5a1d4 [interp] check existence of InterpMethod before removing it from interp code hastable
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.
2018-06-18 11:24:34 +02:00
monojenkins 4161518777 Bump corefx (#9117)
Backport of #9020.
2018-06-18 10:23:12 +02:00
monojenkins a23bc0b3b4 [System] Fix another SocketAsyncEventArgs issue for #8871. (#9126)
Backport of #8938.
2018-06-18 09:42:15 +02:00
monojenkins 13f3579291 [Linux,XA build] Fix building of Windows cross-compilers on Ubuntu Linux (#9174)
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-16 15:17:29 +02:00
monojenkins d904e6b30d [SDKS,Android] Install cmake when provisioning Android SDK (#9141)
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-16 15:15:48 +02:00
Alexander Köplinger cd81c99bac 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:37:08 +02:00
Rodrigo Kumpera 7627a5f9ee [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-14 15:01:34 +02:00
monojenkins a2bed67b6b Revert "[loader] LoadFrom of problematic images should reprobe" (#9124)
This reverts commit 9ad5255338.
2018-06-14 03:17:39 +02:00
Alexander Köplinger ad32d62aa8 Update csproj files
(cherry picked from commit ae5a579e22)
2018-06-14 01:57:30 +02:00
Jay Krell ea3fb0c68f Disable flaky interp thread6 test. (#9059)
(cherry picked from commit 9bc218dc11)
2018-06-13 15:19:23 +02:00
monojenkins f366f9d224 update to Android P final API. (#9076) 2018-06-12 13:14:15 +02:00
Jo Shields 6da055b9c4 Bump version to 5.16 --> (#9015)
* Bump version to 5.16

* Fix monolite build

(cherry picked from commit 3bc113b6df)
2018-06-04 13:08:10 -07: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
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
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
Marek Safar cc131fedcc [sdks] Fixes llvm branch name (#8926) 2018-05-29 13:08:20 -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
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
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
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
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
2876 changed files with 222836 additions and 133377 deletions

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ 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
=======
+13 -6
View File
@@ -1,3 +1,7 @@
<!--
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.
@@ -5,22 +9,22 @@
3.
<!--
You may drag & drop the attachement (repro code/solution, screenshot, etc.) onto the issue.
You may drag & drop the attachment (repro code/solution, screenshot, etc.) onto the issue.
-->
## Current Behavior
### Current Behavior
<!--
What is the current behavior?
-->
## Expected Behavior
### Expected Behavior
<!--
Please describe the behavior you are expecting
-->
### On which platforms did you notice this
## On which platforms did you notice this
[ ] macOS
[ ] Linux
@@ -32,9 +36,12 @@ Please describe the behavior you are expecting
You can use `mono --version` or About dialog to obtain this information.
-->
### Stacktrace
## Stacktrace
```
Please paste the stacktrace here if available.
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
-->
+3 -1
View File
@@ -40,6 +40,7 @@ Ankh.NoLoad
*.gpState
.vscode/
*.exp
.vs/
# Tooling
_ReSharper*/
@@ -89,6 +90,7 @@ stamp-h.in
*.swp
*.o
.deps
.libs
# Libtool
libtool.m4
@@ -129,4 +131,4 @@ mono-*.tar.*
tmpinst-dir.stamp
msvc/scripts/inputs/
extensions-config.h
*.mlpd
+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
}
+20 -17
View File
@@ -17,7 +17,7 @@
/acceptance-tests @akoeplinger
/acceptance-tests/profiler-stress* @alexrp
/data @marek-safar @akoeplinger
/data @marek-safar @akoeplinger @luhenry
/data/gdb @vargaz
/data/lldb @lewurm @vargaz
@@ -30,14 +30,14 @@
/external/boringssl @baulig
/external/nuget-buildtasks @radical @akoeplinger
/libgc @BrzVlad @vargaz
/libgc @BrzVlad @vargaz @luhenry
/llvm @vargaz
/llvm @vargaz @luhenry
/man @marek-safar @miguel
/man @marek-safar @miguel @luhenry
/man/*prof* @alexrp
/mcs @marek-safar
/mcs @marek-safar @luhenry
/mcs/build @marek-safar @akoeplinger
@@ -89,11 +89,6 @@
/mono/profiler @alexrp @kumpera
/mono/sdks @luhenry
/mono/sdks/android @luhenry @jonpryor
/mono/sdks/ios @vargaz @rolfbjarne
/mono/sdks/wasm @kumpera @lrz
/mono/sgen @BrzVlad @kumpera
/mono/utils @kumpera @vargaz
@@ -103,26 +98,34 @@
/mono/utils/mono-threads* @luhenry @kumpera
/mono/utils/*-win* @lateralusX @kumpera
/msvc @lateralusX
/msvc @lateralusX @luhenry
/msvc/*profiler* @alexrp
/msvc/scripts @akoeplinger
/msvc/scripts @akoeplinger @kg
/packaging/ @alexischr @akoeplinger
/packaging/ @alexischr @akoeplinger @luhenry @directhex
/packaging/MacSDK/msbuild.py @radical @akoeplinger
/runtime @akoeplinger @marek-safar
/runtime @akoeplinger @marek-safar @luhenry
/samples @luhenry
/samples/profiler @alexrp
/samples/size @alexrp
/scripts @akoeplinger
/scripts/ci @akoeplinger
/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
/tools @kumpera @luhenry
/tools/checker @tritao
/tools/crash-bisector @kumpera
/tools/locale-builder @marek-safar
+4 -9
View File
@@ -11,15 +11,9 @@ else
tools_dir = tools
endif
if BUILD_SUPPORT
support_dir = support
else
support_dir =
endif
SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) $(support_dir) data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
SUBDIRS = mk po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
# Keep in sync with SUBDIRS
DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native $(support_dir) data runtime scripts man samples tools msvc docs acceptance-tests llvm
DIST_SUBDIRS = m4 mk po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
all: update_submodules
@@ -150,9 +144,10 @@ update-llvm-version:
update-solution-files:
(pushd msvc/scripts; rm genproj.exe; $(MAKE) genproj.exe; popd)
$(MAKE) update-csproj
$(MAKE) package-inputs
(cd msvc/scripts; $(MAKE) genproj.exe; mono genproj.exe $(GENPROJ_ARGS))
(cd msvc/scripts; mono --debug genproj.exe $(GENPROJ_ARGS))
update-solution-files-with-tests:
$(MAKE) "GENPROJ_ARGS=2012 true true" update-solution-files
+62 -28
View File
@@ -19,30 +19,30 @@ 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]|
_(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 +53,8 @@ _(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
Compilation and Installation
============================
@@ -111,7 +111,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 +128,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 +150,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
====================
@@ -207,12 +241,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`
@@ -541,7 +575,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
============================================
+1 -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
+2 -2
View File
@@ -2,7 +2,7 @@
{
"name": "roslyn",
"url": "git://github.com/mono/roslyn.git",
"rev": "1d9895045041925490038c5df0d8f947d8dcbd7f",
"rev": "380eec412868464a132cdcd3a45ef457fab6e060",
"remote-branch": "origin/mono-testing",
"branch": "mono-testing",
"directory": "roslyn"
@@ -10,7 +10,7 @@
{
"name": "coreclr",
"url": "git://github.com/mono/coreclr.git",
"rev": "83d8279997d8ce4ad344ff9b937b2d13d074dcaa",
"rev": "aa62c0382ae79562293f3ea1a94ef0f16f80f498",
"remote-branch": "origin/mono",
"branch": "mono",
"directory": "coreclr"
+10 -5
View File
@@ -2217,7 +2217,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 \
@@ -3716,7 +3715,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 +3855,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 +3963,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 +3981,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 +4969,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 +5060,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
+56 -15
View File
@@ -57,7 +57,9 @@ namespace Mono.Profiling.Tests.Stress {
"jit",
};
static readonly TimeSpan _timeout = TimeSpan.FromHours (9);
static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
const RegexOptions _regexOptions = RegexOptions.Compiled | RegexOptions.Singleline;
static readonly Dictionary<string, Predicate<Benchmark>> _filters = new Dictionary<string, Predicate<Benchmark>> {
{ "ironjs-v8", FilterNotOnArm },
@@ -89,26 +91,55 @@ namespace Mono.Profiling.Tests.Stress {
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 && IsSupported (b))
.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];
@@ -117,17 +148,24 @@ namespace Mono.Profiling.Tests.Stress {
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{sampleMode}={sampleFreq},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,
@@ -141,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;
@@ -177,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);
@@ -233,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");
+5 -3
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; }
+11296
View File
File diff suppressed because it is too large. Load diff
+924 -163
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"/>
+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>
+1 -1
View File
@@ -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>
+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).
+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)
+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; }
+2 -1
View File
@@ -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. */
+12
View File
@@ -835,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. */
-2
View File
@@ -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 -1
View File
@@ -2,7 +2,7 @@
{
"name": "llvm",
"url": "git://github.com/mono/llvm.git",
"rev": "9f79399f87282524fee099b328bd8cbf07929daf",
"rev": "f80899cb3eb75f7f5640b4519e83bd96991bffb8",
"remote-branch": "origin/master",
"branch": "master",
"directory": "llvm"
+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
])
+113 -17
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
@@ -202,13 +203,31 @@ 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.
@@ -252,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
@@ -340,33 +389,80 @@ not require runtime code generation. The "llvmonly" setting does the same, but f
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
+78 -18
View File
@@ -65,6 +65,45 @@ and
See the description for
.B MONO_IOMAP
in the environment variables section for more details.
.SH METHOD DESCRIPTIONS
A number of diagnostic command line options take as argument a method
description. A method description is a textual representation that
can be used to uniquely identify a method. The syntax is as follows:
.nf
[namespace]classname:methodname[(arguments)]
.fi
.PP
The values in brackets are optional, like the namespace and the
arguments. The arguments themselves are either empty, or a
comma-separated list of arguments. Both the
\fBclassname\fR
and
\fBmethodname\fR
can be set to the special value '*' to match any values (Unix shell
users should escape the argument to avoid the shell interpreting
this).
.PP
The arguments, if present should be a comma separated list of types
either a full typename, or for built-in types it should use the
low-level ILAsm type names for the built-in types,
like 'void', 'char', 'bool', 'byte', 'sbyte', 'uint16', 'int16', 'uint',
'int', 'ulong', 'long', 'uintptr', 'intptr', 'single', 'double', 'string', 'object'.
.PP
Pointer types should be the name of the type, followed by a '*',
arrays should be the typename followed by '[' one or more commas (to
indicate the rank of the array), and ']'.
.PP
Generic values should use '<', one or more type names, separated by
both a comma and a space and '>'.
.PP
By-reference arguments should include a "&" after the typename.
.PP
Examples:
.nf
*:ctor(int) // All constructors that take an int as an argument
*:Main // Methods named Main in any class
*:Main(string[]) // Methods named Main that take a string array in any class
.fi
.SH RUNTIME OPTIONS
The following options are available:
.TP
@@ -175,6 +214,13 @@ and
.I llvm
options. This feature is experimental.
.TP
.I llvmopts=[options]
Use this option to override the built-in set of flags passed to the
LLVM optimizer. The list of possible flags that can be passed can be
obtained by calling the bundled
.I opt
program that comes with Mono.
.TP
.I llvm-outfile=[filename]
Gives the path for the temporary LLVM bitcode file created during AOT.
.I dedup
@@ -432,6 +478,9 @@ in your program, or Mono's class libraries attempts to generate code
dynamically. You should test your software upfront and make sure that
you do not use any dynamic features.
.TP
\fB--full-aot-interp\fR
Same as --full-aot with fallback to the interpreter.
.TP
\fB--gc=boehm\fR, \fB--gc=sgen\fR
Selects the Garbage Collector engine for Mono to use, Boehm or SGen.
Currently this merely ensures that you are running either the
@@ -542,6 +591,11 @@ Controls whether the runtime should attempt to inline (the default),
or not inline methods invocations
.ne
.RE
\fB--response=FILE\fR
Provides a response file, this instructs the Mono command to read
other command line options from the specified file, as if the
options had been specified on the command line. Useful when you have
very long command lines.
.TP
\fB--runtime=VERSION\fR
Mono supports different runtime versions. The version used depends on the program
@@ -1087,14 +1141,12 @@ When Mono is built with a soft float fallback on ARM and this variable is set to
"1", Mono will always emit soft float code, even if a VFP unit is
detected.
.TP
\fBMONO_DARWIN_WATCHER_MAXFDS\fR
This is a debugging aid used to force limits on the FileSystemWatcher
implementation in Darwin. There is no limit by default.
\fBMONO_DARWIN_USE_KQUEUE_FSW\fR
Fall back on the kqueue FileSystemWatcher implementation in Darwin. The default is the FSEvent implementation.
.TP
\fBMONO_DISABLE_AIO\fR
If set, tells mono NOT to attempt using native asynchronous I/O services. In
that case, a default select/poll implementation is used. Currently only epoll()
is supported.
\fBMONO_DARWIN_WATCHER_MAXFDS\fR
This is a debugging aid used to force limits on the kqueue FileSystemWatcher
implementation in Darwin. There is no limit by default.
.TP
\fBMONO_DISABLE_MANAGED_COLLATION\fR
If this environment variable is `yes', the runtime uses unmanaged
@@ -1121,7 +1173,12 @@ For platforms that do not otherwise have a way of obtaining random bytes
this can be set to the name of a file system socket on which an egd or
prngd daemon is listening.
.TP
\fBMONO_ENABLE_COOP\fR
\fBMONO_ENABLE_AIO\fR
If set, tells mono to attempt using native asynchronous I/O services. If not
set, a default select/poll implementation is used. Currently epoll and kqueue
are supported.
.TP
\fBMONO_ENABLE_COOP_SUSPEND\fR
This makes the Mono runtime and the SGen garbage collector run in cooperative
mode as opposed to run on preemptive mode. Preemptive mode is the mode
that Mono has used historically, going back to the Boehm days, where the
@@ -1132,7 +1189,7 @@ safe point. This makes for an easier to debug garbage collector. As
of Mono 4.3.0 it is a work in progress, and while it works, it has not
been used extensively. This option enabled the feature and allows us to
find spots that need to be tuned for this mode of operation. Alternatively,
this mode can be enabled at compile time by using the --with-cooperative-gc
this mode can be enabled at compile time by using the --enable-cooperative-suspend
flag when calling configure.
.TP
\fBMONO_ENV_OPTIONS\fR
@@ -1557,12 +1614,6 @@ home directories that might be shared over the network.
If set, extra checks are made during IO operations. Currently, this
includes only advisory locks around file writes.
.TP
\fBMONO_THEME\fR
The name of the theme to be used by Windows.Forms. Available themes today
include "clearlooks", "nice" and "win32".
.Sp
The default is "win32".
.TP
\fBMONO_TLS_SESSION_CACHE_TIMEOUT\fR
The time, in seconds, that the SSL/TLS session cache will keep it's entry to
avoid a new negotiation between the client and a server. Negotiation are very
@@ -1615,8 +1666,8 @@ Currently, the following options are supported:
Enables small structs alignment to 4/8 bytes.
.TP
\fBarm-use-fallback-tls\fR
When this option is set on ARM, a fallback TLS will be used instead
of the default fast TLS.
When this option is set on ARM, a fallback thread local store will be used instead
of the default fast thread local storage primitives.
.TP
\fBbreak-on-unverified\fR
If this variable is set, when the Mono VM runs into a verification
@@ -1745,6 +1796,12 @@ This option will suspend the program when an exception occurs.
.TP
\fBsuspend-on-unhandled\fR
This option will suspend the program when an unhandled exception occurs.
.TP
\fBthread-dump-dir=DIR\fR
Use DIR for storage thread dumps created by SIGQUIT.
.TP
\fBverbose-gdb\fR
Make gdb output on native crashes more verbose.
.ne
.RE
.TP
@@ -1826,7 +1883,10 @@ for example, to see managed frame names on gdb backtraces.
\fBMONO_VERBOSE_METHOD\fR
Enables the maximum JIT verbosity for the specified method. This is
very helpfull to diagnose a miscompilation problems of a specific
method.
method. This can be a comma-separated list of method names to
match. If the name is simple, this applies to any method with that
name, otherwise you can use a mono method description (see the section
METHOD DESCRIPTIONS).
.TP
\fBMONO_JIT_DUMP_METHOD\fR
Enables sending of the JITs intermediate representation for a specified
+1
View File
@@ -12,6 +12,7 @@ TestResult-*.xml
TestResult*.xml
.dep_dirs-*
apidiff/*
csprojdiff/*
errors/*.log
errors/dummy.xml
class/Mono.Data.Sqlite/test.db
+15 -3
View File
@@ -47,7 +47,7 @@ all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
@:
profiles-do--%:
$(MAKE) $(PROFILES:%=profile-do--%--$*)
$(if $(PROFILES),$(MAKE) $(PROFILES:%=profile-do--%--$*))
# The % below looks like profile-name--target-name
profile-do--%:
@@ -152,9 +152,13 @@ MONO_API_ASSEMBLIES_IGNORED := $(addprefix $(topdir)class/lib/$(PROFILE)/, Mono.
MONO_API_ASSEMBLIES := $(filter-out $(MONO_API_ASSEMBLIES_IGNORED), $(wildcard $(topdir)class/lib/$(PROFILE)/*.dll)) $(wildcard $(topdir)class/lib/$(PROFILE)/Facades/*.dll)
MONO_API_ASSEMBLIES_CS := $(MONO_API_ASSEMBLIES:$(topdir)class/lib/$(PROFILE)/%.dll=$(MONO_API_SNAPSHOT_PROFILE_PATH)%.cs)
$(MONO_API_SNAPSHOT_PROFILE_PATH)%.cs: $(topdir)class/lib/$(PROFILE)/%.dll $(GENAPI) $(MONO_API_SNAPSHOT_PATH)profiles/license-header.txt
apidiff/ignored-attr.txt:
@mkdir -p $(dir $@)
$(Q) MONO_PATH=$(topdir)class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(GENAPI) -libPath:$(topdir)class/lib/$(PROFILE),$(topdir)class/lib/$(PROFILE)/Facades -out:$(dir $@) -headerFile:$(MONO_API_SNAPSHOT_PATH)profiles/license-header.txt -assemblyAttributes -typeForwardedTo -assemblyVersion -assembly:$< || echo "Couldn't process assembly." > $@
@echo "T:System.Runtime.CompilerServices.CompilerGeneratedAttribute" > $@
$(MONO_API_SNAPSHOT_PROFILE_PATH)%.cs: $(topdir)class/lib/$(PROFILE)/%.dll $(GENAPI) $(MONO_API_SNAPSHOT_PATH)profiles/license-header.txt apidiff/ignored-attr.txt
@mkdir -p $(dir $@)
$(Q) MONO_PATH=$(topdir)class/lib/$(BUILD_TOOLS_PROFILE) $(RUNTIME) $(GENAPI) -libPath:$(topdir)class/lib/$(PROFILE),$(topdir)class/lib/$(PROFILE)/Facades -out:$(dir $@) -headerFile:$(MONO_API_SNAPSHOT_PATH)profiles/license-header.txt -assemblyAttributes -typeForwardedTo -assemblyVersion -excludeAttributesList:apidiff/ignored-attr.txt -assembly:$< || echo "Couldn't process assembly." > $@
mono-api-current: $(MONO_API_ASSEMBLIES_CS)
@@ -175,3 +179,11 @@ mono-api-diff:
@mkdir -p apidiff
$(Q) sed -e "/@diffdata@/r temp.patch" -e "/@diffdata@/d" -e "s/@title@/Public API Diff/g" -e "s/@description@/If the changes are intentional, run <code>make -C mcs mono-api-diff<\/code> locally and commit changes in external\/api-snapshot./g" diff.html.in > apidiff/index.html
$(Q) if [ -s temp.patch ]; then echo "Error: Found public API differences, see mcs/apidiff/index.html. If the changes are intentional, please go to external/api-snapshot and commit them."; rm -f temp.patch; exit 1; else echo "No differences found."; rm -f temp.patch; fi
mono-csproj-diff:
@echo "Generating csproj diff..."
$(Q) git add -A "*.csproj" $(topdir)../bcl.sln
$(Q) git diff --no-renames HEAD "*.csproj" $(topdir)../bcl.sln > $(abspath $(topdir))/temp.patch
@mkdir -p csprojdiff
$(Q) sed -e "/@diffdata@/r temp.patch" -e "/@diffdata@/d" -e "s/@title@/Project Files Diff/g" -e "s/@description@/Use <code>@monojenkins commit csproj<\/code> to commit them./g" diff.html.in > csprojdiff/index.html
$(Q) if [ -s temp.patch ]; then echo "Error: Found csproj differences, see mcs/csprojdiff/index.html. If the changes are intentional, please commit them."; rm -f temp.patch; exit 1; else echo "No differences found."; rm -f temp.patch; fi
+2 -1
View File
@@ -33,7 +33,7 @@ COMMON_SRCS = \
AssemblyRef.cs
DISTFILES = \
README.makefiles \
README.makefiles.md \
README.platforms \
README.configury \
config-default.make \
@@ -41,6 +41,7 @@ DISTFILES = \
corcompare-api.xsl \
executable.make \
gensources.sh \
gensources.cs \
library.make \
rules.make \
tests.make \
@@ -1,25 +1,25 @@
The MCS makefiles (-*- outline -*-)
Peter Williams <peter@newton.cx>
# The MCS makefiles
Author: Peter Williams <peter@newton.cx>
The new makefiles try to abstract building on Windows and Linux. They
try to provide a consistent set of ways to express the things that our
build system needs to let us do, specifically:
* Build recursively
* Build libraries and executables easily
* Let developers use different runtimes and class libaries
* Make distributions easily
* Provide a framework for testing
* Build platform-independently whenever possible
* Generate, update, and build monodoc documentation.
* Build recursively
* Build libraries and executables easily
* Let developers use different runtimes and class libaries
* Make distributions easily
* Provide a framework for testing
* Build platform-independently whenever possible
* Generate, update, and build monodoc documentation.
** Makefile structure
Makefile structure
==================
A general makefile looks like this:
========================================
```
thisdir = class/Mono.My.Library
SUBDIRS =
include ../../build/rules.make
@@ -50,59 +50,60 @@ doc-update-local:
my_test_program.exe: my_test_source.cs
$(CSCOMPILE) /target:exe /out:$@ $<
========================================
```
Each makefile follows the same pattern: it does some setup, includes
the standard make rules, and provides rules for eight standard targets:
all, install, test, run-test, clean, dist, and doc-update.
`all`, `install`, `test`, `run-test`, `clean`, `dist`, and `doc-update`.
"Some setup" is defining two variables: $(thisdir) and
$(SUBDIRS). $(thisdir) is the directory that the makefile lives in,
relative to the top directory (ie, class/corlib) and $(SUBDIRS)
"Some setup" is defining two variables: `$(thisdir)` and
`$(SUBDIRS)`. `$(thisdir)` is the directory that the makefile lives in,
relative to the top directory (ie, `class/corlib`) and `$(SUBDIRS)`
defines the subdirectories that should be built in.
The eight targets do the following:
* all-local builds whatever someone would expect to be built
when they just type 'make'. Most likely Foo.dll or Foo.exe
* `all-local` builds whatever someone would expect to be built
when they just type `make'` Most likely `Foo.dll` or `Foo.exe`
* install-local installs whatever got built by all-local.
* `install-local` installs whatever got built by `all-local`.
* test-local _builds_ the test programs or libraries but does
_not_ run them.
* `test-local` _builds_ the test programs or libraries but does
_not_ run them.
* run-test-local actually runs the tests. It shouldn't
necessarily exit in an error if the test fails, but should make that
situation obvious. It should only run tests that take care of
themselves automatically; interactive tests should have an individual
target. The idea is that 'make run-test' from the toplevel should be
able to proceed unsupervised and test everything that can be tested in
such a manner.
* `run-test-local` actually runs the tests. It shouldn't
necessarily exit in an error if the test fails, but should make that
situation obvious. It should only run tests that take care of
themselves automatically; interactive tests should have an individual
target. The idea is that `make run-test` from the toplevel should be
able to proceed unsupervised and test everything that can be tested in
such a manner.
* run-test-ondotnet-local is a variant of run-test-local. It is used only to validate if our tests themselves works fine under Microsoft runtime (on Windows). Basically, in this target, we should not use $(TEST_RUNTIME) to test our libraries.
* `run-xunit-test-local` this is a variation of the above, but it runs the
tests that were built with Xunit instead of NUnit.
* clean-local removes built files; 'make clean' should leave
only files that go into a distribution tarball. (But it is not necessarily
true that all files that go into a tarball need to be left after a make clean.)
* `run-test-ondotnet-local` is a variant of `run-test-local`. It is used only to validate if our tests themselves works fine under Microsoft runtime (on Windows). Basically, in this target, we should not use $(TEST_RUNTIME) to test our libraries.
* dist-local copies files into the distribution tree, which is
given by the variable $(distdir). dist-local always depends on the
target 'dist-default'. See ** 'make dist' below.
* `clean-local` removes built files; `make clean` should leave
only files that go into a distribution tarball. (But it is not
necessarily true that all files that go into a tarball need to be left
after a make clean.)
* doc-update-local should generate or update monodoc documentation,
if appropriate. This is usually only appropriate for libraries. It's
defined as a standard target so that it can easily be run recursively
across all libraries within the module.
* `dist-local` copies files into the distribution tree, which is
given by the variable `$(distdir)`. `dist-local` always depends on the
target `dist-default`. See ** `make dist` below.
* `doc-update-local` should generate or update monodoc documentation,
if appropriate. This is usually only appropriate for libraries. It's
defined as a standard target so that it can easily be run recursively
across all libraries within the module.
** Build configuration
Build configuration
===================
In general, MCS needs to be able to build relying only on the
existence of a runtime and core libraries (corlib, System,
System.Xml). So there shouldn't be any checking for libraries or
existence of a runtime and core libraries (`mscorlib`, `System`,
`System.Xml`). So there shouldn't be any checking for libraries or
whatnot; MCS should be able to build out of the box. We try to keep
platform detection and feature testing (ie, for HP/UX echo) inside
the makefiles; right now, there's no configuration script, and it'd
@@ -115,41 +116,37 @@ customize their builds to suit their needs. To allow this, the
Makefile rules are set up to allow people to override pretty much any
important variable.
Configuration variables are given defaults in `config-default.make';
`rules.make' optionally includes `$(topdir)/build/config.make', so you
Configuration variables are given defaults in `config-default.make`;
`rules.make` optionally includes `$(topdir)/build/config.make`, so you
can customize your build without CVS trying to commit your modified
`config-default.make' all the time. Platform-specific variables are
defined in `$(topdir)/build/platforms/$(BUILD_PLATFORM).make', where
$(BUILD_PLATFORM) is detected in config-default.make. (Currently, the only
choices are linux.make and win32.make.)
`config-default.make` all the time. Platform-specific variables are
defined in `$(topdir)/build/platforms/$(BUILD_PLATFORM).make`, where
`$(BUILD_PLATFORM)` is detected in `config-default.make`. (Currently, the only
choices are `linux.make` and `win32.make`)
The best way to learn what the configuration variables are is to read
`config.make' and `platform.make'. There aren't too many and hopefully
`config.make` and `platform.make`. There aren't too many and hopefully
they should be self-explanatory; see the numerous examples below for
more information if you're confused.
** Recommendations for platform specifics
Recommendations for platform specifics
--------------------------------------
If you find yourself needing a platform-specific customization, try
and express it in terms of a feature, rather than a platform test. In
other words, this is good:
========================================
```
run-test-local: my-test.exe
ifdef PLATFORM_NEEDS_CRAZY_CRAP
crazy-crap
endif
$(RUNTIME) my-test.exe
========================================
```
and this is bad:
========================================
```
run-test-local: my-test.exe
ifdef WINDOWS
crazy-crap
@@ -159,7 +156,7 @@ ifdef AMIGA
endif
endif
$(RUNTIME) my-test.exe
========================================
```
The latter accumulates and gets unpleasant and it sucks. Granted,
right now we only have two platforms, so it's not a big deal, but it's
@@ -168,88 +165,79 @@ do the various corlib building hacks for examples of how we've done
platform-specificity. It certainly isn't pretty, but at least it's a
little structured.
Saving effort
=============
** Saving effort
The point of the build system is to abstract things and take
The point of the build system is to abstract things and take
care of all the easy stuff. So if you find yourself writing a
Makefile, know that there's probably already infrastructure to do what
you want. Here are all the common cases I can think of ...
you want. Here are all the common cases I can think of.
Compiling C# code? use:
-----------------------
* Compiling C# code? use:
========================================
```
my-program.exe: my-source.cs
$(CSCOMPILE) /target:exe /out:$@ $^
========================================
```
or
or
========================================
```
my-lib.dll: my-source.cs
$(CSCOMPILE) /target:library /out:$@ $^
========================================
```
Note the '$@' and '$^' variables. The former means "the name of the
Note the `$@` and `$^` variables. The former means "the name of the
file that I am trying to make" and the latter means "all the
dependencies of the file I am trying to make." USE THESE VARIABLES
AGGRESSIVELY. Say that you add a new source to your program:
========================================
```
my-program.exe: my-source.cs my-new-source.cs
$(CSCOMPILE) /target:exe /out:$@ $^
========================================
```
Because of the $^ variable, you don't need to remember to add another
file to the command line. Similarly, if you rename your program, you
won't need to remember to change the rule:
========================================
```
MonoVaporizer.exe: my-source.cs my-new-source.cs
$(CSCOMPILE) /target:exe /out:$@ $^
========================================
```
will still work. Another useful variable is $<, which means "the first
dependency of whatever I'm building." If you order your dependencies
carefully it can be extremely useful.
Just building an executable?
----------------------------
Then use:
* Just building an executable? use:
========================================
```
PROGRAM = myprogram.exe
LOCAL_MCS_FLAGS = /r:System.Xml.dll
include ../build/executable.make
========================================
```
executable.make builds a program in the current directory. Its name is
held in $(PROGRAM), and its sources are listed in the file
$(PROGRAM).sources. It might seem to make more sense to just list the
held in `$(PROGRAM)`, and its sources are listed in the file
`$(PROGRAM).sources`. It might seem to make more sense to just list the
program's sources in the Makefile, but when we build on Windows we
need to change slashes around, which is much easier to do if the
sources are listed in a file. The variable $(LOCAL_MCS_FLAGS) changes
the flags given to the compiler; it is included in $(CSCOMPILE) so you
sources are listed in a file. The variable `$(LOCAL_MCS_FLAGS)` changes
the flags given to the compiler; it is included in `$(CSCOMPILE)` so you
don't need to worry about it.
executable.make does a lot for you: it builds the program in 'make
all-local', installs the program in $(prefix)/bin, distributes the
`executable.make` does a lot for you: it builds the program in 'make
all-local', installs the program in `$(prefix)/bin`, distributes the
sources, and defines empty test targets. Now, if your program has a
test, set the variable HAS_TEST:
test, set the variable `HAS_TEST`:
========================================
```
PROGRAM = myprogram.exe
LOCAL_MCS_FLAGS = /r:System.Xml.dll
HAS_TEST = yes
@@ -262,30 +250,30 @@ run-test-local: mytester.exe
mytester.exe: mytester.cs
$(CSCOMPILE) /target:exe /out:$@ mytester.cs
========================================
```
If your program has NUnit tests, set the variable HAS_NUNIT_TEST:
If your program has NUnit tests, set the variable `HAS_NUNIT_TEST`:
========================================
```
PROGRAM = myprogram.exe
LOCAL_MCS_FLAGS = /r:System.Xml.dll
HAS_NUNIT_TEST = yes
include ../build/executable.make
========================================
```
HAS_NUNIT_TEST tests follow library.make NUnit test conventions:
the files should be in a subdirectory called Test/, and if
your program is called myprogram.exe, they should be listed in
myprogram_test.dll.sources. The names in that files should *not* have
the Test/ prefix. 'make test' will build myprogram_test_$(PROFILE).dll
`HAS_NUNIT_TEST` tests follow `library.make` NUnit test conventions:
the files should be in a subdirectory called `Test/`, and if
your program is called `myprogram.exe`, they should be listed in
`myprogram_test.dll.sources`. The names in that files should *not* have
the `Test/` prefix. `make test'`will build `myprogram_test_$(PROFILE).dll`
in the current directory, automatically supplying the flags to
reference the original program and NUnit.Framework.dll.
reference the original program and `NUnit.Framework.dll`.
If your program has 'built sources', that is, source files generated
from other files (say, generated by jay), define a variable called
BUILT_SOURCES and do *not* list the sources in $(PROGRAM).sources:
`BUILT_SOURCES` and do *not* list the sources in `$(PROGRAM).sources`:
========================================
```
PROGRAM = myprogram.exe
LOCAL_MCS_FLAGS = /r:System.Xml.dll
BUILT_SOURCES = parser.cs
@@ -295,100 +283,96 @@ include ../build/executable.make
parser.cs: parser.jay
$(topdir)/jay/jay $< > $@
========================================
```
executable.make will automatically delete the $(BUILT_SOURCES) files
on 'make clean'. Since this situation is a common occurrence and jay
`executable.make` will automatically delete the `$(BUILT_SOURCES)` files
on `make clean`. Since this situation is a common occurrence and jay
happens to leave behind y.output files, you can also define a variable
called $(CLEAN_FILES) that lists extra files to be deleted when 'make clean' is
called. (That's in addition to your executable and the built sources).
called `$(CLEAN_FILES)` that lists extra files to be deleted when
`make clean` is called. (That's in addition to your executable and the built sources).
Buildling a library? Use
------------------------
* Buildling a library? Use
========================================
```
LIBRARY = Mono.MyLib.dll
LIB_MCS_FLAGS = /unsafe
TEST_MCS_FLAGS = /r:System.Xml.dll
include ../../build/library.make
========================================
```
Where you library is called $(LIBRARY); it will be put into
$(topdir)/class/lib. LIB_MCS_FLAGS is the set of MCS flags to use when
Where you library is called `$(LIBRARY)`; it will be put into
`$(topdir)/class/lib`. `LIB_MCS_FLAGS` is the set of MCS flags to use when
compiling the library; in addition, a global set of flags called
$(LIBRARY_FLAGS) is added (that variable is defined in
config-defaults.make), as well as the usual $(LOCAL_MCS_FLAGS).
`$(LIBRARY_FLAGS)` is added (that variable is defined in
`config-defaults.make`), as well as the usual `$(LOCAL_MCS_FLAGS)`.
As in executable.make, the sources for your library are listed in
$(LIBRARY).sources. Note: these source lists should have Unix forward
As in `executable.make`, the sources for your library are listed in
`$(LIBRARY).sources`. Note: these source lists should have Unix forward
slashes and Unix newlines (\n, not \r\n.) If you get an error about
"touch: need a filename", that means your .sources file doesn't end in
a newline. It should.
Now library.make also assumes that your library has an NUnit2 test
harness. The files should be in a subdirectory called Test/, and if
your library is called Mono.Foo.dll, they should be listed in
Mono.Foo_test.dll.sources. The names in that files should *not* have
the Test/ prefix. 'make test' will build Mono.Foo_test.dll in the
Now `library.make` also assumes that your library has an NUnit2 test
harness. The files should be in a subdirectory called `Test/`, and if
your library is called `Mono.Foo.dll`, they should be listed in
`Mono.Foo_test.dll.sources`. The names in that files should *not* have
the `Test/` prefix. `make test` will build `Mono.Foo_test.dll` in the
current directory, automatically supplying the flags to reference the
original library and NUnit.Framework.dll.
original library and `NUnit.Framework.dll`.
If you don't have a test, just do this:
========================================
```
LIBRARY = Mono.MyLib.dll
LIB_MCS_FLAGS = /unsafe
NO_TEST = yes
include ../../build/library.make
========================================
```
and feel ashamed. Every good library has a test suite!
Extra flags needed to compile the test library should be listed in
$(TEST_MCS_FLAGS); often you will have a line like this:
========================================
```
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
========================================
```
Again, library.make does a lot for you: it builds the dll, it
Again, `library.make` does a lot for you: it builds the dll, it
generates makefile fragments to track the dependencies, it installs
the library, it builds the test dll on 'make test', it runs
$(TEST_HARNESS) on it on 'make run-test', it removes the appropriate
the library, it builds the test dll on `make test`, it runs
`$(TEST_HARNESS)` on it on `make run-test`, it removes the appropriate
files on 'make clean', and it distributes all the source files on
'make dist'. (TEST_HARNESS defaults to be nunit-console.exe but it may
be overridden to, say, nunit-gtk). If you have extra files to
distribute when using either library.make or executable.make, use the
variable $(EXTRA_DISTFILES):
`make dist`. (`TEST_HARNESS` defaults to be `nunit-console.exe` but it may
be overridden to, say, `nunit-gtk`). If you have extra files to
distribute when using either `library.make` or `executable.make`, use the
variable `$(EXTRA_DISTFILES)`:
========================================
```
EXTRA_DISTFILES = \
Test/testcase1.in \
Test/testcase1.out \
README
========================================
```
Again, library.make and executable.make do the right things so that we
Again, `library.make` and `executable.make` do the right things so that we
can build on Windows, doing some trickery to invert slashes and
overcome command-line length limitations. Use them unless you have a
really good reason not to. If you're building a bunch of small
executables, check out tools/Makefile or tools/security/Makefile; if
executables, check out `tools/Makefile` or `tools/security/Makefile`; if
all the files are in the current directory, changing slashes isn't a
big deal, and command-line lengths won't be a problem, so
executable.make isn't necessary (and indeed it won't work, since it
can only build one .exe in a directory).
If you're building a library, library.make is highly recommended; the
If you're building a library, `library.make` is highly recommended; the
only DLL that doesn't use it is corlib, because building corlib is a
fair bit more complicated than it should be. Oh well.
library.make also automatically supports generating and updating
`library.make` also automatically supports generating and updating
monodoc documentation. Documentation is stored within the
Documentation directory (a sibling to the Test directory), and is
generated/updated whenever the doc-update target is executed.
@@ -396,19 +380,15 @@ Assembling of the documentation so that the monodoc browser can
display the documentation is handled separately within the mcs/docs
all-local target; see mcs/docs/Makefile for details.
Running a C# program? Use $(RUNTIME)
------------------------------------
* Running a C# program? Use $(RUNTIME)
========================================
```
run-test-local: myprog.exe
$(RUNTIME) myprog.exe
========================================
```
$(RUNTIME) might be empty (if you're on windows), so don't expect to
`$(RUNTIME)` might be empty (if you're on windows), so don't expect to
be able to give it any arguments. If you're on a platform which has an
interpreter or jitter, $(RUNTIME_FLAGS) is included in $(RUNTIME), so
set that variable.
@@ -418,7 +398,8 @@ just "mono --debug".
* Calling the compiler directly? Use $(MCS).
Calling the compiler directly? Use $(MCS).
------------------------------------------
Really, you should use $(CSCOMPILE) whenever possible, but $(MCS) is
out there. $(BOOTSTRAP_MCS) is the C# compiler that we use to build
@@ -426,17 +407,15 @@ mcs.exe; on Linux, we then use mcs.exe to build everything else, but
on Windows, we use csc.exe to build everything. Only use
$(BOOTSTRAP_MCS) if you know what you're doing.
* Compiling C code? Use $(CCOMPILE)
Compiling C code? Use $(CCOMPILE)
---------------------------------
To give it flags, set $(LOCAL_CFLAGS). As with compiling C#, the
variable $(CFLAGS) will automatically be included on the command line.
* Compiling resources with resgen
Compiling resources with resgen
-------------------------------
If you have a resource that should be compiled with resgen and
included in your assembly, you can use the RESOURCES_DEFS variable.
@@ -447,7 +426,8 @@ the file name, like this:
RESOURCE_DEFS = Messages,TextResources.resx Errors,ErrorList.txt
* Documentation-related needs? Use $(MDOC)
Documentation-related needs? Use $(MDOC)
----------------------------------------
$(MDOC) is a front-end to the monodoc documentation system, supporting
documentation generation, updating, importing from Microsoft XML
@@ -458,20 +438,16 @@ documentation to various other output formats such as static HTML.
It is currently only used for library.make's doc-update-local target
and for assembling documentation within $topdir/docs.
* Installing files? Use $(MKINSTALLDIRS), $(INSTALL_DATA) or
$(INSTALL_BIN), $(prefix), and $(DESTDIR).
Installing files? Use $(MKINSTALLDIRS), $(INSTALL_DATA) or $(INSTALL_BIN), $(prefix), and $(DESTDIR).
-----------------------------------------------------------------------------------------------------
Every time a file is installed the commands should look like this:
========================================
```
install-local:
$(MKINSTALLDIRS) $(DESTDIR)$(prefix)/my/dir
$(INSTALL_DATA) myfile $(DESTDIR)$(prefix)/my/dir
========================================
```
This way the directory is created recursively if needed (admittedly, we could
probably rely on mkdir -p), the file is given the correct permissions,
@@ -480,22 +456,19 @@ and we can support $(DESTDIR) installs. We use $(DESTDIR) to make
monocharge tarballs, and it's useful otherwise, so try and use it
consistently.
* 'make dist'? Use $(DISTFILES)
'make dist'? Use $(DISTFILES)
-----------------------------
The 'dist-default' target will copy the files listed in $(DISTFILES)
into the distribution directory, as well as Makefile and ChangeLog if
they exist. This is almost always all that you need, so ideally your
make dist support should only be:
========================================
```
DISTFILES = README Test/thoughts.txt
dist-local: dist-default
========================================
```
DISTFILES will cope correctly with files in subdirectories, by the
way. Note that if you put a nonexistant file or a directory in
@@ -503,10 +476,10 @@ DISTFILES it will *not* complain; it will just ignore it.
If you want to test your 'make dist' code, you can try
========================================
```
$ cd class/Mono.MyClass
$ make dist-local distdir=TEST
========================================
```
And your files should be copied into TEST/ in the current directory.
There is a toplevel 'make distcheck' target, which will build a dist
@@ -516,28 +489,21 @@ files originally in the tarball: they should be the same. But this
takes about 15 minutes to run on my 1.1 Ghz computer, so it's not for
the faint of heart.
* Lots of files? Use $(wildcard *.foo)
Lots of files? Use $(wildcard *.foo)
------------------------------------
When specifying the sources to a library or executable, wildcards are
not encouraged; in fact they're not allowed if you use library.make or
executable.make. But there are times when they're useful, eg:
========================================
```
DISTFILES = $(wildcard Test/*.in) $(wildcard Test/*.out)
========================================
```
Just so you know that 'make' has this feature.
Just so you know that `make` has this feature.
* Referencing files in other directories? Use $(topdir).
Referencing files in other directories? Use $(topdir).
------------------------------------------------------
$(topdir) is the path to the top directory from the current build
directory. Basically it's a sequence of ../.. computed from the value
@@ -545,19 +511,15 @@ that you give $(thisdir) at the top of your Makefile. Try to reference
things from $(topdir), so your code can be moved or cut-and-pasted
around with a minimum of fuss.
* Conditional building? Use ifdef/ifndef/endif
Conditional building? Use ifdef/ifndef/endif
--------------------------------------------
Now in general we want to avoid conditional building, but sometimes
something doesn't work on Linux or already exists on Windows or
whatnot. (See below on recommended form for how to build
platform-specifically.) GNU Make supports the following construction:
========================================
```
BUILD_EXPERIMENTAL = yes
ifdef BUILD_EXPERIMENTAL
@@ -567,13 +529,13 @@ experimental_stuff =
endif
all-local: my-sane.exe $(experimental_stuff)
========================================
```
'ifdef' means 'if the variable is set to nonempty', so you could have
========================================
```
BUILD_EXPERIMENTAL = colorless green ideas sleep furiously
========================================
```
and Make would be happy. I hope that the meaning of 'ifndef' should be
obvious. If you want to only sometimes build a target, the above
@@ -584,10 +546,8 @@ If you want to see why conditionals aren't nice, take a look at
library.make or class/corlib/Makefile.
* 'Private' directories that shouldn't be built by default? Use DIST_ONLY_SUBDIRS
'Private' directories that shouldn't be built by default? Use DIST_ONLY_SUBDIRS
--------------------------------------------------------------------------------
Several of the MCS class libraries have demo or experimental
implementations that depend on things not included with MCS (say,
@@ -613,7 +573,7 @@ a demo app using Gtk# called MyFancyDemo. The Makefile rules might
look like this:
class/Mono.MyFancyLib/Makefile
========================================
```
thisdir = class/Mono.MyFancyLib
SUBDIRS =
DIST_ONLY_SUBDIRS = MyFancyDemo
@@ -624,10 +584,10 @@ LIB_MCS_FLAGS = /r:System.dll
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
include ../../build/library.make
========================================
```
class/Mono.MyFancyLib/MyFancyDemo/Makefile
========================================
```
thisdir = class/Mono.MyFancyLib/MyFancyDemo
SUBDIRS =
include ../../../build/rules.make
@@ -636,36 +596,41 @@ PROGRAM = FancyDemo.exe
LOCAL_MCS_FLAGS = /r:gtk-sharp.dll
include ../../../build/executable.make
========================================
```
* Special recursion needs?
Special recursion needs?
------------------------
By default, rules.make defines the all, install, clean, etc. targets
to look something like this:
```
all: all-recursive
$(MAKE) all-local
```
Sometimes that doesn't cut it; say for example you want to check for
something before doing a lengthy recursive build (see
$(topdir)/Makefile) or you have a something like this
```
class/MyLibrary:
Build MyLibrary.dll
class/MyLibrary/Test:
Build TestMyLibrary.exe
```
'make clean test' will fail here, because the build will happen in
the Test subdirectory first, so there will be no MyLibrary.dll to link
`make clean test` will fail here, because the build will happen in
the Test subdirectory first, so there will be no `MyLibrary.dll` to link
against. (Unless you write a nasty evil relative path rule which is
strongly discouraged.)
Anyway, to solve this problem you can do
========================================
```
thisdir = class/MyLibrary
SUBDIRS = Test
include ../../build/rules.make
@@ -676,17 +641,15 @@ all-recursive: all-local
test-recursive: test-local
...
========================================
```
** A few implementation details
A few implementation details
----------------------------
The way rules.make does its recursion is very standard; it maps
{all,install,clean, dist,test} to $@-recursive, which executes that rule
in each directory in $(SUBDIRS), and then calls $@-local in the current
`{all,install,clean,dist,test}` to `$@-recursive`, which executes that rule
in each directory in `$(SUBDIRS)`, and then calls `$@-local` bin the current
directory. So something that gets built in a subdirectory cannot rely on
something that gets built in its parent directory. If this is a problem,
see the previous section. Note that the recursive rule for 'dist' is
@@ -697,61 +660,53 @@ Note that even a directory that doesn't, for example, have any tests
must still define test-local; otherwise 'make test' run from the
toplevel directory will break.
** Flags for Tools
Flags for Tools
---------------
We want to make it so that the user can specify certain flags to
always be given to a tool, so there's a general way of implementing
FLAGS variables:
* $(foo_FLAGS) remains unset or defaulted to something
sensible; the user can provide overrides this way.
* `$(foo_FLAGS)` remains unset or defaulted to something
sensible; the user can provide overrides this way.
* $(LOCAL_foo_FLAGS) is set in a specific Makefile to
provide necessary values.
* `$(LOCAL_foo_FLAGS)` is set in a specific Makefile to
provide necessary values.
* $(PLATFORM_foo_FLAGS) is set in the platform configuration
to provide platform-specific values.
* `$(PLATFORM_foo_FLAGS)` is set in the platform configuration
to provide platform-specific values.
* $(PROFILE_foo_FLAGS) is set in the profile configuration
to provide profile-specific values.
* `$(PROFILE_foo_FLAGS)` is set in the profile configuration
to provide profile-specific values.
* $(USE_foo_FLAGS) is defined to be the combination of all of
the above, and it's what is actually passed to $(foo).
* `$(USE_foo_FLAGS)` is defined to be the combination of all of
the above, and it's what is actually passed to $(foo).
$(MCS_FLAGS) and $(CFLAGS) follow this model. If you end up finding
`$(MCS_FLAGS)` and `$(CFLAGS)` follow this model. If you end up finding
that another tool is used commonly (hm, jay...), please follow this form.
** Portability tips
Portability tips
----------------
Always use the icky Windows /argument way of passing parameters to the C#
compiler so that csc can be used.
Always use /r:foo.dll, not /r:foo. Windows requires the former.
Always use `/r:foo.dll`, not `/r:foo`. Windows requires the former.
Use /r:$(corlib), not /r:corlib.
Use `/r:$(corlib)`, not `/r:corlib`.
If you're writing shell script code as part of a make rule, remember
that Windows has command-line length limits. So something like
========================================
```
mytool $(all_the_sources_to_corlib)
========================================
```
Is probably going to cause problems. As I understand it,
========================================
```
for f in $(all_the_sources_to_corlib) ; do ...
========================================
```
is ok, since the shell itself doesn't have those limitations. Other
than that, you should still try to write fairly portable shell
@@ -764,9 +719,10 @@ will be ports to more Unices as time goes on.
** Misc
Misc
----
We still don't use /d:NET_1_1 ; it causes some build problems right
We still don't use `/d:NET_1_1`; it causes some build problems right
now.
There's a hack in class/System.Data/Makefile to work around a very
+2
View File
@@ -45,6 +45,8 @@ static partial class SR
{
return string.Format (CultureInfo.InvariantCulture, resourceFormat, p1, p2, p3);
}
internal static string GetResourceString (string str) => str;
}
#if !INSIDE_CORLIB
+10 -11
View File
@@ -1,14 +1,13 @@
using System;
class X {
// Check installed compiler
static void Generic<T> ()
{
// we use 'var' all around in the compiler sources
var x = new X ();
}
void DefaultParametersAvailable (int i = 3)
interface II
{
}
class X
{
static void Foo (II a = default (II), II b = default, II c = (II) null)
{
}
@@ -42,9 +41,9 @@ class X {
Version min_mono_version;
#if __MonoCS__
min_mono_version = new Version (5, 11);
min_mono_version = new Version (5, 16);
#else
min_mono_version = new Version (4, 9);
min_mono_version = new Version (5, 10);
#endif
if (version < min_mono_version)
+3 -2
View File
@@ -32,9 +32,10 @@ mono_libdir = $(exec_prefix)/lib
sysconfdir = $(prefix)/etc
#RUNTIME = mono
RUNTIME = false
MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/
MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)
MONO_PATH_TESTS = $(MONO_PATH_TOP)/tests
TEST_RUNTIME = MONO_PATH="$(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)$(PLATFORM_PATH_SEPARATOR).$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
TEST_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)$(PLATFORM_PATH_SEPARATOR).
TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
# In case you want to add MCS_FLAGS, this lets you not have to
# keep track of the default value
+6 -4
View File
@@ -42,15 +42,17 @@ executable_CLEAN_FILES += $(build_lib) $(build_lib).so $(build_lib).mdb $(build_
makefrag = $(depsdir)/$(PROFILE)_$(base_prog).makefrag
LIB_REFS_ALL = $(DEFAULT_REFERENCES) $(LIB_REFS)
ifdef TARGET_NET_REFERENCE
# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir
LIB_REFS_MONO = $(call _FILTER_OUT,System,$(LIB_REFS))
LIB_REFS_SYSTEM = $(filter-out $(LIB_REFS_MONO),$(LIB_REFS))
# System*, mscorlib references come from the TARGET_NET_REFERENCE dir, others from the profile dir
LIB_REFS_MONO = $(call _FILTER_OUT,System,$(call _FILTER_OUT,mscorlib,$(LIB_REFS_ALL)))
LIB_REFS_SYSTEM = $(filter-out $(LIB_REFS_MONO),$(LIB_REFS_ALL))
MCS_REFERENCES = $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM))
MCS_REFERENCES += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO))
else
MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS))
MCS_REFERENCES = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_ALL))
endif
ifdef KEYFILE
+420
View File
@@ -0,0 +1,420 @@
using System;
using System.Text;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
public static class Program {
public static int Main (string[] _args) {
var args = new List<string> (_args);
bool useStdout = false, showHelp = false, strictMode = false;
for (int i = 0; i < args.Count; i++) {
var arg = args[i];
if (!arg.StartsWith ("-"))
continue;
switch (arg) {
case "-?":
case "--help":
case "-h":
showHelp = true;
break;
case "--trace":
case "--trace1":
SourcesParser.TraceLevel = 1;
break;
case "--trace2":
SourcesParser.TraceLevel = 2;
break;
case "--trace3":
SourcesParser.TraceLevel = 3;
break;
case "--trace4":
SourcesParser.TraceLevel = 4;
break;
case "--stdout":
useStdout = true;
break;
case "--strict":
strictMode = true;
break;
default:
Console.Error.WriteLine ("Unrecognized switch " + arg);
break;
}
args.RemoveAt (i);
i--;
}
if (args.Count != 4)
showHelp = true;
if (showHelp) {
Console.Error.WriteLine ("Usage: mcs/build/gensources.exe [options] (outputFileName|--stdout) libraryDirectoryAndName platformName profileName");
Console.Error.WriteLine ("You can specify * for platformName and profileName to read all sources files");
Console.Error.WriteLine ("Available options:");
Console.Error.WriteLine ("--help -h -?");
Console.Error.WriteLine (" Show command line info");
Console.Error.WriteLine ("--trace1 --trace2 --trace3 --trace4");
Console.Error.WriteLine (" Enable diagnostic output");
Console.Error.WriteLine ("--stdout");
Console.Error.WriteLine (" Writes results to standard output (omit outputFileName if you use this)");
Console.Error.WriteLine ("--strict");
Console.Error.WriteLine (" Produces an error exit code if files or directories are invalid/missing");
return 1;
}
var myAssembly = Assembly.GetExecutingAssembly ();
var codeBase = new Uri (myAssembly.CodeBase);
var executablePath = Path.GetFullPath (codeBase.LocalPath);
var executableDirectory = Path.GetDirectoryName (executablePath);
var outFile = Path.GetFullPath (args[0]);
var libraryFullName = Path.GetFullPath (args[1]);
var platformName = args[2];
var profileName = args[3];
var platformsFolder = Path.Combine (executableDirectory, "platforms");
var profilesFolder = Path.Combine (executableDirectory, "profiles");
var libraryDirectory = Path.GetDirectoryName (libraryFullName);
var libraryName = Path.GetFileName (libraryFullName);
var parser = new SourcesParser (platformsFolder, profilesFolder);
var result = parser.Parse (libraryDirectory, libraryName, platformName, profileName);
if (SourcesParser.TraceLevel > 0)
Console.Error.WriteLine ($"// Writing sources for platform {platformName} and profile {profileName}, relative to {libraryDirectory}, to {outFile}.");
TextWriter output;
if (useStdout)
output = Console.Out;
else
output = new StreamWriter (outFile);
using (output) {
foreach (var fileName in result.GetFileNames ().OrderBy (s => s, StringComparer.Ordinal))
output.WriteLine (fileName);
}
if (strictMode)
return result.ErrorCount;
else
return 0;
}
}
public struct ParseEntry {
public string SourcesFileName;
public string Directory;
public string Pattern;
public string HostPlatform;
public string ProfileName;
}
public struct Source {
public string FileName;
}
public class ParseResult {
public readonly string LibraryDirectory, LibraryName;
public readonly List<ParseEntry> Sources = new List<ParseEntry> ();
public readonly List<ParseEntry> Exclusions = new List<ParseEntry> ();
// FIXME: This is a bad spot for this value but enumerators don't have outparam support
public int ErrorCount = 0;
public ParseResult (string libraryDirectory, string libraryName) {
LibraryDirectory = libraryDirectory;
LibraryName = libraryName;
}
private static string GetRelativePath (string fullPath, string relativeToDirectory) {
fullPath = fullPath.Replace (SourcesParser.DirectorySeparator, "/");
relativeToDirectory = relativeToDirectory.Replace (SourcesParser.DirectorySeparator, "/");
if (!relativeToDirectory.EndsWith (SourcesParser.DirectorySeparator))
relativeToDirectory += SourcesParser.DirectorySeparator;
var dirUri = new Uri (relativeToDirectory);
var pathUri = new Uri (fullPath);
var relativeUri = Uri.UnescapeDataString (
dirUri.MakeRelativeUri (pathUri).OriginalString
).Replace ("/", SourcesParser.DirectorySeparator);
if (SourcesParser.TraceLevel >= 4)
Console.Error.WriteLine ($"// {fullPath} -> {relativeUri}");
return relativeUri;
}
private IEnumerable<string> EnumerateMatches (
IEnumerable<ParseEntry> entries,
string hostPlatformName, string profileName
) {
foreach (var entry in entries) {
if (
(hostPlatformName != null) &&
(entry.HostPlatform ?? hostPlatformName) != hostPlatformName
)
continue;
if (
(profileName != null) &&
(entry.ProfileName ?? profileName) != profileName
)
continue;
var absolutePath = Path.Combine (entry.Directory, entry.Pattern);
var absoluteDirectory = Path.GetDirectoryName (absolutePath);
var absolutePattern = Path.GetFileName (absolutePath);
if (SourcesParser.TraceLevel >= 3) {
if ((absolutePattern != entry.Pattern) || (absoluteDirectory != entry.Directory))
Console.Error.WriteLine ($"// {entry.Directory} / {entry.Pattern} -> {absoluteDirectory} / {absolutePattern}");
}
if (!Directory.Exists (absoluteDirectory)) {
Console.Error.WriteLine ($"Directory does not exist: {Path.GetFullPath (absoluteDirectory)}");
ErrorCount += 1;
continue;
}
var matchingFiles = Directory.GetFiles (absoluteDirectory, absolutePattern);
foreach (var fileName in matchingFiles) {
var relativePath = GetRelativePath (fileName, LibraryDirectory);
yield return relativePath;
}
}
}
// If you loaded sources files for multiple profiles, you can use the arguments here
// to filter the results
public IEnumerable<string> GetFileNames (
string hostPlatformName = null, string profileName = null
) {
var encounteredFileNames = new HashSet<string> (StringComparer.Ordinal);
var excludedFiles = new HashSet<string> (
EnumerateMatches (Exclusions, hostPlatformName, profileName),
StringComparer.Ordinal
);
foreach (var fileName in EnumerateMatches (Sources, hostPlatformName, profileName)) {
if (excludedFiles.Contains (fileName)) {
if (SourcesParser.TraceLevel >= 3)
Console.Error.WriteLine ($"// Excluding {fileName}");
continue;
}
// Skip duplicates
if (encounteredFileNames.Contains (fileName))
continue;
encounteredFileNames.Add (fileName);
yield return fileName;
}
}
}
public class SourcesParser {
public static readonly string DirectorySeparator = new String (Path.DirectorySeparatorChar, 1);
public static int TraceLevel = 0;
private class State {
public ParseResult Result;
public string HostPlatform;
public string ProfileName;
public int SourcesFilesParsed, ExclusionsFilesParsed;
public List<ParseEntry> ParsedSources {
get {
return Result.Sources;
}
}
public List<ParseEntry> ParsedExclusions {
get {
return Result.Exclusions;
}
}
}
public readonly string[] AllHostPlatformNames;
public readonly string[] AllProfileNames;
private int ParseDepth = 0;
public SourcesParser (
string platformsFolder, string profilesFolder
) {
AllHostPlatformNames = Directory.GetFiles (platformsFolder, "*.make")
.Select (Path.GetFileNameWithoutExtension)
.ToArray ();
AllProfileNames = Directory.GetFiles (profilesFolder, "*.make")
.Select (Path.GetFileNameWithoutExtension)
.ToArray ();
}
public ParseResult Parse (string libraryDirectory, string libraryName, string hostPlatform, string profile) {
var state = new State {
Result = new ParseResult (libraryDirectory, libraryName),
ProfileName = profile,
HostPlatform = hostPlatform
};
var testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{profile}_{libraryName}");
var ok = TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
if (ok) {
PrintSummary (state);
return state.Result;
}
state.HostPlatform = null;
testPath = Path.Combine (libraryDirectory, $"{profile}_{libraryName}");
ok = TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
if (ok) {
PrintSummary (state);
return state.Result;
}
testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{libraryName}");
ok = TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
if (ok) {
PrintSummary (state);
return state.Result;
}
state.ProfileName = null;
testPath = Path.Combine (libraryDirectory, libraryName);
TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
PrintSummary (state);
return state.Result;
}
public ParseResult Parse (string libraryDirectory, string libraryName) {
var state = new State {
Result = new ParseResult (libraryDirectory, libraryName)
};
string testPath = Path.Combine (libraryDirectory, libraryName);
TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
foreach (var profile in AllProfileNames) {
state.ProfileName = profile;
foreach (var hostPlatform in AllHostPlatformNames) {
state.HostPlatform = hostPlatform;
testPath = Path.Combine (libraryDirectory, $"{hostPlatform}_{profile}_{libraryName}");
TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
}
state.HostPlatform = null;
testPath = Path.Combine (libraryDirectory, $"{profile}_{libraryName}");
TryParseSingleFile (state, testPath + ".sources", false);
TryParseSingleFile (state, testPath + ".exclude.sources", true);
}
PrintSummary (state);
return state.Result;
}
private void PrintSummary (State state) {
if (TraceLevel > 0)
Console.Error.WriteLine ($"// Parsed {state.SourcesFilesParsed} sources file(s) and {state.ExclusionsFilesParsed} exclusions file(s).");
}
private void HandleMetaDirective (State state, string directory, bool asExclusionsList, string directive) {
var include = "#include ";
if (directive.StartsWith (include))
ParseSingleFile (state, Path.Combine (directory, directive.Substring (include.Length)), asExclusionsList);
}
private bool TryParseSingleFile (State state, string fileName, bool asExclusionsList) {
if (!File.Exists (fileName))
return false;
ParseSingleFile (state, fileName, asExclusionsList);
return true;
}
private void ParseSingleFile (State state, string fileName, bool asExclusionsList) {
var nullStr = "<none>";
if (TraceLevel >= 1)
Console.Error.WriteLine ($"// {new String (' ', ParseDepth * 2)}{fileName} [{state.HostPlatform ?? nullStr}] [{state.ProfileName ?? nullStr}]");
ParseDepth += 1;
var directory = Path.GetDirectoryName (fileName);
using (var sr = new StreamReader (fileName)) {
if (asExclusionsList)
state.ExclusionsFilesParsed++;
else
state.SourcesFilesParsed++;
string line;
while ((line = sr.ReadLine ()) != null) {
if (String.IsNullOrWhiteSpace (line))
continue;
if (line.StartsWith ("#")) {
HandleMetaDirective (state, directory, asExclusionsList, line);
continue;
}
var parts = line.Split (':');
if (parts.Length > 1) {
var explicitExclusions = parts[1].Split (',');
// gensources.sh implemented these explicit exclusions like so:
// ../foo/bar/*.cs:A.cs,B.cs
// This would generate exclusions for ../foo/bar/A.cs and ../foo/bar/B.cs,
// not ./A.cs and ./B.cs as you might expect
var mainPatternDirectory = Path.GetDirectoryName (parts[0]);
foreach (var pattern in explicitExclusions) {
state.ParsedExclusions.Add (new ParseEntry {
SourcesFileName = fileName,
Directory = directory,
Pattern = Path.Combine (mainPatternDirectory, pattern),
HostPlatform = state.HostPlatform,
ProfileName = state.ProfileName
});
}
}
(asExclusionsList ? state.ParsedExclusions : state.ParsedSources)
.Add (new ParseEntry {
SourcesFileName = fileName,
Directory = directory,
Pattern = parts[0],
HostPlatform = state.HostPlatform,
ProfileName = state.ProfileName
});
}
}
ParseDepth -= 1;
}
}
+23 -15
View File
@@ -18,19 +18,19 @@
# Have to rename to handle differences between assembly/directory names
DEP_LIBS=$(patsubst System.Xml,System.XML,$(LIB_REFS))
LIB_REFS_FULL = $(call _FILTER_OUT,=, $(LIB_REFS))
LIB_REFS_FULL = $(call _FILTER_OUT,=, $(LIB_REFS)) $(DEFAULT_REFERENCES)
LIB_REFS_ALIAS = $(filter-out $(LIB_REFS_FULL),$(LIB_REFS))
ifdef TARGET_NET_REFERENCE
# System.*.dll references come from the TARGET_NET_REFERENCE dir, others from the profile dir
LIB_REFS_MONO_FULL = $(call _FILTER_OUT,System,$(LIB_REFS_FULL))
# System*, mscorlib references come from the TARGET_NET_REFERENCE dir, others from the profile dir
LIB_REFS_MONO_FULL = $(call _FILTER_OUT,System,$(call _FILTER_OUT,mscorlib,$(LIB_REFS_FULL)))
LIB_REFS_MONO_ALIAS = $(call _FILTER_OUT,System,$(LIB_REFS_ALIAS))
LIB_REFS_SYSTEM_FULL = $(filter-out $(LIB_REFS_MONO_FULL),$(LIB_REFS_FULL))
LIB_REFS_SYSTEM_ALIAS = $(filter-out $(LIB_REFS_MONO_ALIAS),$(LIB_REFS_ALIAS))
LIB_REFS_NET_FULL = $(filter-out $(LIB_REFS_MONO_FULL),$(LIB_REFS_FULL))
LIB_REFS_NET_ALIAS = $(filter-out $(LIB_REFS_MONO_ALIAS),$(LIB_REFS_ALIAS))
LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_SYSTEM_FULL))
LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/,$(LIB_REFS_SYSTEM_ALIAS)))
LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/%.dll,$(LIB_REFS_NET_FULL))
LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/,$(LIB_REFS_NET_ALIAS)))
LIB_MCS_FLAGS += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/%.dll,$(LIB_REFS_MONO_FULL))
LIB_MCS_FLAGS += $(patsubst %,-r:%.dll, $(subst =,=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/,$(LIB_REFS_MONO_ALIAS)))
@@ -224,7 +224,7 @@ test-local run-test-local run-test-ondotnet-local:
ccomma = ,
define RESOURCE_template
$(1).resources: $(2)
$(RESGEN) "$$<" "$$@"
$$(RESGEN) "$$<" "$$@"
GEN_RESOURCE_DEPS += $(1).resources
GEN_RESOURCE_FLAGS += -resource:$(1).resources
@@ -298,11 +298,19 @@ endif
PROFILE_sources := $(firstword $(if $(PROFILE_PLATFORM),$(wildcard $(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY).sources)) $(wildcard $(PROFILE)_$(LIBRARY).sources) $(wildcard $(LIBRARY).sources))
PROFILE_excludes = $(firstword $(if $(PROFILE_PLATFORM),$(wildcard $(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY).exclude.sources)) $(wildcard $(PROFILE)_$(LIBRARY).exclude.sources))
# Note, gensources.sh can create a $(sourcefile).makefrag if it sees any '#include's
# We don't include it in the dependencies since it isn't always created
gensources = $(topdir)/build/gensources.exe
$(gensources): $(topdir)/build/gensources.cs
$(BOOTSTRAP_MCS) -noconfig -debug:portable -r:mscorlib.dll -r:System.dll -r:System.Core.dll -out:$(gensources) $(topdir)/build/gensources.cs
ifdef PROFILE_RUNTIME
GENSOURCES_RUNTIME = $(PROFILE_RUNTIME)
else
GENSOURCES_RUNTIME = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME)
endif
sourcefile = $(depsdir)/$(PROFILE_PLATFORM)_$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).sources
$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(topdir)/build/gensources.sh $(depsdir)/.stamp
$(SHELL) $(topdir)/build/gensources.sh $@ '$(PROFILE_sources)' '$(PROFILE_excludes)'
$(sourcefile): $(PROFILE_sources) $(PROFILE_excludes) $(depsdir)/.stamp $(gensources)
$(GENSOURCES_RUNTIME) --debug $(gensources) "$@" "$(LIBRARY)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
library_CLEAN_FILES += $(sourcefile)
@@ -390,9 +398,9 @@ gen-deps:
update-corefx-sr-generic:
ifneq ($(RESX_STRINGS),)
MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_STRINGS) >$(SR_OUTPUT)
MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_EXTRA_ARGUMENTS) $(RESX_STRINGS) >$(SR_OUTPUT)
endif
update-corefx-sr: $(RESX_RESOURCE_STRING) $(XTEST_RESX_RESOURCE_STRING)
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS=$(RESX_RESOURCE_STRING) update-corefx-sr-generic \
&& make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS="$(RESX_RESOURCE_STRING)" RESX_EXTRA_ARGUMENTS="$(RESX_EXTRA_ARGUMENTS)" update-corefx-sr-generic \
&& make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic
+1 -1
View File
@@ -6,7 +6,7 @@
PLATFORM_MCS_FLAGS =
PLATFORM_RUNTIME = $(RUNTIME)
PLATFORM_CORLIB = mscorlib.dll
PLATFORM_TEST_HARNESS_EXCLUDES =
PLATFORM_TEST_HARNESS_EXCLUDES = NotOnLinux,
EXTERNAL_MCS = mcs
EXTERNAL_MBAS = mbas
+5 -3
View File
@@ -26,11 +26,13 @@ else
endif
endif
ILASM = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/ilasm.exe
STRING_REPLACER = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/cil-stringreplacer.exe
MCS = $(BOOTSTRAP_MCS)
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES)
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -d:BOOTSTRAP_BASIC -nowarn:1699 -nostdlib
API_BIN_PROFILE = v4.7.1
NO_SIGN_ASSEMBLY = yes
@@ -113,7 +115,7 @@ endif
$(PROFILE_EXE): $(topdir)/build/common/basic-profile-check.cs
$(MAKE) $(MAKE_Q) -C $(topdir)/packages
$(BOOTSTRAP_MCS) /warn:0 /noconfig /r:System.dll /r:mscorlib.dll /out:$@ $<
$(BOOTSTRAP_MCS) /warn:0 /noconfig /langversion:latest /r:System.dll /r:mscorlib.dll /out:$@ $<
$(PROFILE_OUT): $(PROFILE_EXE)
$(PROFILE_RUNTIME) $< > $@ 2>&1
+4 -2
View File
@@ -13,8 +13,8 @@ PLATFORMS = darwin linux win32
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES)
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib
API_BIN_PROFILE = v4.7.1
NO_SIGN_ASSEMBLY = yes
@@ -22,3 +22,5 @@ NO_TEST = yes
NO_INSTALL = yes
FRAMEWORK_VERSION = 4.5
MONO_FEATURE_APPLETLS=1
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -24,7 +24,6 @@ PROFILE_MCS_FLAGS = \
-d:ANDROID \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monodroid
+2 -2
View File
@@ -9,9 +9,9 @@ profile-check:
@:
TARGET_NET_REFERENCE = v4.6
DEFAULT_REFERENCES = -r:$(topdir)/../external/binary-reference-assemblies/$(TARGET_NET_REFERENCE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
PROFILE_MCS_FLAGS = -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(PLATFORM_DEBUG_FLAGS)
FRAMEWORK_VERSION = 4.5
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
-d:NET_2_0 \
@@ -24,7 +24,6 @@ PROFILE_MCS_FLAGS = \
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS) \
$(MONOTOUCH_MCS_FLAGS)
+2 -2
View File
@@ -12,8 +12,8 @@ PLATFORMS = darwin linux win32
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/mscorlib.dll
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -d:MULTIPLEX_OS -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = v4.7.1
FRAMEWORK_VERSION = 4.5
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -26,7 +26,6 @@ PROFILE_MCS_FLAGS = \
-d:DISABLE_COM \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monotouch
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -25,7 +25,6 @@ PROFILE_MCS_FLAGS = \
-d:DISABLE_COM \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monotouch
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -22,7 +22,6 @@ PROFILE_MCS_FLAGS = \
-d:MONO \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monotouch
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -22,7 +22,6 @@ PROFILE_MCS_FLAGS = \
-d:MONO \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monotouch
+2 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -24,9 +24,9 @@ PROFILE_MCS_FLAGS = \
-d:WASM \
-d:DISABLE_REMOTING \
-d:DISABLE_COM \
-d:FEATURE_NO_BSD_SOCKETS \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monotouch
+1 -2
View File
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -26,7 +26,6 @@ PROFILE_MCS_FLAGS = \
-d:WIN_PLATFORM \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS)
API_BIN_PROFILE = build/monotouch
+1 -2
View File
@@ -6,7 +6,7 @@ MCS = $(BOOTSTRAP_MCS)
profile-check:
@:
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = \
-d:NET_1_1 \
@@ -23,7 +23,6 @@ PROFILE_MCS_FLAGS = \
-d:XAMARIN_MODERN \
-nowarn:1699 \
-nostdlib \
$(DEFAULT_REFERENCES) \
$(PLATFORM_DEBUG_FLAGS) \
$(XAMMAC_MCS_FLAGS)
+1 -1
View File
@@ -1,6 +1,6 @@
include $(topdir)/build/profiles/net_4_x.make
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS) \
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib $(PLATFORM_DEBUG_FLAGS) \
-d:FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK \
-d:NO_SYSTEM_DRAWING_DEPENDENCY \
-d:NO_WINFORMS_DEPENDENCY \
+1 -1
View File
@@ -5,7 +5,7 @@ include $(topdir)/build/profiles/net_4_x.make
PLATFORMS:=
PARENT_PROFILE = ../net_4_x$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))/
DEFAULT_REFERENCES = -r:$(topdir)/class/lib/net_4_x$(if $(PROFILE_PLATFORM),-$(PROFILE_PLATFORM))/mscorlib.dll
DEFAULT_REFERENCES = ../net_4_x/mscorlib
PROFILE_MCS_FLAGS += -d:XBUILD_12
XBUILD_VERSION = 12.0
+1 -1
View File
@@ -161,7 +161,7 @@ gacutil = $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/gacutil.exe
GACUTIL = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil)
endif
STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
STD_TARGETS = test xunit-test run-test run-xunit-test run-test-ondotnet clean install uninstall doc-update
$(STD_TARGETS): %: do-%
+53 -28
View File
@@ -19,14 +19,34 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
## Unit test support
ifndef NO_TEST
test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
test_nunit_lib = nunitlite.dll
xunit_core := xunit.core xunit.execution.desktop xunit.abstractions xunit.assert Xunit.NetCore.Extensions
xunit_core := xunit.core xunit.execution.dotnet xunit.abstractions xunit.assert Xunit.NetCore.Extensions
xunit_deps := System.Runtime
xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs
ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES)
XTEST_REMOTE_EXECUTOR = $(xunit_test_lib)_RemoteExecuter.exe
xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs $(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs
XTEST_REMOTE_EXECUTOR = $(test_lib_dir)/RemoteExecutorConsoleApp.exe
ifeq ($(BUILD_PLATFORM), win32)
XTEST_REMOTE_EXECUTOR_ABSPATH = $(shell cygpath -w $(abspath $(XTEST_REMOTE_EXECUTOR)))
else
XTEST_REMOTE_EXECUTOR_ABSPATH = $(abspath $(XTEST_REMOTE_EXECUTOR))
endif
xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \
$(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs \
$(topdir)/../external/corefx/src/Common/src/System/PasteArguments.Unix.cs
ifeq ($(PROFILE),monodroid)
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
else
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs
endif
endif
xunit_class_deps :=
@@ -37,8 +57,8 @@ xunit_libs_ref += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/Facades/%.dll,$
xunit_libs_dep = $(xunit_class_deps:%=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)%.dll)
xunit_libs_ref += $(xunit_libs_dep:%=-r:%)
TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(TEST_LIB_REFS))
XTEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(XTEST_LIB_REFS))
TEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(TEST_LIB_REFS) $(DEFAULT_REFERENCES))
XTEST_LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/%.dll,$(XTEST_LIB_REFS) $(DEFAULT_REFERENCES))
test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)%)
test_nunit_ref = $(test_nunit_dep:%=-r:%)
@@ -51,6 +71,7 @@ test_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
endif
test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll)
test_lib_output = $(test_lib_dir)/$(test_lib)
test_sourcefile_excludes = $(test_lib).exclude.sources
@@ -62,12 +83,13 @@ ifndef NO_BUILD
test_flags += -r:$(the_assembly)
test_assembly_dep = $(the_assembly)
endif
tests_CLEAN_FILES += $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.dll) $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.pdb) $(test_response) $(test_makefrag)
tests_CLEAN_FILES += $(test_lib_output) $(test_lib_output:$(ASSEMBLY_EXT)=.pdb) $(test_response) $(test_makefrag)
xtest_sourcefile = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
xtest_sourcefile_excludes = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.exclude.sources)
xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll)
xtest_lib_output = $(test_lib_dir)/$(xunit_test_lib)
xtest_response = $(depsdir)/$(xunit_test_lib).response
xtest_makefrag = $(depsdir)/$(xunit_test_lib).makefrag
@@ -75,7 +97,7 @@ xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LI
ifeq ($(wildcard $(xtest_sourcefile)),)
xtest_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
tests_CLEAN_FILES += $(xunit_test_lib) $(xtest_response) $(xtest_makefrag)
tests_CLEAN_FILES += $(xtest_lib_output) $(xtest_response) $(xtest_makefrag)
endif
ifndef HAVE_CS_TESTS
@@ -102,10 +124,6 @@ endif
test_assemblies :=
test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
test_lib_output = $(topdir)/class/lib/$(PROFILE)/tests/$(test_lib)
ifdef HAVE_CS_TESTS
test_assemblies += $(test_lib_output)
@@ -200,14 +218,14 @@ ifneq ($(wildcard $(MKBUNDLE_TEST_BIN)),)
TEST_HARNESS_EXEC=$(MKBUNDLE_TEST_BIN)
TEST_HARNESS_EXCLUDES:=$(TEST_HARNESS_EXCLUDES),StaticLinkedAotNotWorking
else
TEST_HARNESS_EXEC=$(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS)
TEST_HARNESS_EXEC=$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS)
endif
## FIXME: i18n problem in the 'sed' command below
run-test-lib: test-local test-local-aot-compile patch-nunitlite-appconfig
ok=:; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_HARNESS_EXEC) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="$(TEST_RUNTIME_FLAGS)" $(TEST_HARNESS_EXEC) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(LABELS_ARG) -format:nunit2 -result:TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='$(notdir $(strip $(test_assemblies))).crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
$$ok
## Instructs compiler to compile to target .net execution, it can be usefull in rare cases when runtime detection is not possible
@@ -231,7 +249,7 @@ ifdef HAVE_CS_TESTS
$(test_lib_dir):
mkdir -p $@
$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(test_lib_dir)
$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) | $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
test_response_preprocessed = $(test_response)_preprocessed
@@ -259,10 +277,17 @@ endif
ifdef HAVE_CS_XTESTS
XTEST_HARNESS_PATH = $(topdir)/../external/xunit-binaries
XTEST_HARNESS_PATH := $(topdir)/../external/xunit-binaries
XTEST_HARNESS = $(XTEST_HARNESS_PATH)/xunit.console.exe
XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit TestResult-$(PROFILE)-xunit.xml
XTEST_RESULT_FILE := TestResult-$(PROFILE)-xunit.xml
XTEST_HARNESS_FLAGS := -noappdomain -noshadow -parallel none -nunit $(XTEST_RESULT_FILE)
XTEST_TRAIT := -notrait category=failing -notrait category=nonmonotests -notrait Benchmark=true -notrait category=outerloop
# The logic is double inverted so this actually excludes tests not intented for current platform
# best to search for `property name="category"` in the xml output to see what's going on
# https://github.com/dotnet/buildtools/blob/master/src/xunit.netcore.extensions/Discoverers/PlatformSpecificDiscoverer.cs
XTEST_TRAIT_PLATFORM := -notrait category=non$(XTEST_PLATFORM)tests
TEST_MONO_PATH := $(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$(XTEST_HARNESS_PATH)
ifdef FIXTURE
XTEST_HARNESS_FLAGS += -class $(FIXTURE)
@@ -277,23 +302,23 @@ XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(P
endif
check: run-xunit-test-local
run-xunit-test: run-xunit-test-local
xunit-test-local: $(xunit_test_lib)
xunit-test-local: $(xtest_lib_output)
run-xunit-test-local: run-xunit-test-lib
# cp -rf is a HACK for xunit runner to require xunit.execution.desktop.dll file in local folder on .net only
run-xunit-test-lib: xunit-test-local $(XTEST_REMOTE_EXECUTOR)
@cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.desktop.dll xunit.execution.desktop.dll
# cp -rf is a HACK for xunit runner to require xunit.execution.dOTNET.dll file in local folder on .net only
run-xunit-test-lib: xunit-test-local
@cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.dotnet.dll $(test_lib_dir)/xunit.execution.dotnet.dll
ok=:; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xunit_test_lib) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) || ok=false; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR="$(XTEST_REMOTE_EXECUTOR_ABSPATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xtest_lib_output) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) $(XTEST_TRAIT_PLATFORM) || ok=false; \
if [ -n "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE" ]; then echo "$(abspath $(XTEST_RESULT_FILE))" >> "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE"; fi; \
$$ok
@rm -f xunit.execution.desktop.dll
@rm -f $(test_lib_dir)/xunit.execution.dotnet.dll
# Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase)
$(XTEST_REMOTE_EXECUTOR): $(topdir)/../mcs/class/test-helpers/RemoteExecutorConsoleApp.cs
$(TEST_COMPILE) $(topdir)/../mcs/class/test-helpers/RemoteExecutorConsoleApp.cs -r:$(xunit_test_lib) $(xtest_flags) /debug-
$(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | $(test_lib_dir)
$(TEST_COMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll $< -out:$@
$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src)
$(xtest_lib_output): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(XTEST_REMOTE_EXECUTOR) | $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
xtest_response_preprocessed = $(xtest_response)_preprocessed
@@ -305,7 +330,7 @@ $(xtest_response): $(xtest_sourcefile) $(wildcard $(xtest_sourcefile_excludes))
$(xtest_makefrag): $(xtest_response)
@echo Creating $@ ...
@sed 's,^,$(xunit_test_lib): ,' $< >$@
@sed 's,^,$(xtest_lib_output): ,' $< >$@
-include $(xtest_makefrag)
@@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E51283DC-7090-479E-B723-01C0953F18EA}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699</NoWarn>
<LangVersion>latest</LangVersion>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<OutputPath>./../../class/lib/net_4_x-$(HostPlatform)</OutputPath>
<IntermediateOutputPath>obj-net_4_x-$(HostPlatform)</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Accessibility</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="Accessibility\IAccessible.cs" />
<Compile Include="Accessibility\IAccessibleHandler.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">net_4_x</Platform>
<ProjectGuid>{2CFDD4F5-4B13-4FF4-A421-0361F2FC825F}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699</NoWarn>
<LangVersion>latest</LangVersion>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AssemblyName>Accessibility</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'net_4_x' ">
<OutputPath>./../../class/lib/net_4_x-$(HostPlatform)</OutputPath>
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-net_4_x-$(HostPlatform)</IntermediateOutputPath>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>
</PropertyGroup>
<!-- @ALL_PROFILE_PROPERTIES@ -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- @COMMON_SOURCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="Accessibility\IAccessible.cs" />
<Compile Include="Accessibility\IAccessibleHandler.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
</ItemGroup>
<!-- @ALL_SOURCES@ -->
<!-- @COMMON_PROJECT_REFERENCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<ProjectReference Include="../corlib/corlib.csproj" />
</ItemGroup>
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
</Project>
@@ -1,59 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{FFFE76FE-98EE-4FF7-81D9-35C0FE1D3718}</ProjectGuid>
<Platform Condition=" '$(Platform)' == '' ">net_4_x</Platform>
<ProjectGuid>{79381DFE-F13A-4A37-9A89-6640702D46E3}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699</NoWarn>
<LangVersion>latest</LangVersion>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<OutputPath>./../../class/lib/net_4_x-$(HostPlatform)</OutputPath>
<IntermediateOutputPath>obj-net_4_x-$(HostPlatform)</IntermediateOutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Commons.Xml.Relaxng</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../mono.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<NoWarn>1699</NoWarn>
<Optimize>false</Optimize>
<DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<NoWarn>1699</NoWarn>
<Optimize>true</Optimize>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'net_4_x' ">
<OutputPath>./../../class/lib/net_4_x-$(HostPlatform)</OutputPath>
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-net_4_x-$(HostPlatform)</IntermediateOutputPath>
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>
</PropertyGroup>
<!-- @ALL_PROFILE_PROPERTIES@ -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<!-- @COMMON_SOURCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
@@ -93,51 +84,24 @@
<Compile Include="Commons.Xml.Relaxng\RelaxngValidatingReader.cs" />
<Compile Include="Commons.Xml.Relaxng\XsdDatatypeProvider.cs" />
<Compile Include="Commons.Xml\XmlDefaultReader.cs" />
<Compile Include="Commons.Xml.Relaxng.Rnc\RncParser.cs" />␍ </ItemGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
$(ProjectDir)\..\..\jay\jay -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.jay > $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.cs
</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
$(ProjectDir)\..\..\jay\jay -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.jay > $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.cs
</PreBuildEvent>
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
</PostBuildEvent>
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
<ProjectReference Include="../System.XML/System.Xml-net_4_x.csproj">
<Project>{87FD2F0F-5222-4AE6-BD63-2D4975E11E5B}</Project>
<Name>System.Xml-net_4_x</Name>
</ProjectReference>
<Compile Include="Commons.Xml.Relaxng.Rnc\RncParser.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<!-- @ALL_SOURCES@ -->
<!-- @COMMON_PROJECT_REFERENCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<ProjectReference Include="../System/System.csproj" />
<ProjectReference Include="../System.XML/System.Xml.csproj" />
<ProjectReference Include="../corlib/corlib.csproj" />
</ItemGroup>
<ItemGroup>
<!-- @ALL_REFERENCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<EmbeddedResource Include="resources/relaxng.rng">
<LogicalName>relaxng.rng</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Project>
<!-- @ALL_RESOURCES@ -->
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">$(ProjectDir)\..\..\jay\jay -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.jay &gt; $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.cs</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">$(ProjectDir)\..\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.jay &gt; $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.cs</PreBuildEvent>
</PropertyGroup>
</Project>
+1 -1
View File
@@ -22,7 +22,7 @@ EXTRA_DISTFILES = \
$(RESOURCE_FILES)
Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $(CURDIR)/Commons.Xml.Relaxng.Rnc/RncParser.jay > Commons.Xml.Relaxng.Rnc/RncParser.cs
$(topdir)/jay/jay -ctv -o Commons.Xml.Relaxng.Rnc/RncParser.cs $< < $(topdir)/jay/skeleton.cs
BUILT_SOURCES = Commons.Xml.Relaxng.Rnc/RncParser.cs
@@ -39,6 +39,7 @@ namespace ICSharpCode.SharpZipLib.BZip2
/// Base class for both the compress and decompress classes.
/// Holds common arrays, and static data.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public sealed class BZip2Constants
{
public readonly static int[] rNums = {
@@ -44,6 +44,7 @@ namespace ICSharpCode.SharpZipLib.BZip2
/// An input stream that decompresses from the BZip2 format (without the file
/// header chars) to be read as any other stream.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class BZip2InputStream : Stream
{
/// <summary>
@@ -45,6 +45,7 @@ namespace ICSharpCode.SharpZipLib.BZip2
/// header chars) into another stream.
/// TODO: Update to BZip2 1.0.1, 1.0.2
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class BZip2OutputStream : Stream
{
/// <summary>
@@ -86,6 +86,7 @@ namespace ICSharpCode.SharpZipLib.Checksums
/// </summary>
/// <see cref="ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream"/>
/// <see cref="ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream"/>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public sealed class Adler32 : IChecksum
{
/// <summary>
@@ -64,6 +64,7 @@ namespace ICSharpCode.SharpZipLib.Checksums
/// the information needed to generate CRC's on data a byte at a time for all
/// combinations of CRC register values and incoming bytes.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public sealed class Crc32 : IChecksum
{
readonly static uint CrcSeed = 0xFFFFFFFF;
@@ -45,6 +45,7 @@ namespace ICSharpCode.SharpZipLib.Checksums
/// <code>getValue</code>. The complete checksum object can also be reset
/// so it can be used again with new data.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public interface IChecksum
{
/// <summary>
@@ -41,6 +41,7 @@ using System;
namespace ICSharpCode.SharpZipLib.Checksums
{
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class StrangeCRC : IChecksum
{
readonly static uint[] crc32Table = {
@@ -41,6 +41,7 @@ namespace ICSharpCode.SharpZipLib.GZip
/// <summary>
/// This class contains constants used for gzip.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class GZipConstants
{
/// <summary>
@@ -79,6 +79,7 @@ namespace ICSharpCode.SharpZipLib.GZip
/// }
/// </code>
/// </example>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class GZipInputStream : InflaterInputStream
{
/// <summary>
@@ -72,6 +72,7 @@ namespace ICSharpCode.SharpZipLib.GZip
/// }
/// </code>
/// </example>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class GZipOutputStream : DeflaterOutputStream
{
//Variables
@@ -43,6 +43,7 @@ namespace ICSharpCode.SharpZipLib.Tar {
/// This exception is used to indicate that there is a problem
/// with a TAR archive header.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class InvalidHeaderException : System.IO.IOException
{
public InvalidHeaderException()
@@ -38,6 +38,7 @@ using System.Text;
namespace ICSharpCode.SharpZipLib.Tar {
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public delegate void ProgressMessageHandler(TarArchive archive, TarEntry entry, string message);
/// <summary>
@@ -61,6 +62,7 @@ namespace ICSharpCode.SharpZipLib.Tar {
/// TarBuffer.getCurrentRecordNum() and TarBuffer.getCurrentBlockNum()
/// methods, this would be rather trvial.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class TarArchive
{
bool verbose;
@@ -51,6 +51,7 @@ namespace ICSharpCode.SharpZipLib.Tar
/// TarBuffers are created by Tar IO Streams.
/// </p>
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class TarBuffer
{
@@ -67,6 +67,7 @@ namespace ICSharpCode.SharpZipLib.Tar
///
/// <see cref="TarHeader"/>
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class TarEntry
{
/// <summary>
@@ -74,6 +74,7 @@ namespace ICSharpCode.SharpZipLib.Tar
/// This class encapsulates the Tar Entry Header used in Tar Archives.
/// The class also holds a number of tar constants, used mostly in headers.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class TarHeader : ICloneable
{
/// <summary>
@@ -45,6 +45,7 @@ namespace ICSharpCode.SharpZipLib.Tar
/// the archive, and the read each entry as a normal input stream
/// using read().
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class TarInputStream : Stream
{
protected bool debug;
@@ -598,6 +599,7 @@ namespace ICSharpCode.SharpZipLib.Tar
/// the programmer to have their own TarEntry subclass instantiated for the
/// entries return from getNextEntry().
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public interface IEntryFactory
{
TarEntry CreateEntry(string name);
@@ -607,6 +609,7 @@ namespace ICSharpCode.SharpZipLib.Tar
TarEntry CreateEntry(byte[] headerBuf);
}
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class EntryFactoryAdapter : IEntryFactory
{
public TarEntry CreateEntry(string name)
@@ -45,6 +45,7 @@ namespace ICSharpCode.SharpZipLib.Tar
/// by writing to this stream using write().
/// </summary>
/// public
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class TarOutputStream : Stream
{
protected bool debug;
@@ -50,6 +50,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression
///
/// author of the original java version : Jochen Hoenicke
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class Deflater
{
/// <summary>
@@ -43,6 +43,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression
/// <summary>
/// This class contains constants used for the deflater.
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class DeflaterConstants
{
public const bool DEBUGGING = false;
@@ -42,6 +42,7 @@ using ICSharpCode.SharpZipLib.Checksums;
namespace ICSharpCode.SharpZipLib.Zip.Compression
{
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public enum DeflateStrategy
{
// The default strategy.
@@ -57,6 +58,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression
HuffmanOnly = 2
}
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class DeflaterEngine : DeflaterConstants
{
static int TOO_FAR = 4096;
@@ -48,6 +48,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression
///
/// author of the original java version : Jochen Hoenicke
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class DeflaterHuffman
{
private static int BUFSIZE = 1 << (DeflaterConstants.DEFAULT_MEM_LEVEL + 6);
@@ -79,6 +80,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression
15
};
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class Tree
{
public short[] freqs;
@@ -43,6 +43,7 @@ namespace ICSharpCode.SharpZipLib.Zip.Compression
///
/// author of the original java version : Jochen Hoenicke
/// </summary>
[System.ObsoleteAttribute("This assembly has been deprecated. Please use https://www.nuget.org/packages/SharpZipLib/ instead.")]
public class DeflaterPending : PendingBuffer
{
public DeflaterPending() : base(DeflaterConstants.PENDING_BUF_SIZE)
Loaded 100 of 2876 files, more files were not shown because too many files have changed in this diff. Show more