Compare commits

...
2053 Commits
Author SHA1 Message Date
Rodrigo Kumpera 1efe2d0402 Better debug spew 2018-11-05 17:00:25 -05:00
Rodrigo Kumpera a6c04a0958 [wasm] Fix C++ 2018-11-05 16:31:25 -05:00
Rodrigo Kumpera 6638211294 DO NOT MERGE. Disable other tests that not the debuggers. 2018-11-05 15:16:41 -05:00
Rodrigo Kumpera c32366e7bc skeleton for async tests. 2018-11-05 14:52:58 -05:00
Rodrigo Kumpera cacac3a75a handle captured variables 2018-11-02 14:37:20 -04:00
Rodrigo Kumpera d4e4f14c15 [wasm] Handle lookup of nested types. 2018-11-01 18:30:48 -04:00
Rodrigo Kumpera 60486a4438 [wasm] Support properties. 2018-10-31 18:08:17 -04:00
Rodrigo Kumpera ee58c0507e [wasm] Add basic support for properties, base & private fields. 2018-10-30 14:27:18 -04:00
Rodrigo Kumpera 7131941578 handle properties. 2018-10-26 16:41:11 -04:00
Rodrigo Kumpera fb5abca543 Added object inspection, somewhat 2018-10-26 14:04:38 -04:00
Rodrigo Kumpera c06b6901d5 [wasm] Fix debugger sample. 2018-10-24 16:00:26 -04:00
Rodrigo Kumpera 05a8cfa693 [wasm] Add stepping tests. 2018-10-24 15:53:52 -04:00
Rodrigo Kumpera d43c2aae50 [wasm] Add test for local introspection. 2018-10-24 12:34:45 -04:00
Rodrigo Kumpera f4ffbfcce4 [wasm] add linux probing. 2018-10-23 14:00:16 -04:00
Rodrigo Kumpera 37a0cf107c [wasm] Add /Debug option to ProxyDriver to starta chrome debugging session. 2018-10-23 13:48:47 -04:00
Rodrigo Kumpera d246888987 [wasm] Add breakpoint hit test. 2018-10-22 16:53:39 -04:00
Rodrigo Kumpera e523644c8d [wasm] Add tests for setting breakpoints. 2018-10-22 15:47:24 -04:00
Rodrigo Kumpera 1a0d47c1d8 [wasm] Update CI to run debugger tests. 2018-10-22 14:34:58 -04:00
Rodrigo Kumpera de15e913ee [wasm] Pass --debug to packager.exe invocations and add test-debugger target. 2018-10-22 14:34:44 -04:00
Rodrigo Kumpera cbef721c31 [wasm] Change default CopyType mode to IfNewer. Old default was to fail if existing. 2018-10-22 14:34:17 -04:00
Rodrigo Kumpera f13a95a867 [wasm] Add test suite. 2018-10-22 12:33:09 -04:00
Bernhard Urban c2c178c111 [ci] run regression tests with AOT (#11092) 2018-10-22 17:53:23 +02:00
Zoltan Varga 14b061ba65 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 08:45:43 -04:00
Zoltan Varga bf6a1edf75 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 07:08:54 -04:00
Zoltan Varga 299ae7a84e [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 07:08:38 -04:00
Zoltan Varga 54503ed970 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 07:08:14 -04:00
Zoltan Varga a7f448ad32 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 07:08:00 -04:00
Zoltan Varga 479a90be29 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 07:07:45 -04:00
Bernhard Urban b969364b7d [ci] run regression tests with AOT (#11092) 2018-10-22 12:46:20 +02:00
Zoltan Varga 5c5aef6164 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 04:06:26 -04:00
Zoltan Varga d58bf0bf41 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 04:06:03 -04:00
Zoltan Varga d7705f3fa5 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 04:05:40 -04:00
Zoltan Varga af0f521891 [jit] Profiler argument handling changes (#10885)
[jit] Profiler argument handling changes
2018-10-22 04:05:17 -04:00
Zoltan Varga 2b029b3df4 [jit] Profiler argument handling changes (#10885)
* [jit] Add support for accessing method arguments in the profiler in llvmonly mode, by generating code to store them into the MonoProfilerCallContext.args array.

* [jit] Use ctx->args instead of ctx->context for accessing arguments in the profiler.

* Update after review comments.

* [jit] Switch --trace to use the profiler infrastructure.

* Fix a rebase problem.

* Fix c++ failures.
2018-10-22 02:20:39 +02:00
Zoltan Varga aa670c98cb [wasm] Fix AOT support. (#11291)
* [wasm] Fix the creation of runtime.js in ninja mode.

* [wasm] Exit with an error code if the emscripten runtime hits an abort.

* [wasm] Error out when mono_wasm_load_runtime () fails too.

* [wasm] Wrap some code in ENVIRONMENT_IS_SHELL.

* [aot] Emit runtime invoke wrappers for up to 40 parameters for bitcode, newly added tests depend on it.

* [aot] Fix a buffer overflow in mini_get_gsharedvt_out_sig_wrapper_signature ().

* [wasm] Remove some filesystem code which is no longer needed.

* [wasm] Disable coop gc on the cross compiler, it effects the generated code.

* [wasm] Use a different random device under wasm so we can override its behavior. This is needed because /dev/random no longer works in emscripten 1.38.13 in JS shells.

* [wasm] Bump emscripten to 1.38.13.

* [wasm] Print a stack in one more abort case.

* [wasm] Add putchar to EXPORTED_FUNCTIONS, llvm-lto seems to create references to it after linking.
2018-10-21 22:44:43 +02:00
Alexander Köplinger 6a8a2059bb [Microsoft.Build.Engine] Fix race condition in TestTasks.dll compilation and embedding (#11275)
Since we've started embedding test resources inside of the test assembly
we've sometimes seen a strange error on Jenkins during the test run:

```
Msg: Error initializing task StringTestTask: Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Msg: Error initializing task StringTestTask: System.TypeLoadException: Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
  at (wrapper managed-to-native) System.RuntimeType.GetConstructors_native(System.RuntimeType,System.Reflection.BindingFlags)
...
```

However this was from an xbuild_12 run so how come it tried to load xbuild 14 stuff?

The reason is there's a race condition between when TestTasks.dll gets
built and when it's embedded inside of the test assembly.

If we're building the xbuild_12 and xbuild_14 profile at the same time
we could end up embedding the xbuild_14 version of TestTasks.dll instead
of the correct one since we're copying it to the same file name.

The fix is to remove the unnecessary copying logic since we can just tell
the compiler to embed the file under the correct name.
2018-10-21 02:09:37 +02:00
Vlad Brezae 4a6b11577f [aot] Reenable recursion checking when initing shared got entries (#11258) 2018-10-20 12:37:59 +02:00
Jay Krell 0a2b2b7b21 Disable direct x86 aot tailcalls. Except to self. (#11282)
FullAOT is hypothetically ok, but FullAOT has other problems (https://github.com/mono/mono/issues/11276).

This addresses https://github.com/mono/mono/issues/11265.
This regressed presumably https://github.com/mono/mono/commit/f5373adc8a89d4b0d1d549fdd6d9adc3ded4b400.
2018-10-19 23:44:00 -07:00
Jay Krell f87470806d Fix recently introduced warning. (#11257) 2018-10-19 23:47:51 +02:00
Bernhard Urban b104565ccf [interp] use unsigned conversion for nuint (#11259)
[interp] use unsigned conversion for nuint

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-19 17:25:33 -04:00
Jay Krell 44db64c620 Typesafe coop handles for all platforms. (#11012)
This is an alternative or precursor to https://github.com/mono/mono/pull/10212.

 - Removes the dependency of some ABIs passing a pointer and a pointer in a struct the same.
 - Therefore gives all platforms the same type safety.
 - *If* we move to C++, allows us to have member functions in coop handles.
 -  Having the coop signatures available in C can provide  benefits, though we should 
    probably generate them from reading metadata -- though they won't match w/o more changes,
    since we mixup types in several places, like IntPtr vs. pointers.

JIT now traffics in old type-unsafe handles, and wrappers are generated with C preprocessor to trivially convert.
 This way the JIT doesn't have to pass structs by value here, which was tried/failed.

The C preprocessor machinery can/should be extended for additional gains.
In particular driving managed/native coop icall transitions from 3+ per call to 1 (like https://github.com/mono/mono/pull/10212).

That will require better verification of the signatures in icall-def.h, either automated and en masses or gradually manually. Embedders will likely do something else, or at least have to independently invent similar.

Whereever a native function was exposed via multiple managed names, wrappers are reused.
2018-10-19 14:13:28 -07:00
Aleksey Kliger (λgeek) eaaf83ef92 [runtime] Don't init classes in ves_icall_RuntimeTypeHandle_is_subclass_of (#11227)
We must not get a TLE if referenced types are in an assembly that can't be
loaded.

Fixes https://github.com/mono/mono/issues/11123
2018-10-19 14:11:31 -04:00
Kenneth Pouncey 85493320e7 [wasm] Fix Sample.html so sample will run (#11242)
* [wasm] Sample program in wasm sdks does not run.

- Add `mono-config.js` reference to html file.

resolves: https://github.com/mono/mono/issues/11239

* Fix `runtime.js` to reference `mono-config.js` variables.

* Fix packager.exe where it deletes the `runtime.js`.

- Replaced the File Delete and Copy with a Copy if new call.
- re-add the generation of a skeleton  `runtime.js` file if one can not be found.
2018-10-19 20:08:56 +02:00
Alexander Köplinger e48ca0d4cc [Mono.Debugger.Soft] Fixed spaces vs. tabs in Makefile 2018-10-19 20:04:50 +02:00
monojenkins 86941b00c1 [WinForms] Propagate the flags from DrawTextInternal to MeasureTextInternal (#11262)
Flags to DrawText never reached MeasureText therefore strings with '&' were measured incorrect when drawn with flag TextFormatFlags.NoPrefix.
Fixes #6352
2018-10-19 18:09:53 +02:00
Alexander Köplinger 2d8839e704 [System] Don't throw NIE for ServicePoint.ConnectionLeaseTimeout and .ReceiveBufferSize (#11246)
* [System] Don't throw NIE for ServicePoint.ConnectionLeaseTimeout and .ReceiveBufferSize

Instead return a no-op value. This is the same behavior as .NET Core.

Fixes https://github.com/dotnet/standard/issues/642

* Bump API snapshot submodule
2018-10-19 17:48:23 +02:00
Alexander Köplinger 2c1e5292f5 Bump corefx submodule
MemberInfoTests.cs moved from System.Runtime -> System.Reflection
2018-10-19 13:37:43 +02:00
Eberhard Beilharz 5fa2df8b4d [metadata] Fix crash related to custom attributes (#10739)
* [tests] Renumber duplicate return codes

* [metadata] Fix crash related to custom attributes (#10737)

When a class doesn't contain the desired custom attribute we used
to return the last available attribute. This prevented
`cominterop_ccw_queryinterface()` to detect that the interface
isn't implemented and lead to a crash.

This change fixes #10737.

* [cominterop] Switch to GC Unsafe in IUnknown and IDispatch impls

These methods can be called directly from embedding APIs.
2018-10-19 07:03:25 -04:00
Ludovic Henry aa5438dd5d [sdks] Package what's missing for XA (#11253)
They require the additional files:
 - mono/eglib/eglib-config.h: that's to build `libmonodroid`
 - mcs/build/Consts.cs: that's to build `Mono.Posix` and `Mono.Data.Sqlite`
2018-10-19 06:57:31 -04:00
Rodrigo Kumpera 2ae12c6a0a [wasm] Fix provision-wasm to do emsdk selection. Remove the need for the emcc patch. (#11250)
[wasm] Fix provision-wasm to do emsdk selection. Remove the need for the emcc patch.
2018-10-19 04:45:41 -04:00
Vlad Brezae 7a40ab148d [interp] Remove mint_type uses at execution time (#11167)
It is too slow. Check during transform whether the class is stored on vtstack or not.
2018-10-19 10:27:00 +03:00
Kenneth Pouncey dd7ac9ddd6 Fix Duplicate assemblies in config.js file_list: [ ... ] (#11236)
resolves: https://github.com/mono/mono/issues/11187
2018-10-19 02:28:23 -04:00
Alexander Kyte 9aab5273dd Add crash reporting debugger event (#10628)
This should help get information on native crashes that happen in hard-to-debug environments. 

To quote https://github.com/mono/mono/issues/10157 : 


When a mono runtime is attached to a managed debugger and the debugged runtime is induced to cause a crash, the state of that crash is not communicated to the managed debugger. This, combined with the difficulty in having the debugged runtime both attached to the managed debugger and lldb, makes this type of crash difficult to interactively debug.

When the managed debugger is the only connection someone has with the runtime because it is embedded in a way that is resistant to unmanaged debugging (watchOS application on-device, for instance), this is an even more difficult problem.

By adding an SDB protocol event that sends a type of "runtime death" and a blob of opaque json (version dependent, no protocol guarantees), people can report these crashes without having to assist a mono runtime engineer in observing a crash on device.

In the case that spurious bugs in this manner are submitted, it will require less effort as well to spot stack frames that indicate misuse of mixed managed-unmanaged APIs (which offer the ability to drive a segfault or g_assert
2018-10-19 02:39:03 +02:00
Alexis Christoforides 4844ab019d [corlib] Import System.IO.UnmanagedMemoryStream from CoreFX (#11210)
* [corlib] Import System.IO.UnmanagedMemoryStream from CoreFX

* Bump API snapshot submodule

* [csproj] Update project files
2018-10-18 18:34:38 -04:00
Ludovic Henry bdebfe93fb [tests] Embed Mono.Data.Sqlite test resource (#11244) 2018-10-18 18:30:49 -04:00
Zoltan Varga ab18dea99b [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.
2018-10-18 23:11:31 +02:00
Jay Krell d16869c510 Remove a few raw pointers, correct some signatures, remove some unnecessary handles(). (#11211)
* Mark AddRefInternal as NOHANDLES(). Its signature was incorrect.

* Change ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal to NOHANDLES.

* Mark ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal NOHANDLES.

* ves_icall_System_Runtime_InteropServices_Marshal_BufferToBSTR to nohandles().

* ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR to nohandles().

* ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal nohandles().

* ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem nohandles().

* Fix the signature of ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMemSize.

* [coop] Remove most uses of out_of_memory_ex.
2018-10-18 22:27:03 +02:00
Ludovic Henry cb616340d0 [pipeline] Ensure only 1 build per-product is executed per-node (#11247) 2018-10-18 22:09:16 +02:00
Alexander Köplinger 229a4673d4 [ci] Move OSX .pkg build to a separate bot pool
Allows us to better utilize the bockbuild cache.
2018-10-18 16:36:01 +02:00
Alexander Köplinger d07ddffffe [Mono.Debugger.Soft] Simplify building dtest-app.exe for monodroid profile (#11229)
We only build it if we're explicitly building the monodroid profile and for the
monodroid_tools profile we only build the test assembly but not dtest-app.exe
2018-10-18 13:06:27 +02:00
Alexis Christoforides 660ca3bc70 [corlib] Ensure that Console Streams are thread-safe (#11205)
The Console class wraps the standard system stream reader/writers on construction so as to expose them as thread-safe. However, the Set-Out/In/Err methods in referencesource do not do the same when they replace default targets.

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

Possible fix for https://github.com/mono/mono/issues/11146
2018-10-17 17:10:40 -04:00
Martin Baulig 95017ad9e4 Add myself as code owner of mono/native and some managed code. (#11228)
- `mono/native`
- `/mcs/class/corlib/Mono` (dependency injector, mono native, pal, certificates)
- `mcs/class/corlib/System.Security.Cryptography.X509Certificates`
- `/mcs/class/System/Mono` (PAL, certificates and dependency injector)
- `/mcs/class/System/System.Security.Cryptography.X509Certificates`
2018-10-17 21:26:47 +02:00
Ludovic Henry a282040c96 [bcl] Build all XUnit and NUnit tests for monodroid, monotouch, monotouch_tv, monotouch_watch and wasm BCL profiles (#11201) 2018-10-17 14:44:45 -04:00
Vlad Brezae 2b64076769 [aot] Ensure shared got entries are initialized before loading methods (#11190)
Executing aot code that uses them would crash. Fixes random csc crashes.
2018-10-17 14:21:45 -04:00
Egor Bogatov 2a250915c4 [corlib] Add xunit tests for BitConverter, Convert, etc (#10758)
* Add System.Runtime.Extensions tests

* ignore Environment.UserDomainName.cs

* bump corefx
2018-10-17 07:45:55 -07:00
HebaruSan b286fe3d74 Fix MessageBox text color for dark themes (#11196)
## Problem

`MessageBox` displays as black-on-dark in a dark theme:

![image](https://user-images.githubusercontent.com/1559108/47039608-f64f2580-d149-11e8-9c1d-1dd8d99d4cb8.png)

This can be difficult to read.

## Cause

The text is drawn with a hard coded color of `Color.Black`. This assumes that the background under the text will be light to contrast with black.

## Changes

Now the color is `SystemColors.ControlText` instead, to match the background of the popup.

In a normal theme this will still be black.
2018-10-17 14:10:17 +02:00
Alexander Köplinger a2f0c286af [pkg] Add preinstall which removes existing Mono of the same version (#11203)
Fixes https://github.com/mono/mono/issues/11202
2018-10-17 12:50:11 +02:00
Alexander Köplinger 237482628a Bump api-snapshot 2018-10-17 12:35:34 +02:00
Johan Lorensson b2d0e7e8a6 Merge pull request #11100 from lateralusX/lateralusX/build-btls-msvc
Build BTLS on Windows, Visual Studio.
2018-10-17 08:39:55 +02:00
Alexander Köplinger efd6c05aef Upstream a few test related commits from my Helix work (#11197)
* [bcl] Run System.Windows.Forms.DataVisualization tests

* [bcl] Run Mono.Messaging.* tests

* [bcl] Use correct label for mdoc tests

* [runtime] Skip verifying an xunit-binaries assembly
2018-10-17 03:48:49 +02:00
Jay Krell 99c3c9ba32 Fix cygwin configure error message to match scripts/ci. (#11151) 2018-10-17 01:54:12 +02:00
Bernhard Urban 965aebf500 [ppc] fix UCONTEXT_REG macros for FreeBSD (#11128)
Contributed by @lenoil98. Fixes https://github.com/mono/mono/issues/11020
2018-10-17 01:49:47 +02:00
Alexis Christoforides d3769a73ff [corlib] Import System.IO.IOException from CoreFX (#11102)
* [corlib] Import System.IO.IOException/FileLoadException from CoreFX

* [corlib] Remove unused string

* [corlib] Remove another test assert for BadImageFormatException

Exception message no longer includes the file name
2018-10-17 01:38:30 +02:00
Alexander Köplinger 0fad97f2f3 [wasm] Use latest Microsoft.AspNetCore.App in ProxyDriver.csproj 2018-10-16 23:10:53 +02:00
Alexander Köplinger 74687a0a63 Remove azure-pipelines.yml
It was an experiment
2018-10-16 22:50:08 +02:00
Alexander Köplinger 6c7790d0a8 Move CODEOWNERS to .github folder
So all GitHub related special files are in one place
2018-10-16 21:28:05 +02:00
Martin Baulig b61a3ffb02 [System]: Reenable native Apple Certificate support on WatchOS. (#11173)
During the code refactoring this summer, support for native apple certificates
has been dropped on watchOS.

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

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

* add the `MONO_FEATURE_APPLE_X509` magic to `System/Makefile` where it was missing from.
2018-10-16 20:57:09 +02:00
Ludovic Henry 2a4cfddd9a [sdks] Build tests for BCL targets (#11141)
* [sdks] Build BCL profiles without configure flags

* [sdks] Add BclTemplate to build BCL profiles

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

* [sdks] Simplify call to BclTemplate

* [mcs] Make directory dependency as order-only

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

* [sdks] Build tests for BCL targets
2018-10-16 14:00:12 -04:00
Jonathan Chambers 36edb2f275 Take fast path only for delegate types not Delegate/MulticastDelegate. (#11182) 2018-10-16 13:14:32 -04:00
Alexander Köplinger 7a505f2e40 [mcs] Fix platform-specific build of "build" profile and remove more remnants of the "basic" profile (#11185)
The platform specific build got lost in 8d8fd97dbf but we need it for monolite. The remnants of the "basic" profile are no longer needed.
2018-10-16 19:12:13 +02:00
Ludovic Henry 0fd450ac6b [sdks] Add Groovy script to build the SDKs archives for the products (#11137) 2018-10-16 11:03:51 -04:00
Zoltan Varga 0beb087567 [WIP] [wasm] AOT work. (#11071)
* [runtime] Fix the signature of some native type tests.

* [runtime] Add stubs for the ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal () icall, needed for AOT.

* [wasm] Print a native stack trace on asserts.

* [wasm] Avoid mmaps with zero length, it leads to an exception under emscripten.

* [bcl] Preserve CustomAttributeData:.ctor (), its called from the runtime.

* [wasm] Print out full test names in the test runner.

* [wasm] Preserve System.Threading.WasmRuntim.

* [wasm] Rename config.js to mono-config.js

* [wasm] Add targets to build aot versions of the test suites.

* [wasm] Exit with a nonzero exit code in case of a failure.

* [wasm] Disable crash reporting.

* [wasm] Use mono headers for public functions.

* [wasm] Enable building AOT tests on CI.

* [wasm] Run some AOT test suites on CI.

* [runtime] Make MonoBundledAssembly.size non-const.

* [wasm] Add a --setenv=VARIABLE=VALUE argument to runtime-tests.js which allows the setting of environment variables.

* [wasm] Update cross compiler executable name.

* [wasm] Remove unused aot-driver.js file, runtime-tests.js has the same functionality.

* [wasm] Run mini tests with AOT on CI.

* [wasm] Error out if the linker fails.

* [wasm] Fix building the AOT tests from another directory.

* [wasm] Use a matching Mono.Cecil.dll for the linker.

* [wasm] Fix running aot tests on CI.

* Revert "[sdks] Switch the invocation of the offsets too to 64 bit on osx. (#10903)"

This reverts commit 2989a83f23.

This seems to cause failures on linux+webassembly.
2018-10-16 10:29:29 +02:00
monojenkins b71a4b76bb [sdks] futimens and futimes symbols are missing on anything earlier than 10.13 (#11179)
This breaks when LLVM is built on 10.13+ and the runtimes are built on 10.12.
2018-10-15 23:02:41 -04:00
Martin Baulig f973c6d90f [System] Make a test compile on mobile. (#11175) 2018-10-16 01:12:14 +02:00
Jay Krell d30c8649f1 mono_field_get_type to mono_field_get_type_internal to skip GC mode machinery (#11082)
But also optimize mono_field_get_type in the common case, to "short circuit"
and skip ditto.
2018-10-16 00:40:43 +02:00
Alexander Kyte 2d415fa1b3 [crash] Split unmanaged method pointers into method ip + offset (#11142)
The VS4M team is making a tool that makes a symbolication lookup table. This enables symbolication without access to the relevant binary. 

For unmanaged, it's much harder to precompute things because we were presenting the instruction address. From the address, any lookup needs to find the function enclosing this interior pointer.

To make it easier, this reports the address of the native method as well as the offset. A lookup table can simply key on the function start address with this now. 

ie:

  ``` 
      {
        "native_address" : "0x1003a6340",
        "native_offset" : "0x00046",
        "native_module" : "mono"
      }
```

 ```
$ nm mini/mono-sgen | grep '1003a6340' 

00000001003a6340 t _mono_runtime_run_main_checked

```

```
$ nm mini/mono-sgen | grep ' t ' | sort -n

00000001000a4e90 t _alloc_ireg
00000001000a4eb0 t _decompose_long_opcode
00000001000aae90 t _mono_decompose_long_opts
00000001000aaea0 t _mono_decompose_vtype_opts
00000001000ae130 t _m_class_get_byval_arg
00000001000ae150 t _alloc_dreg
............
```
2018-10-16 00:39:37 +02:00
Jay Krell c105cd2339 Remove GC mode transitions from mono_array_length, and replace with mono_array_length_internal. (#11122) 2018-10-15 14:07:58 -07:00
Alexander Kyte 1bc31b3ab1 [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.
2018-10-15 13:12:50 -04:00
Alexander Kyte aef45d547e [crash] Print half-completed dump when space runs out 2018-10-15 13:12:50 -04:00
Martin Baulig 51548b4d37 Initial Mono.Native Support. (#10596)
`Mono.Native` is the new name for both `System.Native` and `System.Security.Cryptography.Apple`.
It is built as a stand-alone shared library and not bundled with the runtime because we
may need to build two different versions of it.

Starting with macOS 10.12+ and iOS 10+, Apple introduced a new Unified API for some of the
crypto primitives that we're using as part of System.Security.Cryptography.Apple.

On Desktop, we can check at runtime whether the OS version is recent enough and switch
implementation accordingly.  We build a single `libmono_native` shared library.

However, on Mobile we cannot have any undefined symbols as this would break Bitcode.

During the mobile build, we are called with `CC` containing an explicit minium version flag,
which is either `-mmacosx-version-min=`, `-mios-simulator-version-min=` or `-miphoneos-version-min=`
depending on platform.

We build two versions of the shared library:
- `libmono_native_compat` is built with whichever minimum version is passed to us via `CC`.
- `libmono_native_unifed` is built with the minimum version set to macOS 10.12+ / iOS 10+.

For testing purposes, there is a function called `mono_native_get_platform_type ()`
(see mono/native/mono-native-platform.c), which returns a `MonoNativePlatformType` enum value.
There is also `Mono.MonoNativePlatform.GetPlatformType ()` (see mcs/class/corlib/Mono/MonoNativePlatform.cs).

This can be called by automated tests both to ensure that the library has been correctly installed and also
to verify that it's the correct version of it.

* `configure.ac`: add new configure checks for Mono.Native.

* `mono/native/`: new directory - this replaces the `System.Native` code that was previously in `mono/metadata`.

* `mcs/class/corlib/Mono`: New internal `MonoNativePlatformType` and `MonoNativePlatform` classes.
2018-10-15 17:38:45 +02:00
Alexander Köplinger 2ebb5efed5 Fix comment in RemoteExecutorTestBase.Mono.cs 2018-10-15 17:21:36 +02:00
lateralusX 360620a68a Additional checks for correct environment when doing msvc BTLS builds. 2018-10-15 16:51:44 +02:00
lateralusX c77084dcb8 Add lib prefix of msvc build BTLS library. 2018-10-15 14:51:22 +02:00
lateralusX d5e38af6c7 Fix BTLS build warnings on Windows. 2018-10-15 14:45:24 +02:00
lateralusX dd3e2cd0c7 Fix case insensitive compares. 2018-10-15 14:45:24 +02:00
lateralusX f8249e65be Add vcxproj to build btls as part of regular mono msvc build. 2018-10-15 14:45:24 +02:00
lateralusX 1678b9cbae Bump external/boringssl commit. 2018-10-15 14:45:23 +02:00
lateralusX c1d38347cb Build script for btls using msvc. 2018-10-15 14:45:23 +02:00
lateralusX 9761c65ae8 Fix mono btls build using msvc 2015/2017. 2018-10-15 14:45:23 +02:00
Alexander Köplinger 8d1dd6aa65 Fix Mono.Debugger.Soft to use test exe's from different directory (#11033)
And make it work for the monodroid_tools profile.
2018-10-15 14:12:19 +02:00
monojenkins fa79aa7e8b Merge pull request #11127 from lewurm/mono-ppc-sigill
[ppc] use G_BYTE_ORDER in order to define patch_load_sequence

Fixes https://github.com/mono/mono/issues/11021
2018-10-15 03:35:35 -04:00
Zoltan Varga 2989a83f23 [sdks] Switch the invocation of the offsets too to 64 bit on osx. (#10903) 2018-10-15 04:50:54 +02:00
Marek Safar 2e5d1bbe82 [metadata] Remove unused type caches 2018-10-14 08:27:44 -07:00
Maxim Lipnin 5c4e4c5084 Add check for empty string to correctly get constructors in case of name="*" 2018-10-12 18:22:08 -07:00
Maxim Lipnin 081ca12f82 [Reflection] Fixing bugs in MonoParameterInfo caught by xunit tests (#11052)
This PR fixes the bugs caught by [RawDefaultValue](https://github.com/mono/corefx/blob/411def5f278956f3c514c02ab76d9bb89428fef7/src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs#L22) and [VerifyParameterInfoGetRealObjectWorks](https://github.com/mono/corefx/blob/411def5f278956f3c514c02ab76d9bb89428fef7/src/System.Runtime/tests/System/Reflection/ParameterInfoTests.cs#L91) tests
2018-10-12 18:12:49 -07:00
monojenkins 232ed99c1c Bump API snapshot submodule 2018-10-12 18:00:46 -07:00
Zoltan Varga e5b4c144ac Fix checking the contents of the sourcelink file on windows. 2018-10-12 18:00:46 -07:00
Zoltan Varga 7f81c2776f [sdb] Add support for reading the sourcelink data from portable pdb files using a new SourceLink property on ModuleMirror objects.
Fixes https://github.com/mono/mono/issues/10038.
2018-10-12 18:00:46 -07:00
Bernhard Urban e5504fb8ea [mini helpers] strip more directives on arm (#11124)
* `-s` removes all symbols.
* `-x` removes non-global symbols.

This is needed in order to get human readable output with `MONO_VERBOSE_METHOD=method`, so instead of:

```
Disassembly of section .text:

00000000 <.text>:
   0:   e92d4900        .word   0xe92d4900
   4:   e24dd05c        .word   0xe24dd05c
   8:   e1a0b00d        .word   0xe1a0b00d
   c:   e58b0030        .word   0xe58b0030
  10:   e58b1034        .word   0xe58b1034
[...]
```

It is this now:
```
Disassembly of section .text:

00000000 <.text>:
   0:   e92d4900        push    {r8, fp, lr}
   4:   e24dd05c        sub     sp, sp, #92     ; 0x5c
   8:   e1a0b00d        mov     fp, sp
   c:   e58b0030        str     r0, [fp, #48]   ; 0x30
  10:   e58b1034        str     r1, [fp, #52]   ; 0x34
[...]
```

This is needed due to a newer toolchain on our ARM bots. Tested on armv7 and aarch64.
2018-10-12 17:23:33 -04:00
Jay Krell 697e959c6f mono_class_from_mono_type to mono_class_from_mono_type_internal to skip GC mode machinery (#11078) 2018-10-12 12:24:17 -07:00
Bernhard Urban ddf734ee52 [ppc] use G_BYTE_ORDER in order to define patch_load_sequence
Fixes https://github.com/mono/mono/issues/11021
2018-10-12 17:22:52 +02:00
Kenneth Pouncey c3999baa3d [wasm] Add support for Module.locateFile to runtime loading (#11101)
* [wasm] Fix the build.

* [wasm] Add --copy parameter to packager

- copy parameter

```

        --copy=always|ifnewer        Set the type of copy to perform
                              'always' overwrites the file if it exists.
                              'ifnew' copies or overwrites the file if modified or size is different.

```

- Fix wasm build target in do-runtime target.

* [wasm] Add support for Module.locateFile to runtime loading

See issue https://github.com/mono/mono/issues/11099 for more information.

resolves issue: https://github.com/mono/mono/issues/11099

* Fix spelling of option `ifnew` to `ifnewer`
2018-10-12 10:59:57 -04:00
Jay Krell ec623e581e Replace MONO_CLASS_IS_INTERFACE with MONO_CLASS_IS_INTERFACE_INTERNAL to avoid gc mode transitions. (#11112) 2018-10-12 07:58:04 -07:00
Jay Krell 51ebea7a48 mono_method_signature to mono_method_signature_internal to skip GC mode machinery (#11080) 2018-10-12 01:18:06 -07:00
monojenkins 656c820cf9 [2018-08] Bump msbuild (#11098) 2018-10-11 17:35:22 -04:00
Martin Baulig 3baefe7ef1 Build BTLS on Windows, cygwin/mingw. (#9306)
* Build BTLS on Windows.

* Quote more cmake paths

Should fix issue on Windows build where cmake is installed in C:\Program Files

* Fix btls cygwin x86, x64 Windows build.

NOTE, cygwin btls build depends on cygwin installed cmake, update cygwin
install to include cmake before building.

* Disable BTLS as default for Windows builds.
2018-10-11 17:25:13 -04:00
Vlad Brezae 431628cad7 [interp] Implement interpreter entry trampolines on amd64 (#10978)
* [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-11 17:18:30 -04:00
Bernhard Urban 15ae6a97ad [exceptions] continue program execution when mapping of stack overflow guard page fails (#11064)
* [exceptions] continue program execution when mapping of stack overflow guard page fails

Related: https://github.com/mono/mono/issues/10415

* turn comment into warning

* fix mono_gc_register_altstack call when no guard page is mapped
2018-10-11 17:16:17 -04:00
Bernhard Urban 288b9b0f95 [tests] lower recursion depth of PerformNoPinAction (#11065)
so it doesn't overflow the stack when running on macOS with `clang -O0`.
2018-10-11 17:15:54 -04:00
Jay Krell 0d308e5e9a x86 mono_arch_get_patch_offset: add support for 0xe9/jmp eip+32b. (#11089)
I don't know what the specific code is or what changed, etc.

This addresses Mac/x86:

https://jenkins.mono-project.com/job/test-mono-pull-request-i386-osx/15364/parsed_console/log.html

```Unable to compile method 'int Tests:calli_sig_check_2 ()' due to: 'Invalid IL code in Tests:calli_sig_check_2 (): IL_000b: calli     0x11000044```

which then fails an assert and fails overall.

CI goes deep into bash w/o echoing commands but a repro is:

 cd mono/mini
 MONO_PATH=./../../mcs/class/lib/net_4_x lldb -- ./mono --aot iltests.exe

The code is meant to be invalid, and meant to raise an exception,
which is catchable/resumable (at least in the JIT case where
executing IL the first time, can raise an exception while caller is
running, vs. AOT where the codegen all happens offline -- leaving what?
A note made at AOT time that calling the code should raise an exception?).

It isn't meant to fail an assert in either case.
2018-10-11 16:46:09 -04:00
Alexander Kyte c3fe80a0c4 [crash] Crash Reporter V2 (#10532)
This change set represents a major set of changes to the crash reporting mechanism. 

1) Coordination involving mandatory timeouts and signals have been changed greatly, to instead use semaphores and to end waiting as soon as possible. 

2) Dumping of unmanaged symbols outside of mono has been made possible. Embedders that want to get information on frames outside of mono-sgen can register the library with an icall. This carefully preserves both privacy (opt-in) and resiliency (can't crash/lose more info when misused).

3) The dumper has moved from a workflow that kills the runtime after a long delay into one that can dump individual threads or the entire runtime in a prompt manner. The runtime doesn't die at the end of the dump, but allows threads to resume what they were doing and returns to the caller. 

4) This has allowed for the addition of a number of tests that stress both parallel and concurrent dumping of threads. These run fairly quickly, and leave the runtime in a state to continue testing. 

5) With this lightweight testing setup created, a long burn-in testing period was done. Places we were using locks or trying to malloc resulted in crashes or hangs. After making the needed changes, it managed to run the dumping tests in a loop for a whole weekend on a Linux x64 configuration without any problems.

This has resulted in a dumper with dramatically improved stability and performance.
2018-10-11 16:38:21 -04:00
Zoltan Varga 92ebd1793b [wasm] Fix the build. (#11063) 2018-10-11 16:33:37 -04:00
Jay Krell 2c3ad9d458 mono_class_enum_basetype to mono_class_enum_basetype_internal to skip GC mode machinery. (#11079) 2018-10-11 12:13:23 -04:00
Jay Krell b77c6a6885 mono_class_is_assignable_from to mono_class_is_assignable_from_internal to skip GC mode machinery (#11081)
FIXME mono_class_is_assignable_from_checked
2018-10-11 09:48:16 -04:00
Jay Krell 70208087df Replace mono_object_get_class with mono_object_class to avoid gc transitions. (#11077) 2018-10-11 09:47:53 -04:00
Alexander Kyte 6b9b24c583 [runtime] Fixup stacktrace creation on s390x (#11073)
* [runtime] Fix mismatched parenthesis on exc-s390x

* [runtime] Fix mismatched static function type declaration on s390x

* [runtime] Fixup b7c18caf0c for s390x
2018-10-10 17:25:44 -04:00
Alexander Kyte b4067405d3 [runtime] Fix internal llvm (#11074)
The makefile uses $(dir $<) which has `../` and so refers to `llvm/external/llvm` rather than `external/llvm` now that we're using llvm from a submodule in external/
2018-10-10 15:46:31 -04:00
monojenkins fb7ad92db9 Merge pull request #11053 from BrzVlad/fix-interp-static-field
[interp] Optimize static field access

Do most of the work on transform side and include the field address in the instruction stream. We need to run cctor at runtime to preserve expected order. This makes static field access 4 times faster.



<!--
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-10 13:25:41 -04:00
Aleksey Kliger 6161324629 Example experiment "null" 2018-10-10 11:54:14 -04:00
Aleksey Kliger 8a0fbd4e89 Add --enable-experiment= and MONO_EXPERIMENT= support
Experiments are unsupported and provide no stability or backward compatability
guarantees.
2018-10-10 11:54:14 -04:00
Marek Safar 8d8fd97dbf [build] Unify bootstrap profiles (#11024)
* [build] Unify bootstrap profiles

We can now rely on build only as we have reliable monolite and package
compilers

* Fixes genproj dependencies

* [csproj] Update project files
2018-10-10 08:49:38 -07:00
Maxim Lipnin 831e73abcd [Reflection] Unify exception param name 2018-10-09 18:02:24 -07:00
Maxim Lipnin 98db98fe06 [Reflection] Handle overflow exception on constructor invocation (#11028)
It allows to re-enable  [Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException](https://github.com/mono/corefx/blob/master/src/System.Reflection/tests/ConstructorInfoTests.cs#L96) test and enable [TestInvoke_1DArrayWithNegativeLength](https://github.com/mono/corefx/blob/master/src/System.Runtime/tests/System/Reflection/ConstructorInfoTests.cs#L79) test.

Fixes https://github.com/mono/mono/issues/10024
2018-10-09 16:59:12 -07:00
monojenkins 53f4861c2d [csproj] Update project files 2018-10-09 16:33:53 -07:00
monojenkins d44969b5c4 Bump API snapshot submodule 2018-10-09 16:33:53 -07:00
Maxim Lipnin 58dd6ac196 Disable GetTypeTests.cs 2018-10-09 16:33:53 -07:00
Maxim Lipnin 88c68600e6 [Reflection] CoreFX import for TypeDelegator type 2018-10-09 16:33:53 -07:00
Aleksey Kliger fdfd781b4a Always use InvariantCulture calendars in X509Certificate on Mobile
Allow the linker to remove UmAlQuraCalendar and HijriCalendar on mobile devices

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

Fixes https://github.com/mono/mono/issues/10448
2018-10-09 15:47:26 -07:00
Jay Krell d4c0479362 [icalls] Declare all icalls correctly. (#11019)
It is hacky to have to avoid includes in order to have conflicting/incorrect declarations.

And hacky to use extern "C" when the reason is to have incorrect prototypes.

It is arguably hacky to suppress the gcc warning -- granted, the functions are never called, and merely their addresses taken and put into void* -- arguably gcc's warning is too strict and should only trigger for calls or taking address into a non-void*.

Arguably the declarations should be moved around the tree.

Perhaps we should omit the prototypes from C++.
2018-10-09 13:27:49 -04:00
Jay Krell b477d7dad8 [icall] Add InOut handles. Use InOut handles and Out handles more correctly. (#11042)
This is only an unenforced naming convention.
2018-10-09 13:27:28 -04:00
Zoltan Varga 1d71454132 [arm64] Pass small stack args correctly on linux. Fixes pinvoke.exe with llvm+full aot. (#10674)
* [arm64] Pass small stack args correctly on linux. Fixes pinvoke.exe with llvm+full aot.

* Bump llvm.
2018-10-09 11:37:54 -04:00
Bernhard Urban e357ef7ae8 Bump corefx
Commit list for mono/corefx:

* mono/corefx@17e9259f14 [tests] add finalizer helper to avoid false pinning (#156)
* mono/corefx@4eb1fc2abd Remove calendary dependency from X509Certificate

Diff: https://github.com/mono/corefx/compare/411def5f278956f3c514c02ab76d9bb89428fef7...17e9259f147d9b4b32394d249bf2b7aa1673e406
2018-10-09 11:33:12 -04:00
Zoltan Varga 65e207ba7c [wasm] AOT work. (#10989)
* [llvm] Fix the icall signature of a few llvm EH icalls.

* [wasm] Disable com/remoting in the linker.

* [wasm] Enable direct icalls.

* [wasm] Generate the configuration into a config.js file instead of rewriting the runtime.js file.

* [wasm] Enable icall symbol map in the cross compiler, compile the device runtime with -fexceptions.

* [wasm] Rename runtime-tests.g.js -> runtime-tests.js.

* [wasm] Add mono_wasm_assembly_get_entry_point () function to obtain the entry point of an assembly.

* [wasm] Add profiler support to the packager.

* [wasm] Add support for running a normal .net executable to the test runner.
2018-10-09 11:32:20 -04:00
Vlad Brezae 78455914e8 [interp] Optimize static field access
Do most of the work on transform side and include the field address in the instruction stream. We need to run cctor at runtime to preserve expected order. This makes static field access 4 times faster.
2018-10-09 17:38:39 +03:00
Ludovic Henry a618a1a9ea [sdks] Add cmake toolchain file for LLVM MXE builds (#11008)
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-09 08:14:20 -04:00
Egor Bogatov ed50d2560a Depend on all *_test.dll.sources for make run-test (#11030)
* depend on all test.sources for `make run-test`

* fix typo (to exclude xunit tests)
2018-10-08 21:31:03 -04:00
Ludovic Henry 8b7d80396e [llvm] Add as a submodule (#11010) 2018-10-08 18:27:20 -04:00
Alexander Köplinger a8d007e51d AOT: use 32 bit flags for as/ld when targetting x86 on linux (#11032)
So it works when running the 64bit as/ld on the host with a 32bit mono binary.
2018-10-08 18:24:04 -04:00
Jay Krell 6b3cb0d93b [Coop] Convert mono_object_clone_checked, mono_object_new_from_token, mono_class_create_runtime_vtable, mono_runtime_object_init_checked. (#11018)
* [coop] Optimize mono_runtime_object_init_handle -- don't pin non-valuetypes.

* [coop] Convert mono_runtime_object_init_checked to call mono_runtime_object_init_handle.

* [coop] Convert mono_class_create_runtime_vtable.

* [Coop] Convert mono_object_new_from_token.

* [coop] Convert mono_object_clone_checked.
2018-10-08 11:36:30 -07:00
Ludovic Henry c6ddea6c06 [mcs] Fix dependencies on mcs/class/lib/<Profile>/tests/<Profile>_corlib_test.dll.nunitlite.config (#11029)
The directory mcs/class/lib/wasm/tests wouldn't necessarily be created before we would try to copy the file to it.
2018-10-08 12:42:17 -04:00
Rodrigo Kumpera df46658fd1 [wasm] Unbreak the debugger and harden it against bad assemblies. (#11011)
* [wasm] Harden the debugger against invalid breakpoints.

This happens when you reload a page and the old BPs land in now invalid code regions.

* Add node support to library_mono.js

* [wasm] Correctly register pdb files.
2018-10-08 12:08:23 -04:00
Ludovic Henry 58228c24fa [sdks] Build Android SDKs archive in Debug configuration on master builds (#11007)
* [sdks] Build Android SDKs archive in Debug configuration on master builds

* [sdks] Drop `product-` prefix from Android and iOS SDKs CI_TAGS parameters
2018-10-08 11:46:52 -04:00
Zoltan Varga c7c89f2155 [llvm] Fix the loaded llvm build. (#11014) 2018-10-08 11:06:05 -04:00
Jay Krell b7c18caf0c Significant disambiguation between host and target. (#10969) 2018-10-08 10:38:35 -04:00
Jay Krell 58925baab1 [icalls] Change gboolean to MonoBoolean. (#11017) 2018-10-08 10:37:37 -04:00
Calvin Buckley 0d29dfb9dd Mitigation for spawn FD closing taking forever with a big FD limit (#10761)
* Mitigation for spawn FD closing taking forever with a big FD limit

On systems with a large file descriptor limit, Mono takes a very
long time to spawn a new process; with informal testing on the AIX
CI builder, (with a POWER7) it took ~30 minutes. This is obviously
very undesirable, but hand our is forced - libraries the user might
be calling could be creating non-CLOEXEC files we're unaware of. As
such, we started from the FD limit and worked our way down until we
hit stdio. Using APIs such as posix_spawn aren't desirable as we do
some fiddling with the child before we exec; and even then, closing
FDs with posix_spawn relies on non-standard file actions like
Solaris' addclosefrom not present on many systems. (All of this is
unnecessary on Windows, of course.)

This presents an alternative way (currently only implemented on AIX
but with notes how for other platforms) to try to close the child's
loose FDs before exec; by trying to get the highest number FD in
use, then work our way down. In the event we can't, we simply fall
back to the old logic.

See #6555 for a discussion and the initial problem being mitigated.

* Use an another strategy of closing only known to be open handles

...on FreeBSD and AIX.

Use the kinfo_getfiles library call on FreeBSD and only close what's
safe to close. On AIX, use the third and fourth arguments to getprocs
to check what's open. However, the array to get all the handles takes
1 MB, so allocate it on the heap; like what kinfo_getfiles does. We
don't need to free these as the child will exec or exit, which blows
it all away.

The previous strategy from previous commit is still used and on AIX,
enhanced.

* Add Linux strategy to fork FD close

Tested on WSL, shows benefits with big FD ulimit.
2018-10-08 08:31:29 -04:00
monojenkins a756fa0f4a [csproj] Update project files 2018-10-08 10:03:28 +02:00
Marek Safar cd5135022b Bump linker 2018-10-08 10:03:28 +02:00
Marek Safar 539b148920 [linker] Adds more tests 2018-10-08 10:03:28 +02:00
monojenkins e64d8aaa72 Bump API snapshot submodule 2018-10-08 10:02:16 +02:00
Marek Safar 6ca0889b3c [build] Fixes Mono.Cecil boostrap dependency 2018-10-08 10:02:16 +02:00
Marek Safar 0b003f9fa4 Bump cecil 2018-10-08 10:02:16 +02:00
Marek Safar 6070870c2d [build] Update XI facades to build against reference assemblies (#10980)
Clean up facades to build remaining ones in parallel
2018-10-07 16:37:41 -04:00
Ludovic Henry d319f72d0d [sdks] Fix wasm order-only dependency on .PHONY target (#11009) 2018-10-05 20:26:37 -04:00
Jay Krell 31c90d2817 [icalls] Replace gboolean and mono_bool by MonoBoolean. (#10948)
Though one of these is an enum, use gint32.

The enums MonoResolveTokenError and MonoProtocolType are also used in icalls, but that is left alone.
2018-10-05 21:33:06 +02:00
Jay Krell bf11fbd8d3 ifdef HAVE_ARRAY_ELEM_INIT is not actually guarding code that uses C99 array (#10996)
initialization, but rather code that is portable to C89 and C++98.

The alternative is also ok, just costs typically a pointer and a relocation per array element,
things most people wouldn't notice but was presumably the point here.
2018-10-05 21:20:16 +02:00
Alexander Köplinger 67390ef6f4 Bump corefx 2018-10-05 18:24:10 +02:00
Alexis Christoforides b8ccd4071f [corlib] Fixup for System.IO.MemoryStream CoreFX import 2018-10-05 10:49:14 -04:00
Ludovic Henry 0c776d5a9e Bump to llvm/release_60/117a508c (#10983) 2018-10-05 09:49:35 -04:00
Rodrigo Kumpera b42a6a83ad Merge pull request #10962 from kumpera/another_vtable_bug
[runtime] Properly inflate cmods of (m)var.
2018-10-05 09:26:50 -04:00
monojenkins 7d18d3d660 [bcl] Update BCL Linked Size 2018-10-05 09:39:25 +02:00
Ankit Jain 2fbfadbd9c Bump msbuild to track xplat-master (#10339) 2018-10-05 09:13:22 +02:00
Alexander Kyte 7d56ecc42c [crash] Make stub for rethrow_preserve_exception on aarch64 2018-10-05 02:04:59 -04:00
Alexander Kyte 7ca584cdc3 [crash] Fixup field name typo on untested arches (#10990) 2018-10-05 00:04:19 +02:00
Rodrigo Kumpera 84b6e89300 [aot] Add clangxx option to --aot (#10779)
* [aot] Add clangxx option to --aot that removes the hardcoded clang++ in our aot compiler.

* [mini] Make --aot addictive.

* Update CI script for bitcode.
2018-10-04 17:18:28 -04:00
Alexander Kyte dcdbf3aafc [runtime] Fix malformed string selection in exceptions-ppc.c (#10987) 2018-10-04 22:14:02 +02:00
Maxim Lipnin ab0099d393 Bump corert 2018-10-04 21:54:05 +02:00
Maxim Lipnin 90cc835df8 Bump corert 2018-10-04 21:54:05 +02:00
Maxim Lipnin 3d24f0ba99 Extract case for verifying several object array parameters to separate test method. 2018-10-04 21:54:05 +02:00
Maxim Lipnin bc4d1a18ed Add unit tests to verify custom attribute ctor with object array as parameter 2018-10-04 21:54:05 +02:00
Alexander Köplinger 8b90cefc79 Fix corefx submodule ref 2018-10-04 19:42:35 +02:00
monojenkins 3568d3648e [csproj] Update project files 2018-10-04 19:01:44 +02:00
monojenkins 0627919d75 Bump API snapshot submodule 2018-10-04 19:01:44 +02:00
Alexis Christoforides 83ad1cb3d8 [corlib] Import System.IO.MemoryStream from CoreFX 2018-10-04 19:01:44 +02:00
Rodrigo Kumpera 577ab741b2 Make a bunch of classes optional to the runtime. (#10804)
The makes the following classes optional to the runtime:

System.Reflection.CustomAttributeData
System.Text.StringBuilder
System.Math
System.Console
System.Diagnostics.StackTrace

Those are all types that can be clearly made optional. There are a lot of other types
we could, but there are deeper dependencies in places as threadpool or marshal.

* [runtime] Kill mono_defaults.console_class.

* [runtime] Kill mono_defaults.asyncresult_class. Doesn't help much as it's still needed by the TP.

* [runtime] Remove mono_defaults.stack_trace_class.

* [runtime] Remove dead field.

* [runtime] Remove mono_defaults.math_class

* [runtime] Cleanup handleref resolution to use the access macros.

* [runtime] Remove mono_defaults.stribuilder_class.

* [runtime] Remove System.Reflection.CustomAttributeData

* [corlib] Update linker description.

* [runtime] Fix compilation of the iOS SDK.
2018-10-04 18:21:40 +02:00
Alexander Köplinger d9fabd0501 [tests] Remove magic which prepends MonoTests to NUnit test selection (#10977)
When passing FIXTURE or TESTNAME to "make run-test" we automatically
prepended `MonoTests.` to the value since all of our NUnit tests
start with that to save you from typing a few chars.

Now that we have xUnit tests as well this is confusing since it doesn't
happen there. Better to remove it for consistency.
2018-10-04 17:05:25 +02:00
Alexander Köplinger 42e347ee47 [corlib] Simplify confusing "SSPI" error message and align with corefx (#10976)
Right now if anything goes wrong in the security stack you get a message like this:

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

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

Change the string to something more generic which also aligns us with CoreFX:
https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Net.Security/src/Resources/Strings.resx#L210-L212
2018-10-04 17:04:58 +02:00
Alexander Köplinger b13145bb12 [ci] Always pass sha1 from Mac to Windows packaging build
Before we only did this for PR builds but it turns out it's needed for
normal master/branch builds too.

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

Now we reset the Windows build to the sha1 which is passed to it.
2018-10-04 14:21:59 +02:00
Kenneth Pouncey a7f5952c69 [wasm][bindings] Add support for strongly typed marshalling of C# enums. (#10958)
* Add support for strongly typed marshalling of C# enums.

JavaScript does not have the concept of Enums like TypeScript.  Strings are used to represent enums.  This PR allows a strongly type contract between C# values and the string representations used by a lot of the JavaScript API's.

Example:

DOM InputElement type ->  https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type#Form_<input>_types

    The InputElement types are represented by strings.  button, checkbox, color, date, datetime-local etc....

     These string can be represented and marshalled back and forth by defining an enum as shown below with an `Export` data contract attribute.

```
    public enum InputElementType
    {
        [Export(EnumValue = ConvertEnum.ToLower)]
        Button,
        [Export(EnumValue = ConvertEnum.ToLower)]
        CheckBox,
        [Export(EnumValue = ConvertEnum.ToLower)]
        Color,
        [Export(EnumValue = ConvertEnum.ToLower)]
        Date,
        [Export("datetime-local")]
        DateTimeLocal,
   }

```

The enum conversion allows controlling the marshalling:

- Default - Marshals the enum name as is
- ToLower - Marshals the enum name to lower case string
- ToUpper - Marshals the enum name to upper case string
- Numeric - Marshals the enum numeric values.

Marshalling from C# to JavaScript using the SDK Bindings should be made as easy and pain free as possible.

Marshalling the string values from JavaScript to C# will need a little help.  The SDK Bindings Runtime provides a method to transport the string value to a strongly typed enum.

```
   WebAssembly.Runtime.EnumFromExportContract(typeof(InputElementType), inputElementType);
```

* Add marshalling of C# Enums to method calls.

* Add tests to bindings-test harness for testing marshalling of C# enum values.

* Modify test for marshalling enum value without Export contract.
2018-10-04 11:44:05 +02:00
monojenkins 385b8a2783 Merge pull request #10749 from lewurm/interp-fixes-for-native-type
[interp] fixes for native types

please look at single commits.

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

[interp] fix op_implicit/op_explicit conversions for native types
    
Conversion operators have been mostly broken in the interpreter, for example conversion from nint to float didn't work. While some conversions are easy to intrinsify (like nint -> I8), there are harder cases like nint -> decimal. The JIT actually falls back to the managed implementation, so let's do this in the interpreter as well.
    
However the managed implementation expects a pointer to the value type, i.e. the container type System.nfloat instead of float/double primitives. In such cases the value is going to be stored in a local and then the address of its storage is pushed on the stack before invoking the managed implementation of the conversion.
    
Added test cases for scenarios observed in Xamarin.iOS.

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

[interp] support ntype.CompareTo ()

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

[interp] support ntype.Equals ()

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

 [interp] support nfloat.*Infinity

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

[interp] support ntype.ToString ()

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

The conversion issue creeped everywhere in Xamarin.iOS since it heavily relies on nint/nuint/nfloat. With this PR we are getting close to a green monotouch tests 😁 
<img width="874" alt="screen shot 2018-09-21 at 23 24 36" src="https://user-images.githubusercontent.com/75403/45907566-b457eb80-bdf8-11e8-9cc7-b8cf311dd269.png">

needs backporting to 2018-06 and 2018-08
2018-10-04 11:25:35 +02:00
HebaruSan 0c2543cecf Fix default colors for DataGridView (#10944)
* Fix default colors for DataGridView

* Update tests
2018-10-04 10:54:56 +02:00
Egor Bogatov 895bf51b0c Use Mono.Android as a reference for netstandard facade (#10849)
* bump external/binary-reference-assemblies

* use Mono.Android for netstandard

* use API_BIN_REFS

* move ifeq monodroid upper

* use Mono.Android in System.Drawing.Primitives instead of ns

* fix typo

* Add Mono.Android back to ns as API_BIN_REFS

* Bump API snapshot submodule

* [csproj] Update project files
2018-10-04 10:39:21 +02:00
monojenkins 8d8587f4bc [bcl] Update BCL Linked Size 2018-10-04 09:32:05 +02:00
Alexander Kyte 19fbbda478 Merge pull request #10468 from alexanderkyte/fix_stacktrace
[runtime] Fix stored exception throws
2018-10-04 03:31:30 -04:00
Alexander Kyte e46fa20466 [crash] Fix trampoline rethrows to set caught_in_unmanaged 2018-10-03 17:11:04 -04:00
Rodrigo Kumpera e32462ed7d [mini] Add regression test for #10834. 2018-10-03 13:35:59 -04:00
Rodrigo Kumpera ccaf6a86dc [metadata] Make type dup used by inflate_generic_type be cmod aware. Fixes #10834
We didn't include cmods when inflating var/mvar cuz we'd mono_metadata_type_dup' the inflated type
and not the (m)var MonoType.

The solution is to add a variant of mono_metadata_type_dup that takes the source of cmods to use.
2018-10-03 13:25:29 -04:00
Rodrigo Kumpera 517be3d557 [metadata] Improve --print-vtable when dealing with broken types or abstract methods. 2018-10-03 13:23:28 -04:00
Bernhard Urban 7c61df97a8 [interp] introduce float R4 stack type 2018-10-03 16:57:32 +02:00
Bernhard Urban bdae608a88 [interp] support ntype.ToString () 2018-10-03 16:56:59 +02:00
Bernhard Urban 5f41720a4d [interp] support nfloat.*Infinity 2018-10-03 16:56:58 +02:00
Bernhard Urban 4cccb0dda9 [interp] support ntype.Equals () 2018-10-03 16:56:58 +02:00
Bernhard Urban 6a759dbcd4 [interp] support ntype.CompareTo () 2018-10-03 16:56:58 +02:00
Bernhard Urban bffb1163df [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-03 16:56:58 +02:00
Vlad Brezae ffb4f021bf [interp] Avoid emitting some unnecessary opcodes (#10894) 2018-10-03 10:50:27 -04:00
Rolf Bjarne Kvinge 5501111e8a [sdks/ios] Build libMonoPosixHelper for device architectures, so that zlib-helper.o is created. (#10921)
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-03 10:46:47 -04:00
monojenkins 0eea315727 Merge pull request #10672 from jaykrell/fault-addr-wasm.3
Get fault_addr in debugger stacks.

This time w/o breaking WebAssembly and w/ working on Mac.
2018-10-03 15:35:52 +02:00
Alexander Köplinger 6ad08fff9e [bcl] Put xunit tests in mcs/class/lib/PROFILE/tests too (#10928)
So they are next to their NUnit counterparts.

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

We need to use an absolute path for the xunit remote executor and it
needs to be in Windows format on Windows since we pass it as an env var
to the xunit tests.
2018-10-03 12:16:19 +02:00
Aleksey Kliger fbf43a4266 [linker] Bump to mono/linker@e6760e6f
Includes mono/linker@4dde7af5c8
to fix permissions of files created by OutputStep.

Fixes https://github.com/mono/mono/issues/10743
2018-10-03 10:27:51 +02:00
Maxim Lipnin 4905422666 [Reflection] Fix issue with finding types in module using an asterisk as filter criteria 2018-10-03 08:45:49 +02:00
Paul Hebble 7d52f0fb7e Paint ToolStrip background with ToolStrip.BackColor 2018-10-03 08:42:40 +02:00
monojenkins 82e573122a [csproj] Update project files 2018-10-03 08:38:19 +02:00
monojenkins dc42f1562f Bump API snapshot submodule 2018-10-03 08:38:19 +02:00
Marek Safar 6bcccccb82 [corlib] Control SRE using its own define 2018-10-03 08:38:19 +02:00
Marek Safar 4c20744e2a [corlib] Updates PNSE version of DynamicMethod to have matching APIs 2018-10-03 08:38:19 +02:00
Johan Lorensson c82567b6c9 Merge pull request #10646 from lateralusX/lateralusX/issue10508-diag
Fix scheduling problem related to thread-suspend-suspended and thread-suspend-selfsuspended.
2018-10-03 08:31:53 +02:00
monojenkins 8f9d781f8c [bcl] Update BCL Linked Size 2018-10-03 08:25:25 +02:00
Ludovic Henry def2d9e550 [sdks] Use make --output-sync=recurse on CI (#10939)
When building the SDKs on CI, the output is very scrambled. There are simultaneously outputs from making multiple runtimes, uncompressing some tar archives, cloning some repos, building various BCL profiles, etc. This makes it quite hard to easily understand what's going wrong when the build fails.

By using `--output-sync=recurse`, we make sure that even if many targets are executed in parallel, the output is still as if it was executed sequentially.
2018-10-02 23:42:05 -04:00
Ludovic Henry bc6d91e992 Update azure-pipelines.yml 2018-10-02 23:07:03 -04:00
Ludovic Henry cd3974f221 Update azure-pipelines.yml 2018-10-02 22:56:10 -04:00
Ludovic Henry d216896999 Update azure-pipelines.yml 2018-10-02 22:55:40 -04:00
Ludovic Henry 17ac875028 Update azure-pipelines.yml 2018-10-02 22:52:32 -04:00
Ludovic Henry 9072200e08 Update azure-pipelines.yml 2018-10-02 22:45:13 -04:00
Ludovic Henry f7c77c35f0 Update azure-pipelines.yml 2018-10-02 22:38:18 -04:00
miguel f824e73d2f [AzureDevOps] Move to Ubuntu 2018-10-02 22:36:53 -04:00
miguel 4f27bfe066 Update 2018-10-02 22:36:03 -04:00
Ludovic Henry 9e570bc053 Update azure-pipelines.yml 2018-10-02 22:34:16 -04:00
Ludovic Henry ee90fb094e Update azure-pipelines.yml 2018-10-02 22:25:26 -04:00
Miguel de Icaza 708af8c15e Set up CI with Azure Pipelines
Barebones script for the dev.azure.com/mono-project pipeline setup.
2018-10-02 22:20:59 -04:00
Aleksey Kliger (λgeek) c0d72ca8cb [w32handle] Add coop state transitions in mono_w32handle_lock_handles (#10910)
If another thread locked at least one of the other handles, and there is a
cooperative GC STW happening, this function will loop forever.

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

Fixes https://github.com/mono/mono/issues/10863
2018-10-03 00:03:49 +02:00
Vlad Brezae 84ec74a9f0 [runtime] Fix undefined pthread_main_np (#10930)
It is exported only when _DARWIN_C_SOURCE is defined.
2018-10-03 00:00:59 +02:00
Ludovic Henry 6dcc779e17 [sdks] Build llvm-llvm{,win}{32.64} on Linux on CI as well (#10937) 2018-10-02 16:53:02 -04:00
Martin Baulig f0921fd850 Use passwordless import in the X509Certificate(byte[]) constructor.
The `X509Certificate(byte[])` constructor should call `CertificateProvider.Import(byte[])`
to use the native apple implementation if possible.

Add temporary hack to `X509Certificate2(byte[])` to ensure that we always get an
`X509Certificate2Impl`.
2018-10-02 17:21:58 +02:00
Marek Safar 2b6eae3912 [linker] Reenable accidentally disabled test 2018-10-02 16:30:49 +02:00
Rodrigo Kumpera f399693f63 [metadata] Improve --print-vtable. 2018-10-02 10:24:08 -04:00
Rodrigo Kumpera 28dbdb4217 [metadata] Extract print_vtable_layout_result. 2018-10-02 10:24:03 -04:00
Rodrigo Kumpera 0919c6fd90 [metadata] print just the assembly name when dumping the vtable. 2018-10-02 10:23:59 -04:00
Ludovic Henry a67333b58f [sdks] Ensure LLVM is cloned before trying to download (#10913) 2018-10-02 08:53:24 -04:00
Maxim Lipnin f04b43a44d [Reflection] Fix the issue with ToString method in MonoCMethod type (#10901)
Fixes https://github.com/mono/mono/issues/10838.

The new behavior is similar to coreclr's one: https://github.com/dotnet/coreclr/blob/af4ec7c89d0192ad14392da04e8c097da8ec9e48/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs#L145
2018-10-02 14:29:49 +02:00
Alexander Köplinger e9de4af4d4 [ci] Remove workaround for libtiff issue
We recently updated libtiff, let's see if this is still required
2018-10-02 13:31:09 +02:00
Jay Krell b07aab167f Restore typecheck to corlib version check, so that mixing
old integer with new string errors w/o crash.
2018-10-02 11:19:27 +02:00
Alexander Köplinger 634e726bdf [packaging] Remove installation of openssl via brew on macOS (#10874)
We're now using an msbuild version which uses .NET Core 2.x which no longer needs openssl.
2018-10-02 11:10:23 +02:00
Alexander Köplinger 6145ad25fc Merge pull request #10912 from akoeplinger/test-precompile
[mcs] Fix test compilation to use common target and refactor mono-symbolicate test building
2018-10-02 11:09:35 +02:00
monojenkins d31c926a74 [bcl] Update BCL Linked Size 2018-10-02 10:45:43 +02:00
Maxim Lipnin c22ac963e9 [System.Reflection] CoreFX import for TypeInfo type (#10871)
* [System.Reflection] CoreFX import for TypeInfo type

* Bump corefx

* Bump corefx

* Bump API snapshot submodule

* [csproj] Update project files
2018-10-02 10:35:43 +02:00
Kenneth Pouncey d02ecf72b6 [wasm] Update sample.cs usage and docs (#10847)
* Fix problem with HttpClientHandler not returning the response status text if available when there is an http error.

resolves: https://github.com/mono/mono/issues/10842

* Extend C# sample to include:

- Calling JavaScript functions from C#
- Calling C# functions from JavaScript.
- Referencing JavaScript objects
- Getting and Setting JavaScrip object properties.
- Invoking JavaScript object functions.
- Setting up the default HttpClientHandler
- Instantiating a default WasmHttpMessageHandler.
- Setting up HttpClient calls
- Parsing and testing the correct results returned from the HtppClient.
- Obtaining a byte array and string array from response.
- Obtaining a reference to a global script function defined in the .html file and calling it.
- Working with DOM objects using the SDK's WebAssembly.Bindings.dll

resolves: https://github.com/mono/mono/issues/7548

* Update sample usage docs
2018-10-02 10:33:04 +02:00
Jay Krell f246511f38 [cxx] Do not define C++ keywords: bool, inline, final, it can break things. (#10883)
* [cxx] Do not define C++ keywords: bool, inline, final, it can break things.

https://jenkins.mono-project.com/job/d/421/parsed_console/log.html

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\xkeycheck.h(250): fatal error C1189: #error:  The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. [d:\j\workspace\d\msvc\libmonoruntime.vcxproj]

* PR: Leave profiler defining C++ keywords (define bool char).
* PR: Restore libgc. (mainline removed the code in 2011).
2018-10-01 22:40:15 -07:00
Alexander Köplinger f782e36a80 [mcs] Fix test compilation to use common target
Add proper dependencies to the test support files where they were missing.
Compile test files using the standard "make test" target.
2018-10-02 02:08:07 +02:00
Alexander Köplinger a7d4c2a8b9 [mono-symbolicate] Refactor so test assets can be precompiled 2018-10-02 01:58:59 +02:00
Ludovic Henry 0aebe90cac [sdks] Create archive targets for pre-building on CI (#10882)
* [sdks] Remove redundant --enable-cxx

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

* [sdks] Build BCL profiles without configure flags

* [sdks] Add BclTemplate to build BCL profiles

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

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

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

* [sdks] Run archive-llvm-llvm{,win}{32,64} on CI
2018-10-01 17:43:46 -04:00
Vlad Brezae 9182bcccc3 [runtime] Disable stack guard for main thread on osx (#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
2018-10-01 16:37:16 -04:00
Alexander Kyte 52a9b776ea [runtime] Fix off by one with stacktrace rethrow 2018-10-01 14:23:48 -04:00
Jo Shields 6f8ca69401 Merge pull request #10898 from directhex/master
Bump version to 5.21.0
2018-10-01 12:05:05 -04:00
Jo Shields bb8a0ce8e7 Bump version to 5.21.0 2018-10-01 10:21:34 -04:00
lateralusX 51affb26bc Fix scheduling problem related to thread-suspend-suspended and thread-suspend-selfsuspended.
thread-suspend-suspended and thread-suspend-selfsuspended tests has showed long
execution times on low core Windows machines running wow64. It looks like an OS
related issue where ResumeThread Win32 API takes a lot longer time to complete
when running a test scenario like thread-suspend-suspended and this additional
time adds up over many iterations pushing it over to timeout. NOTE, the same behavior
has been identified running on .NET framework, so it's not a mono specific issue and
only reproduce under wow64 on low core machines (probably when one core is busy
just leaving us with one core for most of the test).

Since the purpose of the test is to run GC when t1 is suspended, doing this more
deterministic will fix the ResumeThread issue under wow64 on low core count as
well as making the tests more deterministic, always having t1 in a suspended state
when running GC (that will test the suspend suspended scenario).

Full investigation can be found in, https://github.com/mono/mono/issues/10508.
2018-10-01 16:15:10 +02:00
Alexis Christoforides acf812f519 [MacSDK] Update libtiff (#10879) 2018-10-01 13:01:13 +02:00
Alexander Köplinger a97309722a [bcl] Fix tarball build
TestResourceHelper.cs didn't get included in the tarball.
2018-10-01 12:48:54 +02:00
Zoltan Varga 8d85c905bf [bcl] Mark ActivationServices.CreateProxyForType () with 'remoting' in the linker descriptor. 2018-10-01 12:28:54 +02:00
Marek Safar f3fecf91fb [corlib] Cleans up few static ctors 2018-10-01 09:50:19 +02:00
Marek Safar d3f78f5308 [linker] Adds more reflection tests 2018-10-01 09:50:19 +02:00
Alexander Kyte 2e15fa255f [runtime] Add test for icall wrapper rethrowing and exception length 2018-09-30 23:26:10 -04:00
Alexander Kyte cd1a48ef26 [runtime] Fix stored exception throws
On cooperative suspend, the wrapper frames capture the exception
in a MonoError, which then must be thrown. The problem with treating
it as a CIL THROW opcode is that every time you THROW, you completely
reset the stacktrace's collectin of saved frames.

The RETHROW opcode will force the JIT to rely on an in-flight exception,
that in our case has been taken our of the in-flight context.

By relying on the new MONO_RETHROW, we will take an explicit exception
and put it back in-flight without clearing the stored stacktrace.
2018-09-30 23:26:09 -04:00
Alexander Kyte 2cee721190 [runtime] Add mono_rethrow opcode 2018-09-30 23:26:09 -04:00
Jay Krell 189906da8b Disable slow (failing?) test on ARM64 FullAOT pending investigation. (#10784) 2018-10-01 00:53:50 +02:00
Alexander Köplinger 7250eef8f6 Fix tarball build due to test dependency in Microsoft.Build.Tasks
We only generate that test dll when compiling the tests, not during a
normal build.
2018-09-29 00:33:25 +02:00
Alexander Köplinger 93c0b1ae57 [tests] Reenable bug-80392.2.exe (#10873)
It should be fixed by https://github.com/mono/mono/pull/10793.
2018-09-28 16:16:02 -04:00
Alexander Köplinger afb344c155 [System.Windows.Forms] Switch tests to use embedded test resources 2018-09-28 19:52:47 +02:00
Alexander Köplinger 2ed3c07822 Merge pull request #10862 from akoeplinger/bcl-tests-embedded-resources
Switch NUnit BCL tests to use embedded test resources instead of reading from the repo

Right now a lot of our tests expect to be able to read resources directly from the repository, e.g. `File.Open ("../../resources/some-file.txt")`

In order to run these tests in a standalone, clean environment without access to the source repo we need to change that. The most straightforward way to achieve that is to embed all the resources inside of the test assemblies and extract/read them from there during test execution time.

The new TestResourceHelper helper class extracts all embedded test resources to a temporary directory and cleans them up when the test runner process exits. This allows us to make relatively small changes to the tests as opposed to rewriting them all to read directly from the embedded resource stream (which isn't even possible in all cases).
2018-09-28 19:36:52 +02:00
Zoltan Varga 8d439e3f56 [runtime] Avoid warning about missing icalls in another place. (#10813) 2018-09-28 11:40:27 -04:00
Alexander Köplinger 55bc02ccee [System.Runtime.Serialization] Use response file for test resources args
Otherwise we hit "argument list too long" errors on Windows.
2018-09-28 14:58:40 +02:00
Alexander Köplinger 5efd509300 Don't run WebMatrix.Data tests on Windows
We don't have the sqlite3 library there.
2018-09-28 11:35:56 +02:00
Rodrigo Kumpera 23c4de0522 [wasm] Cross compile the AOT compiler for windows. (#10691)
* [wasm] Add wasm-cross-win.

* [wasm] Fix dependencies between make targets
2018-09-27 22:05:05 -04:00
Vlad Brezae d887ca281f [coop] Fix deadlock when unwinding (#10793)
At the moment of a safepoint, the runtime can be holding the loader lock. Fixes gsharing-valuetype-layout.exe timeouts.
2018-09-27 22:04:21 -04:00
Alexander Kyte a7d355dd72 [merp] Fix return value handling of posix_spawn (#10823) 2018-09-27 22:00:55 -04:00
Marek Habersack 8fe211b4ce [sdks] One more update to get XA PR builds working on Linux (#10853)
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:30:40 -04:00
Alexander Köplinger f091139c56 Remove EXTRA_FILES from iOS SDKs
They are no longer needed now that all the test resources are embedded.
2018-09-28 01:23:52 +02:00
Alexander Köplinger 5c528fcaa2 [WebMatrix.Data] Switch tests to use embedded test resources 2018-09-27 22:47:59 +02:00
Alexander Köplinger 0d7aa4ff4c [Microsoft.Build.Utilities] Fix tests to not rely on repository sources 2018-09-27 22:47:58 +02:00
Alexander Köplinger e04abd912b [Microsoft.Build.Tasks] Switch tests to use embedded test resources 2018-09-27 22:47:56 +02:00
Alexander Köplinger c608757c0d [Microsoft.Build.Framework] Delete no longer used test resources 2018-09-27 22:47:55 +02:00
Alexander Köplinger c11189fa1a [Microsoft.Build.Engine] Switch tests to use embedded test resources 2018-09-27 22:47:53 +02:00
Alexander Köplinger 70a8bf5532 [Microsoft.Build] Switch tests to use embedded test resources
Also moved some xbuild test data to mcs/class/lib/net_4_x/tests/xbuild
2018-09-27 22:47:52 +02:00
Alexander Köplinger 1f3ab29158 [Commons.Xml.Relaxng] Switch tests to use embedded test resources 2018-09-27 22:47:18 +02:00
Alexander Köplinger 85c8db4edb [I18N] Switch tests to use embedded test resources 2018-09-27 22:47:16 +02:00
Alexander Köplinger 3d910b7477 [System.XML] Switch tests to use embedded test resources 2018-09-27 22:47:14 +02:00
Alexander Köplinger ebfcbad232 [System.Xaml] Switch tests to use embedded test resources 2018-09-27 22:47:13 +02:00
Alexander Köplinger bf6bc36b2e [System.Web.Services] Switch tests to use embedded test resources 2018-09-27 22:47:11 +02:00
Alexander Köplinger ca1455d58b [System.Web] Switch CacheItemPriorityQueueTest to use embedded test resources 2018-09-27 22:47:10 +02:00
Alexander Köplinger 960afe9e9c [System.ServiceModel.Web] Switch tests to use embedded test resources 2018-09-27 22:47:08 +02:00
Alexander Köplinger 5f5676ae50 [System.ServiceModel] Switch tests to use embedded test resources 2018-09-27 22:47:07 +02:00
Alexander Köplinger 01f56e7d4e [System.Security] Switch tests to use embedded test resources 2018-09-27 22:47:05 +02:00
Alexander Köplinger 8ce85205d9 [System.Runtime.Serialization] Switch tests to use embedded test resources 2018-09-27 22:47:04 +02:00
Alexander Köplinger bd687b1b5b [System.IO.Compression.FileSystem] Switch tests to use embedded test resources 2018-09-27 22:47:02 +02:00
Alexander Köplinger fcaee1689b [System.IO.Compression] Switch tests to use embedded test resources 2018-09-27 22:47:00 +02:00
Alexander Köplinger f21b2956e7 [System.IdentityModel] Switch tests to use embedded test resources 2018-09-27 22:46:58 +02:00
Alexander Köplinger 3b40965d0a [System.Drawing] Switch tests to use embedded test resources 2018-09-27 22:46:56 +02:00
Alexander Köplinger 3d08cc7e23 [System.Data.DataSetExtensions] Switch tests to use embedded test resources 2018-09-27 22:46:55 +02:00
Alexander Köplinger 662524f2e1 [System.Data] Switch tests to use embedded test resources 2018-09-27 22:46:53 +02:00
Alexander Köplinger 8da092621f [System] Switch tests to use embedded test resources 2018-09-27 22:46:52 +02:00
Alexander Köplinger 233d44227b [corlib] Switch tests to use embedded test resources 2018-09-27 22:46:50 +02:00
Alexander Köplinger 23b1249cc4 [bcl] Fix nunitlite app.config file custom logic for tests
Makes it possible to precompute these config without actually running the tests.

Allows System.Configuration tests to use a different file.
2018-09-27 22:46:49 +02:00
Jay Krell 1f3f35d2d9 Restore sqrtf/-lm accidentally deleted in https://github.com/mono/mono/commit/4259352d3a7d4b8d6b9980c4e2da844957710609 (#10785) 2018-09-27 13:15:18 -07:00
Alexander Köplinger a2bb00f75e [bcl] Add a helper for extracting all embedded test resources in an assembly 2018-09-27 21:36:19 +02:00
Alexander Köplinger f2451980a2 [tests] Disable bug-80392.2.exe and monitor-wait-abort.exe on OSX (#10846)
They frequently fail, see https://github.com/mono/mono/issues/10845
2018-09-27 15:17:07 +02:00
Marek Safar 0302d9d152 [System.Core] Removes no longer needed reference (#10827)
* [System.Core] Removes no longer needed reference

* [csproj] Update project files
2018-09-27 12:10:27 +02:00
Maxim Lipnin b0fa87ff92 [System.Reflection] CoreFX import for EventInfo type. (#10770)
Part of #9660.

The changes:
- included corefx version of EventInfo type;
- included related xunit tests from corefx System.Reflection;
- made System.Reflection/EventInfo.cs partial and left some Mono-specific stuff only there.

Some changes will be done in corefx part.
2018-09-27 12:08:32 +02:00
Johan Lorensson dbca1d90f5 Fix parameter problem in test_op_il_seq_point.sh (#10790)
Look like:

https://github.com/mono/mono/commit/e8029e1474b701184840f6e0abea51966d048831

caused issues in the parameters for this test since caller was not updated
accordingly.

This fixes so that the caller pass needed additional argument + simplify the
AOT use case for Windows since different tested versions will need different
toolchain versions that in turn will cause additional complexity. Since the
test doesn't validate the compile/link of AOT module (and don't handle errors)
anyways, Windows versions of this test will just generate assembler output.
2018-09-27 10:15:35 +02:00
Marek Habersack 757a45bcf9 [sdks] Debian Linux doesn't need to build MXE
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 09:19:30 +02:00
Jay Krell a242681d04 Assume C99 signbit is always present, and link to it via C like the rest of mono-math.h. (#10830)
MONO_API here was dubious, as all systems have it, except Visual C++ was configured away.

In Visual C++, it is in ucrt, so present in 2015 also.

More information in nearby comments.
2018-09-26 23:17:28 -07:00
Ludovic Henry d966213225 [sdks] Add download/pack capabilities for LLVM (#10806) 2018-09-26 20:13:39 -04:00
monojenkins 8c1acd45ca [csproj] Update project files 2018-09-26 11:49:51 +02:00
Maxim Lipnin 7c10d643f1 [Systen.Reflection] CoreFX import for RuntimeReflectionExtensions 2018-09-26 11:49:51 +02:00
Alexis Christoforides 3b8f0a9217 Disable some flaky tests
https://github.com/mono/mono/issues/8997
2018-09-26 11:46:51 +02:00
Jay Krell 4259352d3a [cxx] Rework C++ linkage to C99 trunc, isnan, isinf, etc. and some cleanup. (#10764)
This PR cleanups C++SDKs support and gets them all passing for the first time, esp. Android (WebAssembly already was, iOS uncertain before, green here).

* Current Visual C++ has signbit.

* Rework C++ linkage to C99 math-- trunc, isnan, isinf, etc.
Go through mono wrappers that are compiled as C.

Remove support for Visual C++ pre-2015 and non-C99 Solaris.
(Solaris has plenty of other problems compiling.)

Cleanup Windows ssize_t support.

* Remove trunc and aintl autoconfigury.
Use trunc unconditionally. (aintl is a Solaris near equivalent to trunc).

* Replace dis_isnan with mono_isnan.

* Interpreter already assumes presence of isinf and isfinite, so everywhere else might as well too.
A fair amount of cleanup therefore -- autoconf, ifdef, etc.

If this changes back, the mono_isinf, etc. wrappers are likely, but not necessarily, where to handle it for everyone, not sprinkling ifdefs and alternate implementations around -- assuming all users want the same fallback.

As well, we might want to import some good BSD libc versions of all these if there is any remaining question of portability. *Everyone* except old VAX and Cray have always used the same 32bit float and 64bit double representations since circa 1985 so these are all probably about one line of portable C89/C++98 each, maybe with endian sensitivity.
2018-09-26 05:45:59 -04:00
Zoltan Varga 352639f75a [wasm] AOT fixes (#10706)
* [wasm] Fix linker changes.

* Revert "[wasm] Enable the mini test suite under AOT. (#10670)"

This reverts commit 9cb832ff2a.

Revert this, it doesn't work yet.

* [wasm] Run AOT tests on CI.

* Fix the CI label.

* [wasm] Disable the aot test on CI, it doesn't yet run on linux.

* [wasm] Fix the computation of code_start/code_end for wasm.

* [llvm] Avoid passing a dummy extra args to wrappers which don't need it.

* [wasm] Enable gshared.

* [llvm] Fix the build.

* [llvm] Avoid passing a dummy arg to string:memcpy/bzero.

* [wasm] Enable exception catching.

* [wasm] Enable explicit division by zero checks.

* [wasm] Patch emscripten with the patch from https://github.com/kripken/emscripten/pull/7182.

* [wasm] Use '.' instead of source in the ninja build scripts since they might be ran with sh/dash instead of bash.

* [wasm] Reenable check-aot on CI.

* [wasm] Run emcc using bash -c since the emsdk_env.sh scripts contains bash-ishms.

* [wasm] Don't error out if the emscripten patch is already applied.

* [wasm] Fix do-aot-sample.

* [wasm] Disable AOT test on CI, it still doesn't work.

* [llvm] Add support for OP_RCNEQ.

* [jit] Make some tests in builtin-types.cs static.

* [wasm] Fix the return value of mono_wasm_exec_regression ().

* [wasm] Make aot-sample uses mini_tests.dll.
2018-09-26 11:29:00 +02:00
Jay Krell 7e4159b568 [Coop] Mostly convert appdomain.c. (#10733)
* [Coop] Mostly convert appdomain.c.

* Mostly don't convert mono_domain_try_unload at this time -- it was causing failures and maybe the domain swapping needs to be considered carefully with handles.

* Also a few assignments to non-local raw pointers remain, and should probably be suppressed.

See https://jenkins.mono-project.com/view/All/job/test-mono-mainline-staticanalysis-and-code-coverage/Centrinel_Report/

appdomain.c has 34 warnings. This should drop it significantly.
2018-09-25 13:45:34 -04:00
Zoltan Varga 1f6b73891e [runtime] Avoid warning about missing icalls when AOTing. Move mono_lookup_internal_call_full () to icall-internals.h (#10760)
since its not a public api function.

Fixes https://github.com/mono/mono/issues/10598.
2018-09-25 12:54:48 -04:00
Zoltan Varga f07faee174 [sdks] Add a 64 bit arm32 cross compiler build. (#10778) 2018-09-25 12:53:54 -04:00
Marek Safar addbed40a5 [corlib] Increases test timeout (#10792) 2018-09-25 12:50:58 -04:00
Rodrigo Kumpera 3e8761e5aa [wasm] Add --regression suppport for wasm. (#10740)
* [runtime] Allow strings when doing alloc-less cattr decoding.

* [runtime] Remove dead define.

* [wasm] Disable broken method under wasm.

* [wasm] Add mono_exec_regression to use mini's regression driver and make it work with WASM interp&AOT.

* [wasm] Remove dead targets. Packager is used for all test suites now.

* [wasm] Cleanup csc flags.

* [wasm] Move aot-sample to use mini_tests_basic again.

* [wasm] We no longer need to exclude FULLAOT from the test suite.

* [wasm] Expose mono_wasm_exec_regression.

* [wasm] Remove dead test driver.

* [wasm] Fix the provisioning step.

* [wasm] Bindings don't link well with the aot sample.

* [wasm] Update the test driver to include --regression support.

* [wasm] Change how regression tests are executed so we exec over aborts.

* [wasm] Appease the C++ typechecker.

* [wasm] Add more casting to make c++ happy.
2018-09-25 18:12:59 +02:00
FrozenShade666 ca0eaf0828 [WinForms] Fix bug with multiline TextBox which contains /t characters in the middle of text. (#10348)
There is wrong cursor placement after the \t character. Example:

textBox1.Multiline = true;
textBox1.Text = "aa\taa\r\nbb\tbb\r\n";
Point pt = textBox1.GetPositionFromCharIndex(4); //pt.X is wrong for index 4 or any other char after \t in the line.
2018-09-25 16:40:56 +02:00
Alexander Köplinger a90249fba1 Bump nunitlite to get xunit xml output format reporter (#10788)
* Bump nunitlite to get xunit xml output format reporter

* [csproj] Update project files
2018-09-25 15:26:01 +02:00
Alexander Köplinger 8a825b4fc6 [runtime-tests] Add xunit xml output option to test-runner.exe (#10789)
The default behavior is still to produce an NUnit xml file but we can
now produce xunit format too with the --xunit option.

Slightly refactored the xml reporting into distinct methods for NUnit/xunit.
2018-09-25 15:17:54 +02:00
Alexander Köplinger fe590b4eb0 [mcs] Add option to specify reference directory to compiler-tester (#10787)
We can use this to pass a directory the tests can use for -r or -lib.

Also fix cs1703-2.cs to not rely on binary outside repo during test.
2018-09-25 14:56:15 +02:00
Katelyn Gadd 22d5a4d552 Update roslyn automated tests (#10781)
Roslyn submodule was updated to enable more automated tests. This bumps our submodule revision, and uses roslyn's script to run tests instead of ours.

@monojenkins skip

Part of #6991
2018-09-25 13:13:28 +02:00
Alexander Köplinger 2e31adbbc8 [mcs] Add xUnit xml output option to compiler-tester (#10777)
Test result output in xUnit format can be produced by passing -resultXml to compiler-tester
2018-09-25 13:05:07 +02:00
EgorBo 1f7b49585b Add System.Runtime.InteropServices tests 2018-09-25 10:58:51 +02:00
Maxim Lipnin c63d2704b5 [System.Reflection] Include corefx unit tests from System.Reflection 2018-09-25 10:44:56 +02:00
Jay Krell b7487f8ca8 Remove hacks.h. Mostly it is unused. (#10766)
Remove hacks.h.
2018-09-24 14:48:31 -04:00
Alexander Kyte c2f2d991bd Merge pull request #10287 from alexanderkyte/nunit_telemetry
[runtime] Add standardized disk dumper for mono crashes
2018-09-24 12:32:42 -04:00
Jay Krell 06d6c4c3b3 [ci][cxx][sdks] C++ support for SDKs. (#10701)
* [ci][cxx][sdks] C++ support for SDKs.

* Remove cplusplus support, only cxx.

* [cxx][sdks] Provide isinf and isnan.
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/1/parsed_console/log.html

/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/jit-icalls.c:994:14: error: 'isinf' was not declared in this scope
  if (isinf (v) || isnan (v))

/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/jit-icalls.c:994:27: error: 'isnan' was not declared in this scope
  if (isinf (v) || isnan (v))

* Change target card mask from gpointer to mgreg_t.
Consider in future target_gsize instead, though if registers are larger than pointers (x32, arm64_32), ok.

Change inst_imm from mgreg_t to target_mgreg_t.

https://jenkins.mono-project.com/job/test-mono-pull-request-wasm-cxx/1/parsed_console/log.html

/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/mini-runtime.c:3657:24: error: cast from 'gpointer {aka void*}' to 'mgreg_t {aka int}' loses precision [-fpermissive]
   g_assert ((((mgreg_t)arg) & 1) == 0);
                        ^                                            ^~~~
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/mini-runtime.c:3658:30: error: cast from 'gpointer {aka void*}' to 'mgreg_t {aka int}' loses precision [-fpermissive]
   arg = (gpointer)(((mgreg_t)arg) | 1);

In file included from /mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/method-to-ir.c:75:0:
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/method-to-ir.c: In function 'void mini_emit_write_barrier(MonoCompile*, MonoInst*, MonoInst*)':
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/ir-emit.h:703:39: error: cast from 'gpointer {aka void*}' to 'mgreg_t {aka int}' loses precision [-fpermissive]
         inst->inst_imm = (mgreg_t)(imm);  \
                                       ^
/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/method-to-ir.c:2989:4: note: in expansion of macro 'MONO_EMIT_NEW_BIALU_IMM'
    MONO_EMIT_NEW_BIALU_IMM (cfg, OP_PAND_IMM, offset_reg, offset_reg, card_table_mask);
    ^~~~~~~~~~~~~~~~~~~~~~~

* [cxx][sdks] Move include out of extern "C" where it never belongs.

https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/4/parsed_console/log.html

  template<typename _Tp, typename _Up, typename _Vp,
   ^
/Users/builder/android-toolchain/mxe-b9cbb53/lib/gcc/x86_64-w64-mingw32.static/5.4.0/include/c++/ext/type_traits.h:205:3: error: template with C linkage
   template<typename _Tp, typename _Up, typename _Vp, typename _Wp,
   ^
In file included from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/utils/mono-compiler.h:31:0,
                 from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/utils/dlmalloc.h:33,
                 from /Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/utils/dlmalloc.c:27:
/Users/builder/android-toolchain/mxe-b9cbb53/lib/gcc/x86_64-w64-mingw32.static/5.4.0/include/c++/cmath: In function 'constexpr float std::abs(float)':
/Users/builder/android-toolchain/mxe-b9cbb53/lib/gcc/x86_64-w64-mingw32.static/5.4.0/include/c++/cmath:87:16: error: conflicting declaration of C function 'constexpr float std::abs(float)'
   abs(float __x)

* Expand cmath to wasm.

https://jenkins.mono-project.com/job/test-mono-pull-request-wasm-cxx/5/parsed_console/log.html

/mnt/jenkins/workspace/test-mono-pull-request-wasm-cxx/mono/mini/mini-llvm.c:4189:6: error: 'isnan' was not declared in this scope
  if (isnan (val))
      ^~~~~

* Provide cmath std::isnan for WebAssembly C++.

* Provide cmath std::isfinite for Android C++.

* Add cmath std::isunordered for Android

/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/interp/interp.c:3282:14: error: use of undeclared identifier 'isunordered'; did you mean 'std::isunordered'?
                        CONDBR_S(!isunordered (sp [0].data.f, sp [1].data.f) && sp[0].data.f <= sp[1].data.f)
                                  ^~~~~~~~~~~
                                  std::isunordered

* Add cmath std::isinf for Android.

https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/10/parsed_console/log.html

/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/interp/interp.c:3751:8: error: use of undeclared identifier 'isinf'
                        if (isinf (sp [-1].data.f))

* "using std::isinf" sometimes breaks on Android, sometimes fixes Android,
because Android sometimes has global isinf.

/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-android-cxx/mono/mini/interp/interp.c:92:12: error: target of using declaration conflicts with declaration already in scope
using std::isinf;
           ^
/Users/builder/android-toolchain/toolchains/arm64-v8a-clang/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../include/c++/4.9.x/cmath:604:3: note: target of using declaration
  isinf(double __x)
  ^
/Users/builder/android-toolchain/toolchains/arm64-v8a-clang/bin/../sysroot/usr/include/math.h:234:6: note: conflicting declaration
int     (isinf)(double) __pure2;

There are still some errors in new lanes (WebAssembly works, Android does not, iOS not sure), to be addressed shortly, possibly by redoing some of the cmath stuff.
2018-09-23 23:18:23 -04:00
Jay Krell 3f63bad14e [w32handle] Fix duplicated handles for WaitAny and WaitAll (#9114)
* mono_w32handle_wait_multiple: Duplication is ok for WaitAny, exception for WaitAll.
Fixes https://github.com/mono/mono/issues/9089

* Duplicate detection in mono_win32_wait_for_multiple_objects_ex, like mono_w32handle_wait_multiple.

* Move wait duplicate tests from mono/tests to mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs.

Run them with e.g.:

`PATH="/s/mono2/runtime/_tmpinst/bin:/Users/jay/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/jay/bin" MONO_REGISTRY_PATH="/Users/jay/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="" MONO_PATH="./../../class/lib/net_4_x-macos/:./../../class/lib/net_4_x-macos//tests:./../../../external/xunit-binaries:.:$MONO_PATH" /s/mono2/runtime/mono-wrapper --debug    ./../../class/lib/net_4_x-macos/nunit-lite-console.exe  ./../../class/lib/net_4_x/tests/net_4_x_corlib_test.dll    -exclude=NotOnMac,MacNotWorking,NotWorking,CAS  -format:nunit2 -result:TestResult-net_4_x.xml -test:MonoTests.System.Threading.WaitHandleTest.DuplicateWaitAll`

`PATH="/s/mono2/runtime/_tmpinst/bin:/Users/jay/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/jay/bin" MONO_REGISTRY_PATH="/Users/jay/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="" MONO_PATH="./../../class/lib/net_4_x-macos/:./../../class/lib/net_4_x-macos//tests:./../../../external/xunit-binaries:.:$MONO_PATH" /s/mono2/runtime/mono-wrapper --debug    ./../../class/lib/net_4_x-macos/nunit-lite-console.exe  ./../../class/lib/net_4_x/tests/net_4_x_corlib_test.dll    -exclude=NotOnMac,MacNotWorking,NotWorking,CAS  -format:nunit2 -result:TestResult-net_4_x.xml -test:MonoTests.System.Threading.WaitHandleTest.DuplicateWaitAny`

Find the full names with:

`PATH="/s/mono2/runtime/_tmpinst/bin:/Users/jay/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/jay/bin" MONO_REGISTRY_PATH="/Users/jay/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" DBG_RUNTIME_ARGS="" MONO_PATH="./../../class/lib/net_4_x-macos/:./../../class/lib/net_4_x-macos//tests:./../../../external/xunit-binaries:.:$MONO_PATH" /s/mono2/runtime/mono-wrapper --debug    ./../../class/lib/net_4_x-macos/nunit-lite-console.exe  ./../../class/lib/net_4_x/tests/net_4_x_corlib_test.dll    -exclude=NotOnMac,MacNotWorking,NotWorking,CAS  -format:nunit2 -result:TestResult-net_4_x.xml -explore`

and look at the resulting .xml file.

I ran them w/ and w/o the fix, verify they both failed w/o and passed w/.
(w/o the fix was a slight hack of the fix)

* Move null checks so other uses can still null dereference.

* Short circuit duplicate search, correct either way.

* Fix windows build -- missing include.

* Add MonoError to mono_win32_wait_for_multiple_objects_ex, probably did this earlier but lost it somewhere in git.

* Add missing include.

* Follow shorter convention of rest of directory.

* Make the code slightly more complicated per PR.

* PR: Split into small used-once functions.

* cleanup

* add static

* PR: sizeof (array [0]) vs. sizeof (type)
2018-09-22 15:40:12 -07:00
Zoltan Varga fdad617285 [llvm] Remove an incorrect assert. (#10750) 2018-09-22 12:06:14 -04:00
Jay Krell 6e14e1899d Fix iOS SDK regression due to empty library. (#10754)
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-ios/4837/parsed_console/log.html

ld: warning: -undefined dynamic_lookup is deprecated on tvOS
ar: no archive members specified
usage:  ar -d [-TLsv] archive file ...
    ar -m [-TLsv] archive file ...
    ar -m [-abiTLsv] position archive file ...
    ar -p [-TLsv] archive [file ...]
    ar -q [-cTLsv] archive file ...
    ar -r [-cuTLsv] archive file ...
    ar -r [-abciuTLsv] position archive file ...
    ar -t [-TLsv] archive [file ...]
    ar -x [-ouTLsv] archive [file ...]
make[5]: *** [libmono-system-net-security-native.la] Error 1
2018-09-22 11:55:34 -04:00
Jay Krell 3e74629d11 [Coop] Convert or partially convert mono_domain_try_type_resolve_typebuilder, mono_domain_try_type_resolve, mono_domain_try_type_resolve_name. (#10675)
* Convert or partially convert mono_domain_try_type_resolve_typebuilder, mono_domain_try_type_resolve, mono_domain_try_type_resolve_name.

In order to use TYPED_HANDLE_DECL, this required splitting handle.h into at least two pieces,
here called handle-decl.h and handle.h.

A fair amount of early returns had to be converted.

* PR: Move mono_domain_try_type_resolve_name from domain-internals.h to reflection-internals.h.
Move mono_domain_try_type_resolve_typebuilder ditto.
Move ves_icall_TypeBuilder_create_runtime_class from object-internals.h to reflection-internals.h.
Move TYPED_HANDLE_DECL (MonoReflectionAssembly) from handle-0.h to reflection-internals.h (previously object-internals.h)
Move TYPED_HANDLE_DECL (MonoReflectionTypeBuilder) ditto.

Add MONO_HANDLE_BOOL to handle.h so we can 1. Stop inverting tests and 2. Prefer
	true first in ternary.
	x = MONO_HANDLE_BOOL (y) ? z : 0
	instead of
	x = MONO_HANDLE_IS_NULL (y) ? 0 : z

Add include "reflection-internals.h" to mono-security.c
Add include "reflection-internals.h" to security.h

object-forward.h:
	Place MONO_RT_MANAGED_ATTR on MonoReflectionTypeBuilder.
		Really it should just be MonoObject, and then implied
		by everything that contains it.
	Place MONO_RT_MANAGED_ATTR consistently.
	Sort by native then managed.

mono_reflection_get_type_with_rootimage: Rename assembly to refection_assembly
and then use assembly to reduce occurences of MONO_HANDLE_GETVAL (assembly, assembly).

mono-security.c: include config.h unconditionally and just once.

* Change mono_class_get_ref_info_raw to return MonoReflectionTypeBuilder* instead of MonoObject*.
Remove casts on mono_class_get_ref_info_raw calls.

Change mono_class_get_ref_info to return MonoReflectionTypeBuilderHandle instead of MonoObjectHandle.

Move mono_class_get_ref_info from object-internals.h to reflection-internals.h.

Use mono_class_get_ref_info instead of mono_class_get_ref_info_raw.

* Cleanup -- MONO_HANDLE_BOOL and contains instead of cast.

* PR: Fix incorrect comment. Fix precise GC hole wrt invoke.
2018-09-21 16:20:48 -07:00
Ludovic Henry 5cb2ef2cc0 [sdks] Fix llvm-llvm32 build (#10611)
* [sdks] Fix llvm-llvm32 build

* [wasm] Make sure we compile wasm-cross as 32bits
2018-09-21 15:29:56 -04:00
Ludovic Henry 16dec74ede [sdks] Run Android tests on CI (#10577)
It's assuming a device or emulator is already attached or running. On our CI, a new emulator is automatically started at the beginning of the job and shutdown at the end of it.
2018-09-21 14:57:31 -04:00
Marek Habersack 4a2c6c26de [SDKS] Build host runtime with correct bitness (#10711)
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-21 14:26:33 -04:00
Alexander Kyte 70c2a07a76 [crash] Fix summarize_frame assertion (#10723) 2018-09-21 10:34:15 -04:00
Kenneth Pouncey 87e56c36b9 Add nuspec for generating the WebAssembly Framework NuGet package. (#10712) 2018-09-21 09:03:11 -04:00
Marek Safar ff1dab57b0 [corlib] Makes remoting test more robust (and disable it on mobile) 2018-09-21 13:24:40 +02:00
monojenkins 3aff9473f4 [csproj] Update project files 2018-09-21 11:23:27 +02:00
Marek Safar 96af472795 [bcl] Removes Mono.CSharp from most mobile profiles
It's no longer needed as a dependency of Microsoft.CSharp and it has
no stable API
2018-09-21 11:23:27 +02:00
Martin Baulig b31eec8c1e [System]: Make sure HttpWebRequest observes exceptions on timeout. #10488. (#10595)
* [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-21 09:57:17 +02:00
Egor Bogatov e162fdaede [System.Data] use PAL_gssapi.c for SSPI (#9922)
PAL_gssapi.c was converted to C recently in corefx but since our fork is not up to date I copied `PAL_gssapi.c` and `PAL_gssapi.h` into mono/metadata (I guess I should just cherry-pick those files to our fork).
For System.Data it will allow users to connect to sql servers using SSPI (Security Support Provider Interface).
See https://github.com/mono/mono/issues/9028 and https://github.com/mono/mono/issues/9751
on macOS (and iOS) it uses built-in GSS.framework.
on Linux it requires an additional package (`krb`) to be installed (see .NET Core prerequisites, e.g. https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x#ubuntu). 
Unfortunately it's not installed on our CI yet.
2018-09-21 09:51:41 +02:00
monojenkins 39ecb27fc9 [bcl] Update BCL Linked Size 2018-09-21 09:09:02 +02:00
Jay Krell 59824272bf Strengthen _MonoImage.image_info from void* to MonoCLIImageInfo*, and remove the casts on every use. (#10676)
* Strengthen _MonoImage.image_info from void* to MonoCLIImageInfo*, and remove the casts on every use.

* Fix typo.
2018-09-20 22:40:26 -04:00
Jay Krell ab69814598 Some cleanup in appdomain.c. (#10686)
* Some cleanup in appdomain.c.
 - Combine exit paths.
 - npaths is always incremented, so remove test against 0 (assuming no overflow).

* Change g_strdelimit first parameter from string to character.

* Fix C++ -- goto around init.

* PR: Restore legacy types gint, gchar.
2018-09-20 22:38:50 -04:00
Alexander Kyte 5d96cdb7ca [runtime] Use guint64 for MonoStackHash everywhere 2018-09-20 20:57:26 -04:00
Alexander Kyte 128cdf7f88 [runtime] Add icall to format crashes to disk in uniform way 2018-09-20 20:57:25 -04:00
Marek Safar c2113246b9 [mcs] Adds sourcelink option (as unsupported) 2018-09-20 17:34:58 +02:00
monojenkins 980545e9f2 [csproj] Update project files 2018-09-20 17:03:08 +02:00
monojenkins 3bcb4f2dc6 Bump API snapshot submodule 2018-09-20 17:03:08 +02:00
Maxim Lipnin f3fcdc2b83 Bump corefx 2018-09-20 17:03:08 +02:00
Maxim Lipnin 547eac471f Bump corefx 2018-09-20 17:03:08 +02:00
Maxim Lipnin f00e90d588 [System.Reflection] CoreFX import for ParameterInfo type 2018-09-20 17:03:08 +02:00
lateralusX 311d64ad80 Temporary disable thread-suspend-suspended.exe and thread-suspend-selfsuspended.exe
Only on Windows x86 while investigating root cause of failure (not replicating outside CI).
2018-09-20 10:18:55 -04:00
Miguel de Icaza 7542f6231d [man] Add to mono.1 information about MONO_TLS_PROVIDER 2018-09-20 09:55:05 -04:00
monojenkins 929d528d8c [csproj] Update project files 2018-09-20 13:17:12 +02:00
monojenkins 3a1221354d Bump API snapshot submodule 2018-09-20 13:17:12 +02:00
Niklas Therning 866995d8fc Bump corert 2018-09-20 13:17:12 +02:00
Jay Krell 0cf1a2b4a8 [Coop] Convert assembly.c. (#10677)
See https://jenkins.mono-project.com/job/test-mono-mainline-staticanalysis/Centrinel_20Report/.
2018-09-20 00:17:14 -07:00
Jay Krell afe20fe67b [Coop] Convert dynamic-image.c. (#10681)
See https://jenkins.mono-project.com/job/test-mono-mainline-staticanalysis/Centrinel_20Report/.
2018-09-20 00:14:40 -07:00
monojenkins 6b1d8a6a80 [bcl] Update BCL Linked Size 2018-09-20 08:58:16 +02:00
Nikolay Sivov 9153553b65 [mini] Fix some compiler warnings. (#10644)
* [mini] Remove unused variable.

* [mini] Remove unused variable.

* [mini] Remove unused variable.

* [mini] Fix enum comparison warning.
2018-09-19 22:19:43 -04:00
Jay Krell 05009a40df [cxx] Fix C++ compilation regression. (#10702)
Caught by Aleksey Kliger.

transform.c(4251): error C2664: 'MonoReflectionType *mono_type_get_object_checked(MonoDomain *,MonoType *,MonoError *)': cannot convert argument 2 from 'gpointer' to 'MonoType *' [d:\j\workspace\d\msvc\libmono-dynamic.vcxproj]

Cast from void* to non-void*.
2018-09-19 16:20:06 -04:00
Zoltan Varga d2eeeb033f [wasm] Add beginnings of linker support in AOT mode. (#10636)
* [wasm] Add beginnings of linker support in AOT mode.

* Fix the compilation of monolinker.exe.

* Link in libmono-icall-table.a as well.

* Copy monolinker.exe instead of building it.
2018-09-19 12:20:24 -04:00
Rolf Bjarne Kvinge d2d8bb81cf [mono-api-html] Fix rendering of nuint. (#10662) 2018-09-19 12:19:00 -04:00
Rolf Bjarne Kvinge e297740cdf [mono-api-html] Render something for fields with marshalling info. (#10663)
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 12:18:20 -04:00
Zoltan Varga 65a97f8fc1 [offset-tool] Error out when parsing fails. (#10690) 2018-09-19 12:17:01 -04:00
Rodrigo Kumpera 9cb832ff2a [wasm] Enable the mini test suite under AOT. (#10670)
* [wasm] Enable the mini test suite under AOT.

* [wasm] Remove aot-driver.js as it's not needed anymore.
2018-09-19 12:16:01 -04:00
Kenneth Pouncey 7c7dcdb5a9 Add ninja build to the skds wasm build dependencies documentation. (#10683)
resolves https://github.com/mono/mono/issues/10682
2018-09-19 12:15:22 -04:00
Kenneth Pouncey c207ebcc35 [wasm] Rename sdks WebAssembly framework libraries. (#10639)
* Rename sdks WebAssembly framework libraries.

Rename:

- bindings.dll -> WebAssembly.Bindings.dll
- wasmhttp.dll -> WebAssembly.Net.Http.dll

resolves: https://github.com/mono/mono/issues/10620

* Fix package step

* Fix package step for WebAssembly.Net.Http.

 Fixed the package step that was failing due trying to include wasmhttp.pdb instead of WebAssembly.Net.Http.pdb.
2018-09-19 12:15:04 -04:00
Jay Krell 5614bdddce [Coop] Convert w32mutex-unix.c. (#10680)
See https://jenkins.mono-project.com/job/test-mono-mainline-staticanalysis/Centrinel_20Report/
2018-09-19 12:04:28 -04:00
Marek Safar 9265996e0b [build] Another make dist fix (#10688) 2018-09-19 11:58:35 -04:00
Zoltan Varga 1c80a9aaa3 [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes. (#10096)
* [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes.

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

* Use TARGET_SIZEOF_VOID_P.
2018-09-19 11:39:27 -04:00
Rodrigo Kumpera dd74d8d932 [wasm/gc] It's valid to register for finalization an object without a finalizer. Don't register for fin objects added to refqueues under sgen. (#10649)
* [wasm/gc] It's valid to register for finalization an object without a finalizer. Don't register for fin objects added to refqueues under sgen.

The refqueue change undo part of 87fb34d18a.

This is due to how track resurrection weak refs are implemented under boehm and sgen. Sgen natively supports them so we don't
need to emulated it by registering them for finalization. This produces a lot of useless work for the GC.

* [wasm] Enable SRE.
2018-09-19 11:35:11 -04:00
Zoltan Varga 13a86a83e2 [bcl] Avoid retaining System.Globalization.CultureInfo.CreateCulture () in mscorlib.xml, its not longer used by the runtime. 2018-09-19 15:37:50 +02:00
monojenkins 630cdfb2f8 Merge pull request #10660 from BrzVlad/fix-interp-typeof
[interp] Optimize ldtoken + GetTypeFromHandle pair

As we do with jit. Improves speed of typeof operator by 10-15 times.



<!--
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-09-19 07:05:04 -04:00
Marek Safar 767c2e32bc [System] Improves test failures reporting from TP threads 2018-09-19 10:09:33 +02:00
monojenkins 1df38917fe Merge pull request #10652 from lewurm/interp-safepoints
[interp] add safepoints and enable hybrid suspend as default

Fixes https://github.com/mono/mono/issues/10260
2018-09-18 20:15:03 -04:00
Jay Krell b2fc9cc12d Fix uninitialized read reported by valgrind. (#10630) 2018-09-18 16:46:29 -04:00
Zoltan Varga 1349da3368 [sdb] Avoid calling into the debuggee from VirtualMachine.GetObject () while holding the objects_lock. (#10650) 2018-09-18 15:07:40 -04:00
Jay Krell c76bacba17 Combine MONO_ATTRIBUTE_NO_OPTIMIZE and MONO_NO_OPTIMIZATION. 2018-09-18 10:27:33 -07:00
Jay Krell cb4d25dec2 Move MONO_SIG_HANDLER_DEBUG from mono/utils/mono-signal-handler.h to
mono/mini/mini-runtime.c so it can use the correct ifdefs
which should fix WebAssembly compilation and let it work on
Mac and Win32 also. This means we no longer need HOST_LINUX in configure.ac either.

Note that for Win32 we don't have the same sort of execution
of a debugger for this to help, but you can see it works
if you run in a debugger and break on mono_sigsegv_signal_handler_debug.
2018-09-18 10:24:18 -07:00
Rodrigo Kumpera 5bfe7a5d1b Merge pull request #10627 from kumpera/wasm-build-work
[wasm] Move test suite to use ninja
2018-09-18 12:37:57 -04:00
Jay Krell 7c191c1370 Get fault_addr in debugger stacks. 2018-09-18 09:35:35 -07:00
Jay Krell b690f2d3d1 Move signal handler stuff out of ifdef except MONO_SIG_HANDLER_INFO_TYPE since it was all the same. 2018-09-18 09:35:35 -07:00
Jay Krell 86ee99f6b3 Use MONO_SIG_HANDLER_INFO_TYPE in two places so that Win32 and Posix are otherwise identical. 2018-09-18 09:35:35 -07:00
Jay Krell 2aaeae2354 Provide MONO_ATTRIBUTE_NO_OPTIMIZE in mono-compiler.h. 2018-09-18 09:35:35 -07:00
Vlad Brezae 5f21fe213e [interp] Optimize ldtoken + GetTypeFromHandle pair
As we do with jit. Improves speed of typeof operator by 10-15 times.
2018-09-18 16:58:36 +03:00
Kenneth Pouncey 20a662fcb9 Add wasm-cross to .gitignore. (#10666) 2018-09-18 09:40:16 -04:00
Marek Safar dc41ecd86e [build] Fixes make dist (#10640)
* [build] Fixes make dist

* Update Makefile
2018-09-18 14:23:05 +02:00
Egor Bogatov 5a55842715 fix resolvemember crash 2018-09-18 14:18:36 +02:00
Bernhard Urban 409504d0c4 [interp] consolidate checkpoint and safepoint into one opcode 2018-09-18 14:16:44 +02:00
Bernhard Urban bcdfb53734 [interp] add safepoints and enable hybrid suspend as default 2018-09-18 14:16:44 +02:00
Ludovic Henry ad603864f8 Revert "Get fault_addr in debugger stacks. (#9673)"
It broke Linux WebAssembly.

This reverts commit a6712d05be.
2018-09-18 13:56:16 +02:00
EgorBo 565985dbd7 Implement IEnumerable for ConditionalWeakTable 2018-09-18 10:24:26 +02:00
Neale Ferguson cd70e9cf2a Fix s390x Outarg_VT (#10632)
* Fix outarg_vt processing. Fixes #10549

* Cleanup unused bits and pieces

* Correct the handling of structures being retuned from a call

* Restore vtcopy code etc.
2018-09-17 22:35:51 -04:00
Rodrigo Kumpera 2646cf41df Merge pull request #10624 from kumpera/dont-mmap-for-assemblies
[wasm] Switch to mkbundle style mono_register_bundled_assemblies instead of relying on emcc filesystem emulation. Fixes #10603.
2018-09-17 18:42:31 -04:00
Zoltan Varga d00adcc077 [wasm] Compile the runtime with --disable-icall-tables and explicitly link in libmono-icall-table.a. This will allow linking out unused icalls in the future in full-aot mode. (#10637) 2018-09-17 15:03:13 -04:00
monojenkins 3ca3d5b609 Merge pull request #10554 from vargaz/fix-17590
[llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm.

Fixes https://github.com/mono/mono/issues/10527
2018-09-17 14:45:11 -04:00
Jay Krell a6712d05be Get fault_addr in debugger stacks. (#9673) 2018-09-17 11:25:01 -07:00
Rodrigo Kumpera 3b18995587 [wasm] Address reviewer feedback. 2018-09-17 09:41:57 -04:00
monojenkins 5d99724884 Merge pull request #10638 from nsivov/mini_fixes
[mini] Fix unused variables warnings
2018-09-17 07:45:04 -04:00
Nikolay Sivov 6a921395b0 [mini] Fix strict prototype warning. 2018-09-16 23:46:59 +03:00
Nikolay Sivov 1bad9adea6 [mini] Remove unused function. 2018-09-16 23:45:25 +03:00
Nikolay Sivov f3f63d40d6 [mini] Remove unused variables in mini-amd64.c. 2018-09-16 23:39:42 +03:00
Nikolay Sivov 64f6fab44b [mini] Fix unused variables warnings. 2018-09-16 23:29:44 +03:00
Nikolay Sivov fde2326351 [mono] Fix unused variables warnings in interp.c. 2018-09-16 23:24:33 +03:00
Nikolay Sivov c756616bdd [mini] Fix a couple of unused function warnings. (#10634)
This simply moves them to conditional block where they are used.
2018-09-16 22:15:21 +02:00
Maxim Lipnin 6202bdfb39 [Reflection] Use a type of actual argument in case when custom attribute ctor parameter is of System.Object type. 2018-09-16 19:13:30 +02:00
Jay Krell d589f3b64f Fix MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy (Linux/amd64/FullAOT/LLVM). (#10615)
* mono_aot_get_unbox_trampoline: amd64 compute unbox trampoline size correctly via runtime disassembly.
This fixes: MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy frequently crashing on FullAOT/LLVM/Linux/amd64 CI.

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

Race condition because the code varies in what actually runs.
Sometimes System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT is called,
sometimes not.

FullAOT+LLVM for obvious reasons.

Very sensitive to exact code presumably because the bug depends on whether the first
unbox trampoline has the same size as the unbox trampoline for System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT?
For example, this could be the only unbox trampoline or it could be first.

For example System_Security_Cryptography_ECCurve_get_Oid gets the first unbox trampoline and compiling it with mini or LLVM makes a difference.

Guessing here:
When the first unbox trampoline is 9 bytes in size and
System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
is 6 bytes in size, then System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT's
unbox trampoline, which comes right before System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
is thought to be 9 bytes also, which overlaps System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT.

So the binary search finds that, which goes wrong somehow -- mono_aot_find_jit_info returns NULL (for reasons not debugged).

And then we fail to wrap System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
with a gsharedvt trampoline.

In the normal course when things work, calling System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT
goes through both gsharedvt_out_trampoline and gsharedvt_trampoline.

The first turns a byref into a byvalue, the second turns it back into a byref.
When the second is skipped, we end up treating the value as a pointer and SIGSEGV.
This can be seen using https://github.com/mono/mono/pull/10582.

mini amd64 unbox trampolines are always 9 bytes -- 4 byte add, 5 byte jmp
LLVM amd64 unbox trampolines vary 6 or 9 -- 4 byte add, 2 or 5 byte jmp.

There are *many* possible ways to fix this.

1. Runtime disassembly to measure the trampoline size, each trampoline, allowing just two variations. This was written, tested, works. Downside is inhibits breakpoints, at an unlikely time and place, and inhibits execute only memory protection, also unlikely. Looks a little gnarly, but really is not.

2. Get the assembler to output fixed size trampolines.
This is known for GNU assembler -- (disp32) jmp and jmp.d32.
This is not known for Apple assembler, either the older cctools or LLVM, but maybe.
The problem *seemed* to be Linux only, but the underlying causes do not.
If this were looked into more closely and a Linux-specificity actually found, then depending on GNU as is more reasonable.

3. Output object files instead of assembly text. Good and bad idea otherwise. Super non-trivial.

4. Construct the tramp_info at compile time, with compiler/assembler/linker-computed size. This should be possible and otherwise beneficial, but not trivial, and not super beneficial, only mildly.
const static data/code is generally prefer over dynamic.

5. Don't bother with the trampinfo at all. It should not be needed, even for stackwalk, as these are leaf functions (don't change nonvolatiles), so stackwalk is just *rsp++.
Good idea for another day, as it is a simple net reduction in code, pending testing a not easy  to test case -- need to make a function that just jmps to self, point a thread at it, wait till it gets there, suspend it, and stackwalk it. A good exercise, for another time.

6. Pad out trampolines to at least 9 bytes by adding 3x 0xcc.
Sometimes 12 bytes.
And hardcoding size as 9 at runtime -- don't use the actual computed size, as it could be 12, apply that to a 9 byter, and back with the same problem.

That is one incorrect solution in there -- just merely adding 3 bytes of padding seemed at first like a good idea, but would not likely work.

7. Or rather, no need to pad, hardcode to 6 at runtime.

8. Or rather, hardcoding to 5 suffices. Interior bytes of last instruction need not be described, pretend it is of size 1. 2 is no more accurate than 1, when some of them are actually 5.

9. Can hardcode in compiler or runtime.
Both developed, easy.

10. Try current assemblers. Maybe the original reason to switch from 0xe9 to jmp is moot.
But continue to work with old assemblers? (in a test-only scenario?)
Not attempted.

11. Use separate source files to help achieve distance or assembler ignorance of distance.
Not attempted.

12. Move all the trampolines adjacent, with 128 bytes of padding on either end.
Not attempted.

13. Asserting the trampolines are 16-aligned would maybe work. And/or following them with a 16-aligned entity.

Here we option 9, hardcode to 5 in the compiler. It is essentially a one line change.

Removing the trampinfo and testing async stack walk is left as a future change.
This is really the best option but has more significant test burden.

* Increment MONO_AOT_FILE_VERSION to invalidate old bad images.
The badness is borderline -- limited to FullAOT+AMD64+LLVM, which is nonexistant outside test environments. This version should probably be a guid also.
2018-09-15 00:03:22 -07:00
Rodrigo Kumpera c954819325 [wasm] Move test-suite to be ninja based. 2018-09-14 17:09:29 -04:00
Rodrigo Kumpera 9d7d7702d8 [wasm] Don't copy assemblies when emitting ninja plus handle --assets with it. 2018-09-14 17:07:20 -04:00
Zoltan Varga 6174666e47 [llvm] Fix a crash when trying to pass a vtype of size 0 on arm64. Fixes generic-constrained.2.exe. 2018-09-14 22:14:05 +02:00
Kenneth Pouncey 240407a06f Update the sdks WebAssembly build instructions after recent AOT changes. (#10618)
- Update the gitignore for wasm-runtime
- Document automake 1.16.1 dependency. resolves https://github.com/mono/mono/issues/10446

closes https://github.com/mono/mono/issues/10614
2018-09-14 14:48:31 -04:00
Rodrigo Kumpera 1dcdbee477 [wasm] Switch to mkbundle style mono_register_bundled_assemblies instead of relying on emcc filesystem emulation. Fixes #10603.
This saves us from using twice as much memory for assemblies due to emcc filesystem retention polity and it avoid bugs in its
mmap emulation code.
2018-09-14 14:06:24 -04:00
Jay Krell 776e311414 Fix possible bug where empty array is not nul-terminated. (#9723)
It is not clear how this should be represented.

https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createprocessa

"Note that an ANSI environment block is terminated by two zero bytes: one for the last string,
one more to terminate the block.
A Unicode environment block is terminated by four zero bytes: two for the last string,
two more to terminate the block."

Is unambiguous however.
2018-09-14 10:16:35 -04:00
Kenneth Pouncey 7babdc92ea [WASM] [bindings] Add support for an HttpMessageHandler that works for WASM. (#10464)
* Add support for:

- Get global object - This allows developers access to variables of javascripts global space.  For example the window object in the Browser.
- Add reference counting to the javascript object registry in the bindings.  This can prevent a javascript object that is in the object registry from being removed unexpectedly.
- Add AddRef and ReleaseRef to manage object registry reference counting if it is needed.

* Add support for an HttpMessageHandler that works for WASM.

- Needs real world testing before we decide to make this a default.
- Depends on the delivered bindings.dll and the bindings support built.
- Due to the bindings dependency there is no need to add extra javascript library to the build.
- Works only through a browser session at this time as it works directly with window.fetch.

* Free the Task Completion Source after the promise completes.

* There are some headers that can only be attached to the Content's Headers.

- If the header returned from fetch can not be added to the response header then try to add it to the Content headers.
- Fix misspelling in binding_support.js

* Remove reference counting from bindings.

- Remove object disposal from WasmHttpMessageHandler.

* Add bindings.dll requirement to wasmhttp.dll build.

* Clear the HttpResponseMessage after setting the TaskCompletionSource so it can be garbage collected.
2018-09-14 08:25:23 -04:00
Bernhard Urban 500746f0dd [interp] move thread attach to interpreter entry (#10579)
* [interp] move thread attach to interpreter entry

We want to attach a thread before any TLS operation is done by the
interpreter. In the JIT this happens inside the native-to-managed
wrapper via `mono_threads_attach_coop ()`. Unfortunately, this is too
late for the interpreter as it already requires a working TLS before
even calling into the wrapper.

Also, fixup naming of locals in the native-to-managed wrapper.

* [interp] do not propagate uninitialized ThreadContext to JIT TLS

* [interp] fix memory corruption around pinvoke wrapper allocation

* [interp/jit] fix memory leak in pinvoke wrapper allocation
2018-09-14 08:24:16 -04:00
Zoltan Varga 99ae0cc076 [amd64] Increase max size of OP_LMUL_IMM. (#10593) 2018-09-14 08:22:43 -04:00
Zoltan Varga 866997e5ab [runtime] Fix Marshal.SizeOf (typeof (void)). (#10599)
Fixes https://github.com/mono/mono/issues/10303.
2018-09-14 08:21:50 -04:00
Kenneth Pouncey 8fe989cb70 [WASM] Make test-suite use generated driver and bindings. (#10558)
* Make test.js use generated driver and bindings.

- bindings_tests.dll uses the generated bindings.dll.
- Modify packager to accept a template parameter that overrides the default `runtime.g.js`.
- Modify the tests to call runtime.js in the test-suite directory
- The runtime.js is automatically created in the test-suite library so no need to do extra copies.
- resolves https://github.com/mono/mono/issues/10244

* Add -template option to packager

- Part of merge conflict resolution

* Add -asset option that allows an extra asset to be copied to the output directory.

-   --asset=x       Add specified asset 'x' to list of assets to be copied
- An asset option needs to be specified for each asset to be copied.
2018-09-13 10:10:31 -04:00
monojenkins 15bcc4f55d Merge pull request #10472 from Unity-Technologies/debugger-ref-returns
Handle ref returns in runtime invoke wrappers.

Indirectly load ref return values in invoke wrappers and return by value.
Don't share wrappers with ref returns since indirect load is used.
Add soft debugger support for methods with ref returns.
2018-09-13 07:55:03 -04:00
Martin Baulig 6e75b0c5aa [System]: Fix WebResponseStream.ReadAllAsyncInner() return value.
We need to call `ToArray()` instead of `GetBuffer()` to truncate the buffer
to the amount of bytes that we actually read.
2018-09-13 13:14:46 +02:00
monojenkins bcb547a54b [csproj] Update project files 2018-09-13 09:55:06 +02:00
monojenkins 56a3c651bd Bump API snapshot submodule 2018-09-13 09:55:06 +02:00
Marek Safar e3eff6f2a6 [Facades] Adds System.Buffers mobile facade
and sets up facades without corresponding nuget _._ for conflict
resolution done by msbuild
2018-09-13 09:55:06 +02:00
Marek Safar e830b55f05 [mcs] Adds cloning for default literals 2018-09-13 09:49:54 +02:00
Maxim Lipnin ef7b83779d [System.Reflection] Fix the issue with constructing DllImportAttribute data (#10568)
* [System.Reflection] Fix the issue with constructing DllImportAttribute data

* Remove redundant cast; update default case in switch-blocks
2018-09-13 09:44:52 +02:00
Jay Krell 06e79ffb16 Make enum values obvious. (#10553) 2018-09-13 00:19:40 -07:00
Aleksey Kliger (λgeek) c2a94b3bab [interp] Add declaration for set_context (#10575) 2018-09-12 15:07:03 -04:00
Aleksey Kliger (λgeek) 766dacef22 Drop JIT attach: use coop attach in mini, aot and interp (#10545)
* [metadata] Hack - get mono_use_interpreter from metadata

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

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

Always use the mono_threads_coop_attach/mono_threads_coop_detach pair.

* [aot] Drop MONO_PATCH_INFO_JIT_THREAD_ATTACH

We always emit the mono_threads_attach_coop icalls now.

Bump MONO_AOT_FILE_VERSION

* [mini] mark mono_jit_thread_attach external only

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

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

There shouldn't be any other callers.

* [interp] Add a thread attach EE callback

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

* [marshal] Always emit mono_threads_attach_coop instead of CEE_MONO_JIT_ATTACH

Use the coop icall for the interpreter, too.

* [interp] Drop MINT_MONO_JIT_ATTACH and detach opcodes

* [metadata] Drop CEE_MONO_JIT_ATTACH and detach opcodes

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

This reverts commit c3d2f488b824dcdfa261f8292013c805740f353f.

* [mini] Drop unused mini_jit_thread_attach_interp

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

* [coop] Switch to GC Safe in mono_jit_thread_attach.

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

* [interp] Add MINT_MONO_THREADS_ATTACH_COOP opcode

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

* fixup for c++ build

* fixup indentation and comments

* fixup C++ a bit more

* [mini] Bump MONO_EE_API_VERSION

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

This reverts commit 8a343d6ce15f0475a62936f28264f638ebf0344f.

* [interp] sync jittls context before entering EH machinery
2018-09-12 14:57:54 -04:00
Zoltan Varga 49cd56f0d1 [arm64] Fix the alignment of valuetypes passed after small primitive types on IOS. (#10525)
Fixes https://github.com/xamarin/xamarin-macios/issues/4347.
2018-09-12 14:01:03 -04:00
Katelyn Gadd 2abb347ffa Fix forceBuild not working for projects with unknown platform names (i.e. jay) (#10485)
* Fix forceBuild not working for projects with unknown platform names (i.e. jay)

* Clean up error messages
2018-09-12 13:58:34 -04:00
Filip Navara c5ffbed4a9 Treat EXDEV from clonefile the same way as ENOTSUP. (#10528) 2018-09-12 13:56:09 -04:00
Zoltan Varga c16d994d31 [jit] Add an intrinsics for BitConverter.IsLittleEndian. (#10531) 2018-09-12 13:55:40 -04:00
Zoltan Varga 5db745545a [wasm] Pass ac_cv_func_shm_open_working_with_mmap=no to the wasm runtime's configure. Fixes compilation on linux. (#10563) 2018-09-12 13:36:11 -04:00
Bernhard Urban b6f4cc72b8 [interp] get context refactor (#10561) 2018-09-12 13:34:27 -04:00
Bernhard Urban cfa5e8d535 [ci] do not hardcode CPU count (#10560)
getconf should work on both, macOS and linux.

Fixes https://github.com/mono/mono/issues/10506
2018-09-12 13:32:59 -04:00
monojenkins f4df4c8422 Merge pull request #10552 from lewurm/wasm-enable-test_0_arm64_dyncall_vtypebyrefonstack
[wasm] enable test_0_arm64_dyncall_vtypebyrefonstack

It works on my machine. Test was introduced by https://github.com/mono/mono/pull/10517/
2018-09-12 12:15:04 -04:00
Jonathan Chambers ce0a5c4d79 Handle ref returns in runtime invoke wrappers.
Indirectly load ref return values in invoke wrappers and return by value.
Don't share wrappers with ref returns since indirect load is used.
Add soft debugger support for methods with ref returns.
2018-09-12 10:55:42 -04:00
Zoltan Varga 370d740f5f [llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm. 2018-09-11 22:52:27 +02:00
Zoltan Varga 350d063e2a [wasm] Ongoing AOT work. (#10541)
* [wasm] Rename 'wasm-aot' to 'wasm-cross' for consistency with the other SDKs.

* [wasm] Use the separate libmono-ee-interp.a library for linking in the interpreter.

* [wasm] Unify interp and aot runtimes.

* [wasm] Avoid cleaning the emscripten toolchain when cleaning the runtime or cross compilers.

* [wasm] Use the sdk llvm targets to build the cross compiler, so it can use a downloaded llvm instead of building its own.

* [offset-tool] Add WASM support.

* [wasm] Generate offsets file for wasm.

* [wasm] Switch packager.exe to use Mono.Options, add a --mono-sdkdir option to specify the path to the mono sdk.

* [wasm] Emit a ninja build file from the packager when the --builddir argument is given.

* [wasm] Auto generate the aot registration code by generating a driver-gen.c file and including it into driver.c.

* [wasm] Add emcc link step to the ninja build script.

* zoltan's changes.

* [wasm] Fix merge conflicts from picking Zoltan's patches.

* [sdks] Fix the wasm build so the package target doesn't build 394839840 llvms.

* [wasm] Fix mono_arch_create_specific_trampoline to work with the AOT compiler reverse lookup of icalls

* [wasm] Don't set minimum memory size, let it dynamically grow.

* [wasm] Remove old aot targets. Now do-aot-sample does the whole magic.

* [wasm] Attept at making the offsets-tool work on linux.

* [wasm] Cleanup the hacks early in this PR.

* [wasm] Fix rebase issue.

* Fix rebase

* Fix rebase

* [llvm] Only emit the dummy arg when targeting wasm.
2018-09-11 16:32:53 -04:00
Nikolay Sivov 9f0099ea1f [mini] Fix some of unused variable warnings. (#10500)
* [mini] Fix unused variable warning.

* [aot] Remove unused variables.

* [mini] Remove unused block.

* [mini] Fix unused variable warning in aot-runtime.c.

Failed returned value implies that error info has been set.

* [mini] Remove unused variable.
2018-09-11 16:28:49 -04:00
Jay Krell f32cca7b6d [cxx] Jenkins support for Windows C++. (#10515) 2018-09-11 12:24:01 -07:00
Bernhard Urban 55360b50e6 [wasm] enable test_0_arm64_dyncall_vtypebyrefonstack 2018-09-11 21:10:53 +02:00
monojenkins b8c8305104 Merge pull request #10428 from jaykrell/mono_pages_not_faulted
Remove unused mono_pages_not_faulted, autoconf for mlock instead of mincore.
2018-09-11 15:05:04 -04:00
Maxim Lipnin d733790420 [System.Reflection] CoreFX import for PropertyInfo type. (#10537)
Part of #9660.

The changes:
- included corefx version of PropertyInfo type;
- included related xunit tests from corefx System.Reflection;
- moved `GetPropertyFromHandle `method to MonoProperty type;
- moved `internal_from_handle_type `extern method and related icall to MonoProperty type;
- fixed some edge cases where exception is expected;
- removed obsolete System.Reflection/PropertyInfo.cs.
2018-09-11 14:41:36 +02:00
Zoltan Varga 37c5f35ed2 [bcl] Move the mono specific code in BitConverter to a partial class. (#10534)
* Move the mono specific code in BitConverter to a partial class. Depends on https://github.com/mono/corefx/pull/134.

* Bump corefx.

* Update BitConverter.cs

* Update BitConverter.cs

* Update BitConverter.cs

* [csproj] Update project files
2018-09-11 14:32:43 +02:00
Marek Safar f86d17c0b9 [build] Clean up no longer needed rules and conversions (#10546)
* [build] Clean up no longer needed rules

* [build] Add at least basic dependency tracking to .dep_dirs-

* Update rules.make
2018-09-11 14:05:55 +02:00
Zoltan Varga c0b8bdc809 [arm64] Add dyncall support for ArgVtypeByRefOnStack arguments.
Fixes https://github.com/mono/mono/issues/10483.
2018-09-11 08:58:06 +02:00
Jay Krell 1d8954083f [cxx] Leave output directory alone as other places run it. (#10520) 2018-09-10 01:16:08 -07:00
Marek Safar e872684c4d [build] Enable more BCL build parallelization (#10486)
<!--
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-09-09 09:16:41 +02:00
Aleksey Kliger (λgeek) bd15b2dbee [ci] run tests if building with C++ (#10519) 2018-09-08 09:00:09 -04:00
Ludovic Henry 97f207a569 [MonoAotOffsetsDumper] Remove --monodroid argument (#10512)
It's dead now
2018-09-08 08:58:39 -04:00
Alexis Christoforides 1b163d62d0 [System.IO] Enable CoreFX FilesystemWatcher on Android (#9766)
* [System.IO] Enable CoreFX FilesystemWatcher on Android
This was the last user of the 'InotifyWatcher' Mono implementation, so this is also removed.

* [csproj] Update project files
2018-09-07 23:33:03 -04:00
Marek Safar 08426bcd19 [System.Net.Http] Allow empty value in ProductHeaderValue (#10511)
Fixes #10227
2018-09-07 23:52:39 +02:00
Jasonsjiang 8e95a2e508 fix timeout when poll fail with the error EINTR (#10017) 2018-09-07 16:38:04 -04:00
Maxim Lipnin 2f8a6b5bdd [System.Reflection] Make GetFieldOffset method virtual to fix issue with custom FieldInfo type. 2018-09-07 08:57:03 +02:00
Zoltan Varga 64bfec630b [offsets-tool] Remove the obsolete '--maccore=' argument, its not used anymore. (#9910)
* [offsets-tool] Remove the obsolete '--maccore=' argument, its not used anymore.

* Fix indentation.
2018-09-06 18:59:43 -04:00
Nikolay Sivov bac2da316d [monograph] Fix unused variable warning. (#9920) 2018-09-06 18:57:24 -04:00
Zoltan Varga 8ab6291f34 [sdb] Disable an assert to avoid breaking debugging. (#9981)
Fixes https://github.com/mono/mono/issues/8848.
Fixes https://github.com/mono/mono/issues/9262.
Fixes https://github.com/mono/mono/issues/8627.
2018-09-06 18:55:41 -04:00
Filip Navara fe98c3b9a1 Ensure the finalization in DeflateStream is performed in the correct order. (#10330)
* 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:50:50 -04:00
Johan Lorensson 0f3af38ee4 Fix Mono Windows cross compiler using mono LLVM release_60 branch. (#10413)
* Fix Mono Windows cross compiler using mono LLVM release_60 branch.

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

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

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

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

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

* Fix inversion of aarch64codegen libs.

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

* Fix incorrect checks when compiling Windows cross compiler.

Windows cross compiler could have a target that is !TARGET_WIN32 but still
running on a Windows host, so check needs to look at !HOST_WIN32 to determine
if Unix source files can be included or not.
2018-09-06 18:47:58 -04:00
Jérémie Laval 362d1d94e1 [wasm] Misc fixes/improvements (#10471)
* [metadata] Fix Thread.Yield icall function signature

The signature exposed on the C# side has a boolean return but the actual C implementation used to be marked as void.

This caused an issue with the WASM backend as the interpreter would try to jump to the icall using an `MINT_ICALL_V_P` opcode. Since emscripten does function pointer jumps based on a function signature key and the signature mismatched on the C side, the jump would fail triggering the `nullFunc_i(x)` on the mono.js side.

* [wasm] Add facade resolving to packager tool

* [wasm] Use correct mono_bindings_init syntax to initialize bindings library
2018-09-06 18:47:17 -04:00
Vlad Brezae 837a9ae981 [interp] Don't abort in critical wrappers (#10484)
* [interp] Remove some duplicated code

* [interp] Don't abort in critical wrappers

Fixes premature exiting of special threads due to aborts (like threadpool threads), instead of catching exception and resuming to native code.
2018-09-06 18:46:02 -04:00
Johan Lorensson 4acd1419c8 Add C++ compiler support option for some msvc build projects. (#10487)
By default, all projects are build using "default" compiler based on source
file extension. There is a property in mono.props, MONO_COMPILE_AS_CPP
 that could change this and build selected projects (eglib, libgcmonosgen,
libmini, libmono-dynamic, libmono-static, libmonodac, libmonoruntime,
libmonoutils, mono, monodis, monograph and pedump) using C++ compiler.

MONO_COMPILE_AS_CPP property could be set when calling msbuild
or through VS property manager IDE. Default value is false building using
"default" compiler (current behavior). When setting MONO_COMPILE_AS_CPP=true
the build prefix will be altered to make sure the C++ build gets its own build
folder, parallel to default build folders.

Example of building using C++ compiler from msbuild:

msbuild /p:PlatformToolset=v140 /p:Platform=x64 /p:Configuration=Release /p:MONO_TARGET_GC=sgen /p:MONO_COMPILE_AS_CPP=true msvc/mono.sln
2018-09-06 18:45:35 -04:00
Egor Bogatov 16f554307f [corlib] Replace System and other namespaces with CoreFX sources (#9744)
Simple types for now just to see the API-DIFF, more types later.

Part of #8131
2018-09-06 19:41:56 +02:00
monojenkins 5147d4863f [csproj] Update project files 2018-09-06 18:53:55 +02:00
monojenkins 1943d7bf60 Bump API snapshot submodule 2018-09-06 18:53:55 +02:00
Maxim Lipnin d372582256 Bump corert 2018-09-06 18:53:55 +02:00
Maxim Lipnin 8e09242807 [System.Reflection] CoreFX import for CustomAttributeNamedArgument type. 2018-09-06 18:53:55 +02:00
Filip Navara c63e12669d Fix DeflateStream handling of zero-length reads from underlying stream. 2018-09-06 18:38:22 +02:00
Rodrigo Kumpera d21d00b366 [corlib] Don't decrement ConditionalWeakTable::size on remove. (#10477)
We can't decrement the size on removal as we use tombstones.
When using tombstones, the invariant to keep is on the number of null entries as those
are used as search stop-marks.

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

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

Additionally, clear the array to null entries, otherwise we fall into the above trap even more easily.
2018-09-06 11:08:07 -04:00
Martin Baulig 0c7e4b378e [sdb]: Properly version the CMD_TYPE_GET_METHODS_BY_NAME_FLAGS change.
This adds proper versioning to the wire change that was introduced in #9762.

Fixes #10412.
2018-09-06 13:52:13 +02:00
monojenkins b4961c559e [bcl] Update BCL Linked Size 2018-09-06 12:12:01 +02:00
Jay Krell 40c785c918 [cxx] More extern "C" per errors and a missed cast. (#10474)
* [cxx] Add more extern "C".
This is triggered largely from  https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-ios/4452/consoleFull
and look for "referenced from".

* [cxx] Missed a cast due to late change.

* PR: Restore mono_fmod to extern C++.
2018-09-05 22:34:46 -04:00
Jay Krell 2c8569acf6 [cxx] A few fixes for Microsoft Visual C++ (#10444)
* gmisc-win32.c(136): error C2664: 'HRESULT SHGetKnownFolderPath(const KNOWNFOLDERID&,DWORD,HANDLE,PWSTR *)': cannot convert argument 1 from 'const GUID *' to 'const KNOWNFOLDERID
REGUID is const GUID& in C++, const GUID* in C*.
It is impossible to have portable C/C++ that deals with this.
This feels like a mistake, but it is ancient and not changing.

* gpath.c(102): error C2440: '=': cannot convert from 'const char *' to 'char *'
Add const, like in the non-Windows case right before.

* sgen-gc.c(1381): error C4576: a parenthesized type followed by an initializer list is a non-standard explicit type conversion syntax
A inline function would trivially portably standardly solve this,
but wrap in compiler-specific pragma to suppress.

* [cxx] abi.c(60): error C2059: syntax error: '.'
Remove designated initializer.
2018-09-05 12:46:48 -07:00
Vlad Brezae 958a639b12 [tests] Bump timeout for System.Numerics with interpreter
New tests were included recently
2018-09-05 11:21:12 -04:00
Jonathan Chambers 7c19f9d443 Avoid deadlock during GC. Check for GC_DONT_GC environment variable at startup rather than during collection with world stopped since g_hasenv may take OS locks and encounter deadlock. (#10466) 2018-09-05 07:23:22 -04:00
monojenkins 1feb9eeb4c Merge pull request #9961 from nsivov/warning_fixes
[mono] Compiler warnings fixes

This fixes a bunch of warnings in threads.c. Compare-exchange cast is unfortunate because it would do without if we had platform long sized cas helper around - tid is always u32 on Windows (DWORD), and pthread_t is always long int, which could be 32 or 64 bit.
2018-09-05 07:15:09 -04:00
Jay Krell cff5aefe1d [cxx] Adapt typesafe coop handles for standard/Visual C++. (#10443)
* Adapt typesafe coop handles to be valid standard C++. i.e. valid for Visual
C++, w/o gcc/clang language extension __typeof__. This is not meant to be
long term idiomatic C++, just enough to get us by for now.

The solution does not quite work for type unsafe handles, because
checking for this == NULL is not defined. A non-member function
would be needed.

C++11 decltype could be used instead at the MONO_TYPEOF_CAST level,
but this solution is trivial C++98.

Visual C++ historically was seen to have trouble giving names
to member functions of anonymous types -- an unusual construct.
So the previously anonymous structs are given a name here.

* Go back to anonymous type.

https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-ios/4408/parsed_console/log.html

  CC       libmonoruntimesgen_la-method-builder-ilgen.lo
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/marshal-ilgen.c:6403:29: error: use of undeclared identifier 'MONO_OFFSET_MonoObjectHandlePayload___raw'; did you mean 'MONO_OFFSET_MonoObjectHandle___raw'?
                        mono_mb_emit_ldflda (mb, MONO_HANDLE_PAYLOAD_OFFSET (MonoObject));
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 MONO_OFFSET_MonoObjectHandle___raw
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/handle.h:426:42: note: expanded from macro 'MONO_HANDLE_PAYLOAD_OFFSET'
                                         ^
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/handle.h:425:50: note: expanded from macro 'MONO_HANDLE_PAYLOAD_OFFSET_'
                                                 ^
/Users/builder/jenkins/workspace/test-mono-pull-request-amd64-osx-products-sdks-ios/mono/metadata/abi-details.h:56:42: note: expanded from macro 'MONO_STRUCT_OFFSET'
                                         ^
<scratch space>:89:1: note: expanded from here
2018-09-05 01:08:53 -07:00
Alexander Köplinger 64a2075d37 [ci] Fixup last commit to run-test-mac-sdk.sh
Actually for this we shouldn't pass CFLAGS etc at all since that is
handled by bockbuild.
2018-09-05 09:59:39 +02:00
Alexander Köplinger 0e5a7816e7 [ci] Fix run-test-mac-sdk.sh build
0dbcdd5c28 added CFLAGS etc in front of the
command but that's not something the TESTCMD can execute.

We need to pass those variables to the whole process.
2018-09-05 09:57:43 +02:00
Maxim Lipnin d5a419f6c8 [System.Reflection] CoreFX import for CustomAttributeTypedArgument type. (#10450)
Part of https://github.com/mono/mono/issues/9660

The changes:
- included corert version of CustomAttributeTypedArgument type;
- included related xunit tests from corefx System.Runtime;
- updated corert/Type.cs to have some required properties from corert Type.Internal.cs;
- removed obsolete System.Reflection/CustomAttributeTypedArgument.cs;
- moved back "array case" handling in CustomAttributeTypedArgument ctor (via related PR);
- re-enabled "Arrays" test in CustomAttributeDataTest on mobile.
2018-09-05 09:51:01 +02:00
Jay Krell 1521da3b1e [cxx] [metadata] Convert to be valid C and C++. (#10432)
* [cxx][metadata] Cast from void.

* [cxx][metadata] Casts, mostly from void*.

* [cxx] [metadata] MONO_BEGIN_DECLS / MONO_END_DECLS only in public headers.
G_BEGIN_DECLS / G_END_DECLS are ok in private headers (and .c), but the vast majority of uses are not needed. In this case, every function is MONO_API anyway.

* [cxx] [metadata] Add template for mono_mb_emit_native_call under #ifdef __cplusplus.

* [cxx] [metadata] Loosen the parameter type in mono_vtype_get_field_addr from guint8* to gpointer.

* [cxx][metadata][profiler] Add G_ENUM_FUNCTIONS (MonoProfilerCallInstrumentationFlags), outside of the public header MonoProfilerCallInstrumentationFlags is defined in.

* [cxx][metadata][profiler] Cast void* to function pointer MonoProfilerCallInstrumentationFilterCallback.

* [cxx][metadata] Cast from void*.

* [cxx][metadata][sgen] Change sgen_client_root_registered(source) from int to enum MonoGCRootSource.

* [cxx][metadata][sgen] Change report_conservative_roots(root_report_address) from char* to void*.

* [cxx][metadata][sgen] In mono_gc_register_obj_with_weak_fields, cast parameter from void* to MonoObject*.

* [cxx][metadata][sgen] In sgen_client_gchandle_created and sgen_client_gchandle_destroyed, cast handle_type from int to MonoGCHandleType. This could be better.

* [cxx][metadata][sre] In mono_dynimage_encode_constant, change local box_val from char* to void*.

* [cxx][metadata][sre] Change  swap_with_size(dest, val) from {,const}char* to {,const}void*. Move function starting brace to its own line.

* [cxx][metadata][sre] encode_cattr_value(argval) from char* to const void*.

* [cxx][metadata][sre] Add ICALL_EXPORT to ves_icall_TypeBuilder_create_runtime_class.

* [cxx][metadata] Templatize mono_thread_create_internal and mono_thread_create_checked. FIXME: Fix the parameter type and inputs.

* [cxx][metadata][threads] Cast from void* to MonoCoopMutex*.

* [cxx] Fix return type of  start_wrapper_internal -- guint32 vs. gulong.

* [cxx][metadata] In start_wrapper_internal, cast function pointer to void*. Later we should get all the types correct.

* [cxx][metadata] Fix return type of start_wrapper from gsize to mono_thread_start_return_t.

* [cxx][metadata] create_thread: Remove cast on first parameter to mono_thread_platform_create_thread.

* [cxx][metadata] Add ICALL_EXPORT on ves_icall_System_Threading_Thread_GetPriority.

* [cxx][metadata] g_cast does not allow for ternary operator though it could with one line; add casts to workaround; remove cycle optimization from error path, favoring smaller code.

* [cxx][metadata] ves_icall_System_IO_MonoIO_Read, ves_icall_System_IO_MonoIO_Write: Change relatively untyped data from char* to void*.

* [cxx][metadata] Add parentheses around define INVALID_HANDLE_VALUE to avoid surprises.

* [cxx][metadata] In mono_w32handle_convert_wait_ret, cast between int and enum MonoW32HandleWaitRet. We could also give up on enums for this type.

* [cxx][metadata]ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal: Add cast to HWND.

* [cxx][metadata] Cast to HMODULE. Add const.

* [cxx] w32process.h: Add missing ICALL_EXPORT.

* [cxx][metadata] w32socket-win32.c: add const on string literals.

* [cxx] mono_w32socket_recvbuffers: cast to LPWSAOVERLAPPED and LPWSAOVERLAPPED_COMPLETION_ROUTINE.

* [cxx] mono_w32socket_send: cast from void* to char*.

* [cxx]mono_w32socket_sendbuffers cast to LPWSAOVERLAPPED and LPWSAOVERLAPPED_COMPLETION_ROUTINE.

* [cxx] mono_w32socket_getsockopt cast from void* to char*.

* [cxx] mono_w32socket_setsockopt cast from const void* to const char*.

* [cxx] mono_w32socket_ioctl fix out parameter written from glong* to DWORD* to avoid casts.

* [cxx] [w32socket] Remove casts on calls to mono_w32socket_getsockopt and mono_w32socket_setsockopt since they nicely accept void*  and const void*.

* [cxx][w32socket] Change output_bytes from glong to the correct DWORD to avoid casts.

* [cxx] Add ICALL_EXPORT to ves_icall_cancel_blocking_socket_operation.

* [cxx] Remove keyword 'template'.

* PR: Revert "[cxx] Fix return type of  start_wrapper_internal -- guint32 vs. gulong."
This reverts commit 8e02c9cf732a80b77af59b9a11fceaca7490a87c.
https://github.com/mono/mono/pull/10432#discussion_r215009888

This area of thread creation needs work.
1. We have function pointers with almost gratuitous casts,
2. inconsistent return types (motivating function pointer casts)
3. return values ignored

https://github.com/mono/mono/issues/10467
https://github.com/mono/mono/issues/10319#issuecomment-417739621
and more.
2018-09-05 00:33:12 -07:00
Jay Krell 22108e5f53 [cxx] [mini] Convert to be valid C and C++. (#10437)
* [cxx][mini] compile_methods: cast function pointer passed to mono_thread_create_internal to void*. This should be improved in future.

* [cxx][mini] mono_read_method_cache: C++ does not allow goto around initialization.

* [cxx][mini] mono_read_method_cache: C++ does not allow goto around initialization.

* [cxx][mini] decode_exception_debug_info: Use Enum a |= b instead of a = (Enum)(a | b); one of these might be have recent damage.

* [cxx][mini] init_method: C++ does not allow goto around initialization.

* [cxx][mini] get_new_trampoline_from_page: cast twice to guint8* instead of void*.

* [cxx][mini]Strengthen MonoAotFileInfo.runtime_version from void* to char*.

* [cxx][mini] Weaken decode_vtype(addr, buf) from guint8* to void*, but then assign right back to guint8* locals for easy to author and read diff.

* [cxx][mini] Weaken decode_value(addr, buf) from guint8* to void*, but then assign right back to guint8* locals for easy to author and read diff. (like previous but decode_vtype vs. decode_value)

* [cxx][mini] vm_commands: standard C++ has no designated initializers; actual support by compilers varies, but effectively no support and trivial to do without. (current clang++ good support, current g++ some support, g++4.4 no support, msvc presumed no support).

* [cxx][mini] Cast function pointer from void* to correct type.

* [cxx][mini] exceptions-amd64.c: mono_arch_ip_from_context: cast from integer to void*.

* [cxx][mini] exceptions-amd64.c: mono_arch_ip_from_context: cast from void* to MonoContext*.

* [cxx][mini] exceptions-amd64.c: fast_find_range_in_table_no_lock_ex: Cast from void* to DynamicFunctionTableEntry* twice. On the second one, it might be clearer to put the cast further to the left, i.e. just after =.

* [cxx][mini] exceptions-amd64.c: initialize_unwind_info_internal: Cast parameter to mono_arch_unwindinfo_create to void**.

* [cxx][mini] exceptions-arm.c: mono_arm_get_exception_trampolines: Change local variable tramp from guint8* to void*.

* [cxx][mini]exceptions-wasm.c: Cast returned function pointers to void* a few times.

* [cxx][mini] exceptions-x86: Fix win32_handle_stack_overflow(sctx) to be CONTEXT* instead of struct sigcontext *.

* [cxx][mini] exceptions-x86: win32_seh_init: Cast mono_win32_get_handle_stackoverflow() from void* to correct function type.

* [cxx][mini]mono_arch_exceptions_init: Cast GetProcAddress() to correct function pointer type and call through correctly typed function pointers.

* [cxx][mini]exceptions-x86.c: mono_arch_ip_from_context: Cast from integer to void*.

* [cxx][mini]exceptions-x86.c: mono_arch_handle_exception: Cast from void* to struct sigcontext*.

* [cxx][interp] C++ deprecates the register keyword, remove it.

* [cxx][interp] C++ deprecates the register keyword, remove it.

* [cxx][mini] liveness.c: Change MonoPtrSet to a union and then use GHashTable* instead of void* instead of casting from void*.

* [cxx][mini] main.c: probe_embedded: Change local item_size from uint64_t to uint32_t to fix error about it being truncated when initializing MonoBundledAssembly. Could cast instead.

* [cxx][mini] C++ does not allow goto around initialization.

* [cxx][mini]Do not mixup enum types between MONO_CEE_ and CEE_. This fixes an error. We might wanto have the one set of values alias the other, but this wasn't a big problem actually.

* [cxx][mini] C++ does not allow goto around initialization.

* [cxx][mini] Cast from void*.

* [cxx][mini] Cast pointer to pointer-sized integer before casting
to integer or enum. Otherwise errored.

* [cxx][mini] Cast function pointer to void* to mono_arch_instrument_prolog() and mono_arch_instrument_epilog().

* [cxx][mini] Change get_delegate_invoke_impl() from void* to guint8* -- probably reduced need for additional casts.

* [mini] A field per line (MonoCompileArch.omit_fp, omit_fp_computed).

* [cxx][mini] Cast mono_aot_get_trampoline() to guint8* from void*.

* [cxx][mini] Cast parameters to __builtin___clear_cache from guint8* to char*.

* [cxx][mini] Remove casts on mono_arch_get_seq_point_info().

* [cxx][mini] Cast g_hash_table_lookup() from void* to SeqPointInfo*.

* [cxx][mini] Cast integer to enum MonoJumpInfoType. Could maybe change the incoming type to MonoJumpInfoType.

* [mini] A field per line (MonoCompileArch.omit_fp, omit_fp_computed).

* [cxx][mini] Remove cast to CallInfo*.

* [cxx][mini]mini-arm64.c: Cast pointer to pointer-sized integer before casting to other integer or enum.

* [cxx][mini] Cast from void* to guint8*, though this one is now covered by g_cast.

* [cxx][mini] Change types and add casts due to void*/non-void* mix.

* [cxx][mini] mini-exceptions.c: first_managed change local data from void*** to void**, and likewise the cast on its assignment.

* [cxx][mini][profiler] Cast integer to enum MonoExceptionEnum multiple times.

* [cxx][mini] Weaken mono_handle_exception(obj) from MonoObject* to void*, and then store it right into a local MonoObject*. This alleviates casts elsewhere.

* [cxx][mini] Cast g_hash_table_lookup() from void* a few times.

* [cxx][mini] More pointer casts.

* [cxx][mini] Change get_delegate_invoke_impl() from void* to guint8* to alleviate casts.

* [cxx][mini] Cast result of mono_arch_instrument_prolog() and mono_arch_instrument_epilog().

* [cxx][mini]Change MagicTypeInfo.{big_stack_type,small_stack_type,stack_type} from short to enum MonoStackType : 16, under #ifdef __cplusplus, to allevate casts and strengthen types.

* [cxx][mini] Cast from integer to enum MonoStackType. This can probably be improved, i.e. by changing the source type to enum.

* [cxx][mini]emit_intrinsics: Change local stack_type from int to MonoStackType to alleviate casts and strengthen  types.

* [cxx][mini] Cast from integer to enum MonoStackType. This can probably be improved, i.e. by changing the source type to enum.

* [cxx][mini] Cast pointers g_hash_table_lookup() and profiler input (byte* instead of void*).

* [cxx][mini] Fix the function pointer parameter type to add_signal_handler so avoid casts, but add one cast from function pointer to function pointer for systems lacking MONO_ARCH_USE_SIGACTION.

* [cxx][mini] mini-posix.c: sampling_thread_func: Remove designated initializer.

* [cxx][mini] Change get_delegate_invoke_impl() from void* to guint8*() to reduce casts at its callers.

* [cxx][mini] Undo g_cast support on mono_arch_instrument_prolog() and mono_arch_instrument_epilog(), probably a mistake from a recent other PR, harmless. i.e. remove parens from around that suppress macro expanstion

* [cxx][mini] Cast return of mono_arch_instrument_prolog and mono_arch_instrument_epilog to guint8*.

* [cxx][mini] Remove a layer from some TLS access -- macro vs. function that might not inline.

* [cxx][mini] Strengthen the parameter to mono_set_lmf_addr() from void* to MonoLMF**.

* [cxx][mini] Provide a typedef MonoAbortFunction for MonoJitTlsData.abort_func.

* [cxx][mini] Strengthen the output of setup_jit_tls_data from void* to MonoJitTlsData* and the input function pointer from void* to MonoAbortFunction, eliminating existing and future casts.

* [cxx][mini] A few pointer and enum/int casts.

* [cxx][mini] Change mini_llvmonly_initial_imt_tramp locals from gpointer* to IMTTrampFunc** to alleviate casts.

* [cxx][mini] Cast some function pointers to void*.

* [cxx][mini] Cast void* to MONO_SIG_HANDLER_INFO_TYPE* for the non-HAVE_SIG_INFO case. We could maybe change the void* local to MONO_SIG_HANDLER_INFO_TYPE*, since we are casting it to that anyway.

* [cxx][mini] Cast function pointer to void*.

* [cxx][mini] Cast void* to GSList* twice.

* [cxx][mini] Cast function pointer to mono_runtime_init_checked. In future we should  get all these types and parameters to match.

* [cxx][mini] Cast result of mono_arch_instrument_prolog/mono_arch_instrument_epilog to guint8*.

* [cxx][mini]Change return type of get_delegate_invoke_impl from void* to guint8*.

* [cxx][mini] Cast result of mono_arch_instrument_prolog/mono_arch_instrument_epilog to guint32*.

* [cxx][mini] Cast function pointers to void*.

* [cxx][mini] Cast from void* to non-void*.

* [cxx][mini] Change types and add casts due to void*/non-void* mix.

* [cxx][mini] Pointer casts.

* [cxx][mini] Pointer and int/enum casts, and widen pointer before casting to smaller integer.

* [cxx][mini] Strengthen types from void* to non-void* within x86 MonoCompileArch. (void *cinfo, *ss_tramp_var, *bp_tramp_var; => CallInfo *cinfo; MonoInst *ss_tramp_var; MonoInst *bp_tramp_var;)

* [cxx][mini] int/enum casts

* [cxx][mini] create_jit_info: Use Enum a |= b instead of a = (Enum)(a | b); one of these might be have recent damage.

* [cxx][mini] Pointer/int/enum casts.

* [cxx][mini] Change mono_cfg_set_exception(int) to mono_cfg_set_exception(MonoExceptionType) to reduce casts elsewhere.

* [cxx][mini] Pointer cast.

* [cxx][mini] Change mono_cfg_set_exception(int) to mono_cfg_set_exception(MonoExceptionType) to reduce casts elsewhere.

* [cxx][mini] Pointer casts.

* [cxx][mini] recursively_make_pred_seq_points: Fix parameter to g_array_index from void* to MonoInst*.

* [cxx][mini] Change parameter to decompose_vtype_opt_load_arg from guint32* to gint32*, and assign right back to local guint32*, to avoid casts, and limit diff, and obviously preserve semantics.

* [cxx][tasklets] Add include loader-internals.h.

* [cxx][mini]Fix cast mono_win32_get_handle_stackoverflow() to function pointer restore_stack.

* [cxx][mini] Casts. See https://jenkins.mono-project.com/job/test-mono-pull-request-amd64-osx-products-sdks-android/4480/parsed_console/log.html.

* PR: Replace goto up with goto down, and split decl/init instead.
2018-09-04 22:48:12 -07:00
Jay Krell 34b5b4c4e2 [cxx] mono_context_get_current is extern "C" because it is assembly. (#10457)
See https://jenkins.mono-project.com/job/x/13345/parsed_console/log.html.
2018-09-04 16:11:59 -07:00
Jay Krell a7b9128bf1 [cxx][wasm] Fix mismatched extern "C". (#10439)
https://jenkins.mono-project.com/job/test-mono-pull-request-wasm/4437/parsed_console/log.html
WASM-ERR: missing function: mono_attach_init

https://jenkins.mono-project.com/job/w/15060/parsed_console/log.html
attach.c:600:1: warning: no previous declaration for 'void mono_attach_parse_options(char*)' [-Wmissing-declarations]
attach.c:605:1: warning: no previous declaration for 'void mono_attach_init()' [-Wmissing-declarations]
attach.c:610:1: warning: no previous declaration for 'gboolean mono_attach_start()' [-Wmissing-declarations]
attach.c:616:1: warning: no previous declaration for 'void mono_attach_maybe_start()' [-Wmissing-declarations]
attach.c:621:1: warning: no previous declaration for 'void mono_attach_cleanup()' [-Wmissing-declarations]

https://jenkins.mono-project.com/job/test-mono-pull-request-wasm/4437/parsed_console/log.html
warning: unresolved symbol: mono_attach_cleanup
warning: unresolved symbol: mono_attach_init
warning: unresolved symbol: mono_attach_maybe_start
warning: unresolved symbol: mono_w32file_get_volume_information
2018-09-04 11:54:20 -07:00
Jay Krell aa0b1d3440 [cxx] mono_thread_info_current extern "C" on Windows. (#10456)
See https://jenkins.mono-project.com/job/w/15104/parsed_console/log.html
2018-09-04 11:53:22 -07:00
Jay Krell 24c1f2a40c Linker-supplied __ImageBase must be extern "C". (#10454)
https://jenkins.mono-project.com/job/w/15083/parsed_console/log.html
assembly.obj : error LNK2001: unresolved external symbol "struct _IMAGE_DOS_HEADER __ImageBase" (?__ImageBase@@3U_IMAGE_DOS_HEADER@@A) [d:\j\workspace\w\msvc\libmono-dynamic.vcxproj]
d:\j\workspace\w\msvc/./build/boehm/Win32\bin\ReleaseCxx\mono-2.0-boehm.dll : fatal error LNK1120: 1 unresolved externals [d:\j\workspace\w\msvc\libmono-dynamic.vcxproj]
Since it is data, extern "C" w/o braces is confusing, but maybe valid, so begin/end form is used.
2018-09-04 09:26:42 -07:00
Alexander Köplinger 3c2396bf0d [tools] Ignore .a files in monograph and pedump
They showed up after https://github.com/mono/mono/commit/9cee98fe36b15467b1b056af152a8fded193a3d5
2018-09-04 16:19:09 +02:00
Matthew Leibowitz 6d6c046d36 [mono-api-tools] Split properly for cross-platform (#9918)
When creating a diff on windows, the lines are split on the `\n` so the `\r\n` results in multiple lines:

**START SNIP**
Obsoleted methods:

```diff
 [Obsolete ("Use AddRoundRect instead.")]

 public void AddRoundedRect (SKRect rect, float rx, float ry, SKPathDirection dir);
```
**END SNIP**

This PR makes sure to use the platform line endings everywhere. When adding line endings, use the same that `StringBuilder` uses - platform endings. This makes it easy to split - just use the platform as that is what everyone is using.
2018-09-04 16:14:14 +02:00
Alexander Kyte f463581b2c [runtime] Declare mono_aot_register_module in mkbundle stub (#10170)
* [runtime] Declare mono_aot_register_module in mkbundle stub

* [runtime] Fix inconsistent types for exported API

Thank you to @batmaninpink
2018-09-04 09:41:01 -04:00
Alexander Kyte 914408d355 [runtime] Fix configure flag typos (#10390)
This doesn't make any functional change right now, but it clears
this up for readers and future users.
2018-09-04 09:35:08 -04:00
Rolf Bjarne Kvinge aa25ab45fc [mono-cil-strip] Add support for -q to be quiet. (#10421) 2018-09-04 13:30:42 +02:00
Alexander Köplinger 3e841bf089 Update framework assemblies list in assembly.c (#10214)
Fixes https://github.com/mono/mono/issues/9973
2018-09-04 13:16:15 +02:00
monojenkins 0a4aa46fbb Bump API snapshot submodule 2018-09-04 09:59:46 +02:00
EgorBo 6233948173 Add tests 2018-09-04 09:59:46 +02:00
EgorBo 6ab52c9a99 Add old String.Concat with __arglist 2018-09-04 09:59:46 +02:00
Jay Krell c310ae0489 Fix mkbundle alignment to work with Windows. See https://github.com/mono/mono/issues/8225. (#8884)
* Fix mkbundle alignment to work with Windows. See https://github.com/mono/mono/issues/8225.
Consider doing this only for Windows.

* Align only first file at 64K, the rest the previous 4K.

* Ensure strings are nul terminated, if alignment doesn't handle it.
StringPairs already are.

* Save 30K on average on Unix, for an entire bundle (not per file within, but the entire bundle).

* Probe runtime for for MZ signature to determine if target
is Windows. "Style" is about host.
2018-09-03 18:39:16 -04:00
Ludovic Henry 0dbcdd5c28 [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA + Unify provisioning of LLVM for both Android and iOS. (#10445)
* [sdks] Add CrossRuntimeTemplate

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

* [sdks] Use CrossRuntimeTemplate for iOS

* [sdks] Factor various variables for RuntimeTemplate

* [sdks] Use MonoRuntime template for desktop-x86_64

* [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] Remove android-armeabi, it's been removed from XA already and the target has been deprecated in the NDK
2018-09-03 17:30:31 -04:00
Jay Krell 24e4dfec08 Use AC_CHECK_FUNCS(mincore mlock munlock). 2018-09-03 12:00:31 -07:00
Zoltan Varga f25f9e5f2b [jit] Add intrinsics for Math.Round/Floor/Cecil () on SSE41. (#10039)
* [jit] Add intrinsics for Math.Round/Floor/Cecil () on SSE41.

* Add LLVM support.

* Fix the build.

* Move the code to mono_arch_emit_inst_for_method ().

* Fix the build.
2018-09-03 12:13:43 -04:00
Marek Safar 066a7c206e [Facades] Clean up no longer needed references (#10434)
and build more facades in parallel
2018-09-03 18:05:03 +02:00
Jonathan Pryor 19fef52c18 [Mono.Options] Add CommandSet.GetCompletions() (#10426)
* [Mono.Options] Add `CommandSet.GetCompletions()`

Add a `Mono.Options.CommandSet.GetCompletions()` method, which returns
all possible commands which match a given "completion prefix".

This is intended for e.g. bash completion support.

* Bump API snapshot submodule
2018-09-03 18:01:33 +02:00
Maxim Lipnin faaa9a41c6 [System.Reflection] CoreFX import for FieldInfo type. (#10370)
Part of #9660.

The changes:
- included FieldInfo type from CoreFX + related xunit tests;
- made Mono-implemented class partial; removed duplicated code;
- moved GetOptionalCustomModifiers and GetRequiredCustomModifiers methods to MonoField type;
- moved GetTypeModifiers extern method and related icall to MonoField type;
- updated ToString method in CustomAttributeTypedArgument type with CoreFX implementation;
2018-09-03 11:48:39 +02:00
Katelyn Gadd 84af5b235e Move the PreBuild dependency property later in the file so targets can't override it (#10429)
* Move the PreBuild dependency property later in the file so targets can't override it

* [csproj] Update project files
2018-09-02 17:54:01 +02:00
Alexander Köplinger 707bddeaff [mini] Prevent automake from generating a default mono_SOURCES
It was caused by https://github.com/mono/mono/commit/3912412f5059337724199cc132658e5ebd401b68
and broke the tarball build because the default mono.c didn't exist to be disted.
2018-09-02 17:43:28 +02:00
Jay Krell aeb965e0d8 Replace check for mincore with check for mlock. 2018-09-01 15:07:58 -07:00
Jay Krell 1f6d6ef582 mono_pages_not_faulted is not used, remove it. 2018-09-01 15:07:58 -07:00
Jay Krell e42e7fddee [cxx] [sgen] [utils] [jit] Casts, some type change. (#10425)
* [cxx] Add const, and static while there.
* [cxx] Auto cast in ARM_EMIT
* [cxx] Cast from int to enum.
* [cxx] Cast from void*.
* [cxx] Cast function pointer to void*.
* [cxx] Cast int to GCHandleType.
* [cxx] Cast to GCObject*.
* [cxx] Cast unsigned char* [cxx] to char*.
* [utils] Cast void* [cxx] to function pointer (FIXME) and remove extra parens (former macro?).
* [cxx] Change int parameter to enum MonoGCRootSource.
* [cxx] Do not goto around init.
* [cxx] Fix cast -- void* [cxx] vs. void**, and volatile per error but it is optional.
* [cxx] Fix type for pointer to array element -- void** [cxx] vs. void*.
* [cxx] Remove duplicate line from Makefile.
* [cxx] Remove incorrect cast.
* [cxx] Remove unneeded cast.
* [cxx] Spell out enum values for easier to read headers.
* [cxx] Split up compound initialization with NULL because the types vary, i.e. remove implicit conversion from void* that would need a cast.
* [cxx] Static thread locals fail to link on Linux; make them extern. FIXME?
* [cxx] Strengthen void* [cxx] to SGenFinalizationProc.
* [cxx] Templatize mono_native_thread_create (FIXME).
* [cxx] Use G_BEGIN_DECLS not MONO_BEGIN_DECLS in non-public headers, for brevity and subtle extra annotation.
* [cxx] Widen integer to pointer-size before casting to pointer.
* [cxx] Wordsmith comment.
* [cxx] Wrapping a bunch of includes in extern "C" is generally in poor form and unnecessary.
* [cxx] [sgen] Remove unnecessary cast.
* [cxx] [sgen] casts
* [cxx] [utils] Add const with a string literal.
* [cxx] [utils] Casts from void* [cxx] and between int/enum.
* [cxx] [utils] Clarify empty macros.
* [cxx] [utils] Compile more as C++ if enabled.
* [cxx] [utils] extern "C" mono_file_map_error. (FIXME?)
* [cxx] [utils] Remove autocast from mono_lock_free_alloc.
* [cxx] [utils] ifdef wasm the type in unused mono_pages_not_faulted so it compiles, remove incorrect comment, add FIXME.
2018-09-01 14:37:15 -07:00
Jay Krell 919772e008 [cxx] Add LDFLAGS -no-undefined to catch missing extern "C". (#10422) 2018-09-01 11:13:37 -07:00
Jay Krell 5b164bdaf0 [cxx] Add missing ICALL_EXPORTs, esp. but not only if excess G_BEGIN_DECLS is removed. (#10401) 2018-09-01 02:00:00 -07:00
Jay Krell 72c376706e Fix test dependencies build problem. (#10388)
* Dependencies work better with .lo.
2018-09-01 00:28:18 -07:00
Alexis Christoforides d49d32da19 [MacSDK] Go back to incluging opt/llc after change in LLVM install process
Fixes https://github.com/mono/mono/issues/10243
2018-09-01 06:10:27 +03:00
Jay Krell d850f1d0ba [cxx] Some required extern "C" and some cleanup. (#10382)
* Use typedefs of structs in the usual fashion.

* [cxx] externC to the 'operating system'

* [cxx] Add externC for debugger interop.

* Fix indentation.

* [cxx] externC on chkstk.

* [cxx] externC on sys_icache_invalidate.

* [cxx] externC on __aeabi_read_tp.

* [cxx] externC on sys_icache_invalidate.

* Remove exactly duplicated license.
2018-08-31 18:48:01 -07:00
Jay Krell bb0d0f4181 Minor cleanup. (#10407)
* __EGLIB_X11 is defined but never used.

* Let compiler decide inline.

* Get ves_icall_System_Environment_GetOSVersionString declaration from environment-internal.h.

* Put ves_icall_System_Reflection_Assembly_GetCallingAssembly at start of line for grep ^foo.

* Remove accidental space.

* Remove casts and error_init.

* Fix warning: sgen-mono.c:959:36: warning: incompatible pointer to integer conversion passing
      'void *' to parameter of type 'MonoGCDescriptor'
      (aka 'unsigned long long') [-Wint-conversion]
        return mono_gc_alloc_fixed (size, NULL, source, key, msg);

* Add a comment and associate comment more closely with code.

* Remove gratuitous pragma -- header is only included once, fix the include.
2018-08-31 14:38:30 -07:00
Jay Krell 27a32b0d20 g_malloc/g_calloc instead of malloc/calloc (#10229) 2018-08-31 13:13:13 -07:00
Jay Krell 181a63b7b0 [cxx] Just enough extern "C" for profilers, libtest, MonoSupportW, Mo… (#10403)
* [cxx] Just enough extern "C" for profilers, libtest, MonoSupportW, MonoPosixHelper, THREAD_INFO_TYPE, WebAssembly interop.
Some of this is redundant, i.e. in glib.h and mono-threads-coop.h.
But if someone removes otherwise unnecessary header wrappers, these become meaningful.

This is an alternative to:
https://github.com/mono/mono/pull/10160 Remove most G_BEGIN_DECLS but add back to make things work.
https://github.com/mono/mono/pull/10284 Port libtest to C++
https://github.com/mono/mono/pull/10294 Rework mono-threads.h THREAD_INFO_TYPE parameterization to not violate C++ typesafe linkage.
https://github.com/mono/mono/pull/10297 Fix typesafe linkage problem in gc-internals.h THREAD_INFO_TYPE parameterization.
https://github.com/mono/mono/pull/10341 Port all of MonoPosixHelper MonoSupportW to C++, including K&R zlib.
https://github.com/mono/mono/pull/10342 Port profilers to C++
https://github.com/mono/mono/pull/10378 Port all of MonoPosixHelper MonoSupportW to C++, except K&R zlib.
https://github.com/mono/mono/pull/10375 Eliminate THREAD_INFO_TYPE by suggestion, to fix typesafe linkage.
https://github.com/mono/mono/pull/10379 Mark the 14 functions used by MonoPosixHelper as extern "C" (basically this PR)

Most of the alternatives are very reasonable and remain viable, except porting K&R zlib.
Hopefully in future, SgenThreadInfo will derive from MonoThreadInfo, improving the THREAD_INFO_TYPE fixes.

* [cxx] Replace invalid two extern "C" with just one.
2018-08-31 13:12:20 -07:00
Jay Krell 5ec266d8bb [cxx] Char literals are now chars, not ints (sizeof changes) and indexing by them warns. Cast. (#10118) 2018-08-31 11:30:47 -07:00
monojenkins 01f5781b33 Merge pull request #10240 from frebib/fix-strerror_r
[runtime] Use AC_FUNC_STRERROR_R() in Mono.Posix

Hopefully this is less of a disaster than #9691 

Inspired by https://github.com/mono/mono/commit/3b3b48dbb4cdbda44ffa2f10e74f819acb78bd96
Fixes https://github.com/mono/mono/issues/9532

Signed-off-by: Joe Groocock <[email protected]>



<!--
Thank you for your Pull Request!

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

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-08-31 14:25:05 -04:00
Jay Krell baa3ab7334 [cxx] Wrap fmod in mono_fmod for stronger future-proofing. (#10178) 2018-08-31 11:11:30 -07:00
Jay Krell fa09dfb814 Strengthen several fields and TLS and functions from void*. (#10269)
* Strengthen MonoImage.aot_module and _MonoJitInfo.aot_info to be MonoAotModule* instead of void*.

* Strengthen thread locals away from void*.

* Strengthen _MonoThreadInfo from void* to HandleStack*.

* Elminate "struct".
Introduce mono-forward.h and mono-forward-internal.h.
Add cast for profiler.

* Strengthen tramp_info; remove struct on JitInfo; remove a cast.

* Tweak and add #includes accordingly.
Any header that was providing a typedef, or forward declaring a struct and now
using typedef instead must include a header to get it.
Internal types must come from internal header.
Internal header may include internal header.
Public header must not include internal header.
foo.c does not have to include what foo.h must include to declare foo.c's functions (mono-tls.c
  does not need to include mono-forward-internal.h)

I misssed mono/metadata/metadata-internals.h:     void *image_info; do it later.
2018-08-31 10:21:53 -07:00
Katelyn Gadd b97b890334 Update corlib post-build event to run ilasm for Unsafe.il, then pass it to cil-stringreplacer (#10381)
This ensures that System.CompilerServices.Unsafe has implemented method bodies, necessary for Span and similar use cases.
2018-08-31 17:48:07 +02:00
Katelyn Gadd a6a8abde09 Kill sln dependencies (#10406)
* Remove use of sln dependencies and use csproj project references instead

* Rewrite jay.vcxproj so it builds correctly even without help from the sln file

* Force pre-build event to run after references are resolved. Change how culevel.exe path is computed to be more resilient.

* [csproj] Update project files
2018-08-31 17:44:27 +02:00
Martin Baulig 8ac5b8e544 [System]: Fix MonoBtlsProvider.CheckValidationResult () logic. (#10396)
See my comments in https://github.com/mono/mono/pull/10134 for details.

The problem was that
1. It is wrong to assume that `chain != null`.  In fact, it likely won't be if `wantsChain == false`.
2. Similarly, the `storeCtx` should only be used if `storeCtx != NULL && wantsChain == true`.
3. It was missing `MonoBtlsX509Error.HOSTNAME_MISMATCH`.
4. I reformatted and re-indented the method to match Mono's style.
2018-08-31 17:12:16 +02:00
Martin Baulig 0d7f5778ec [System]: Make `MobileAuthenticatedStream's read buffer large enough to hold a full TLS record. (#10393) 2018-08-31 16:55:26 +02:00
monojenkins 5c6233d813 [bcl] Update BCL Linked Size 2018-08-31 11:52:05 +02:00
Egor Bogatov ba24bc4ace Bump CoreCLR to fix two math acceptance tests (#10399)
Includes mono/coreclr#1
2018-08-31 10:58:12 +02:00
Aleksey Kliger (λgeek) 88efee700d [coop] Fixup dump_threads () legend to match thread state enum values (#10264) 2018-08-30 19:16:49 -04:00
Nikolay Sivov a7705851aa [mono] Fix maybe-uninitialized warning. 2018-08-31 02:10:27 +03:00
Nikolay Sivov 46de5b7283 [mono] Add default case for thread_summary_state_to_str(). 2018-08-31 02:10:07 +03:00
Nikolay Sivov adf862b8e1 [mono] Remove unused variable.
It was used to addref appdomain at some point, but this logic was removed since then.
2018-08-31 02:09:43 +03:00
Aleksey Kliger 637c07a18b [coop] Use unbalanced transition to GC Unsafe in mono_raise_exception
Since `mono_raise_exception_deprecated` never returns, the transition won't be
balanced.  This fixes a cookie-counting problem (assert on mono shutdown) in
coop and hybrid checked builds using the new test case:

    MONO_THREADS_SUSPEND=coop MONO_CHECK_MODE=thread,gc mono mono/tests/install_eh_callback.exe
2018-08-30 18:12:42 -04:00
Bernhard Urban 3b50755628 [exceptions] ftnptr_eh_callback test that stresses n2m transitions
on Xamarin.iOS it happens that the ftnptr_eh_callback calls into managed
code, that is yet another native-to-managed transition.
2018-08-30 18:12:42 -04:00
monojenkins f5a8683462 Merge pull request #10314 from lewurm/remove-mono-init-context-from-current
[mini] cleanup around MONO_INIT_CONTEXT_FROM_CURRENT and MONO_INIT_CONTEXT_FROM_FUNC
2018-08-30 15:15:56 -04:00
Jay Krell 3912412f50 [cxx] Port mono main to be C++, and externC some Windows exports (#10345)
* [cxx] Port mono main to be in C++.
This allows to remove more extern "C" from glib.

* [cxx] DllMain should be extern "C".

* [cxx] Make OutOfProcessFunctionTableCallback and OutOfProcessFunctionTableCallbackEx externC.

* Remove do-nothing line and change .o to $(OBJEXT).
2018-08-30 11:57:38 -07:00
Jay Krell 0605cd2f74 Remove gratituious ifdef -- just have one portable form -- alloca and no variable length arrays. (#10288) 2018-08-30 11:26:48 -07:00
monojenkins 609f65371c Merge pull request #10355 from BrzVlad/fix-sgen-string
[sgen] Fix string size inconsistency between alloc/scan

This could lead to crashes when having strings with size at the LOS boundary.

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



<!--
Thank you for your Pull Request!

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

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-08-30 13:56:06 -04:00
Rémi BOURGAREL bab9779e34 Changed http: to https: (#9769)
I changed all the link for going to the https version as there is no redirect in some of them (.net foundation and monoproject)
2018-08-30 11:46:24 -04:00
Ludovic Henry 5a3f086954 [sdks] Allow for overwriting llvm-{llvm32,llvm64} CC, CXX, CFLAGS and CXXFLAGS (#10364) 2018-08-30 11:28:04 -04:00
Jay Krell 479ade2212 [cxx] Port sgen-grep-binprot to C++, to reduce externC in glib. (#10368) 2018-08-30 08:27:40 -07:00
monojenkins dfa55e2331 Merge pull request #10357 from lewurm/interp-whitelistisnan
[interp] white list nfloat::IsNaN ()

needs backport to `2018-06` and `2018-08`
2018-08-30 11:05:06 -04:00
monojenkins 177f5d4d25 Merge pull request #10261 from EgorBo/llvm-llc-cli
Pass arguments to LLVM's LLC via --aot=llvmllc

Currently we can override arguments passed to llvm's `opt` via `--aot=llvm,llvmopts="some args"`, this PR introduces a similar capability for `llc` - `llvmllc` parameter.
E.g. for my environment Mono uses the following arguments for llc:
```
-march=x86-64 -mattr=sse4.1 -asm-verbose=false -disable-gnu-eh-frame 
-enable-mono-eh-frame -mono-eh-frame-symbol=_mono_aot_fffff_eh_frame 
-disable-tail-calls -no-x86-call-frame-opt -relocation-model=pic 
-filetype=obj -o "mono_aot_IWvNWm/temp-llvm.o" "mono_aot_IWvNWm/temp.opt.bc"
```
what if I want to test some avx stuff, e.g. `-march=core-avx2 -O2` and test other parameters.
2018-08-30 10:40:25 -04:00
Ankit Jain ae4f6dd35c Bump NuGet.BuildTasks to upstream dev branch (#10334) 2018-08-30 12:08:34 +02:00
Alexander Köplinger 9a1cda1882 Follow up to bump target requirement to OSX 10.9 Mavericks
After another grep with different search terms I found a few more matches.
2018-08-30 12:46:43 +03:00
Jay Krell 3f1a1fd2aa [cxx] Add loader-internals.h missed in https://github.com/mono/mono/pull/10252. (#10377) 2018-08-30 10:51:39 +02:00
Katelyn Gadd bfc35fc6e6 Fix issue #9452: Add a cache for CustomMarshaler instances (#10090)
Extracted custom marshaler logic into managed code.
Fixed crash when using mono_verbose_method
Fixed free of zero desc ptr in mini_method_compile when verbose method variable doesn't resolve to a method
If the cfg is in verbose mode emit a brief message on abnormal termination of IR generation
Use CEE_MONO_CLASSCONST to store the type of the custom marshaler since it appears to work with AOT
Handle various error conditions in Marshaler.GetInstance and produce exceptions that roughly match .net framework
Use ValueTuple instead of a custom tuple type. Use LazyInitializer to init dictionary for marshalers on demand.
Add test case for custom marshalers in linker tests (disabled because the linker does not understand custom marshalers yet)
2018-08-29 20:56:43 -07:00
Jay Krell 29cfaa70a3 [cxx] Make some code valid C++, esp. adding casts and esp. not touching allocators. alternative to 10036 (#10252)
* [cxx] Make some code valid C++, esp. adding casts and esp. not touching allocators.

* [cxx] PR: Update comment on MonoThreadPriority.

* [cxx] PR: Provide templates for register_icall mono_mb_emit_icall
mono_register_jit_icall mono_register_jit_icall_full mono_aot_register_jit_icall
to cast from arbitrary type to gpointer or gconstpointer.
Ideally this would be limited to function pointers but anything is progress here.

* [cxx] Move C++ template mono_add_internal_call from loader.h to new loader-internals.h.
[cxx] Add C++ template register_opcode_emulation.
[cxx] Add C++ template register_icall.
[cxx] Add C++ template register_icall_no_wrapper.
[cxx] Add C++ template register_icall_with_wrapper.
[cxx] Add C++ template mono_emit_jit_icall.
[cxx] Add C++ template mini_register_opcode_emulation.
[cxx] Add #include loader-internals.h.
[cxx] Remove preemptive extern "C++" until/unless needed.

* [cxx] Change preexisting #define register_icall to C++ templates.
2018-08-29 20:03:50 -07:00
Jay Krell 9cee98fe36 [cxx] Port pedump, monograph, monodis, unit-tests to C++. (#10271)
- #define HAVE_SGEN_GC in order to get missing prototype of sgen_sort.
 - Move main to static libraries, in order to compile as C++ but not link as C++.
   Linking pedump as C++ in particular broke running it in Windows x64 CI.
 - Some const fix.
 - "class" => "klass"

There are advantages and disadvantages here.

adv: No file rename.
dis: Not linking to libc++ -- which broke Windows x64 CI running pedump.
adv: Linking with -xc++ incorrectly treats .o/.a files as C++ text and fails to link; avoids that.

Moving these to C++ enables the runtime to not need extern "C" sprinkled around
on internals -- which was done but not accepted (https://github.com/mono/mono/pull/10160#pullrequestreview-148551783).
2018-08-29 19:05:32 -07:00
Jay Krell 817b479540 [cxx] Allow mono_gc_alloc_fixed subset outside of metadata (mini/tasklets.c), without breaking with C++ typesafe linkage. (#10293)
This enables avoiding externC workaround here:
  https://github.com/mono/mono/pull/10160/files#diff-bd3a3d5c2bfd6af46373b3844de9c1d0R163
2018-08-29 18:59:43 -07:00
Jay Krell fffa083292 [cxx] Add ICALL_EXPORT in sysmath.c (#10333)
* [cxx] sysmath.c add ICALL_EXPORT.
* Add #include icalls.h.
2018-08-29 13:03:14 -07:00
Rodrigo Kumpera 9de1d6c12a Merge pull request #10338 from jaykrell/norestrict
[cxx] C++ does not have restrict.
2018-08-29 14:34:13 -04:00
Katelyn Gadd 2d77536617 Bump target requirement to OSX 10.9 Mavericks (#10286)
Fixes #9581
2018-08-29 20:04:43 +02:00
Michael DeRoy 3decb63270 - Free the thread_info_key and thread_exited_key during unload to avoid crash when pthread_key_clean_all (#10063)
Free the thread_info_key and thread_exited_key during unload

Fixes a crash where pthread_key_clean_all will call destructors that should have been freed before unload.
2018-08-29 11:55:22 -04:00
Alexander Köplinger b75cf300c2 [eglib] Add the test subdir to DIST_SUBDIRS
779ee79081 broke the .deb/.rpm build
because the Makefile.in in the subdir didn't make it into the tarball.
2018-08-29 15:31:22 +02:00
Bernhard Urban 48e3e8ab12 [interp] white list nfloat::IsNaN () 2018-08-29 15:03:50 +02:00
Jay Krell 348cc41dc4 Disable tailcall of gsharedvt. (#10323)
* Revert "Revert "[jit] Disable tail calls from gsharedvt code for now.""

This reverts commit ce3c8ec3f2.

* Disable FullAOT tailcall/interface-conservestack/20.exe if MONO_ARCH_GSHAREDVT_SUPPORTED.

* Fix indent.
2018-08-29 13:01:38 +02:00
Vlad Brezae 16fa2e9b6d [sgen] Fix string size inconsistency between alloc/scan
This could lead to crashes when having strings with size at the LOS boundary.

https://github.com/mono/mono/issues/10309
2018-08-29 13:46:53 +03:00
Bernhard Urban 6118015744 [mini] fix memory dumping on devices (#10316)
[mini] fix memory dumping on devices

also, guard for `IP == NULL`: I haven't seen it in the wild, but when messing with EH I have seen it happen and then we have a segfault in the signal handler, which is... bad 😄 

we should backport this to `2018-06` and `2018-08`.
2018-08-29 05:40:08 -04:00
Bernhard Urban 3bd6d2f372 [interp] turn off optimizations for callers of INTERP_PUSH_LMF_WITH_CTX 2018-08-29 04:55:19 -04:00
Bernhard Urban cbc2f4eb77 [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 04:55:19 -04:00
Bernhard Urban 80c0969486 [exceptions] pop lmf stack before executing ftnptr_eh_callback 2018-08-29 04:55:19 -04:00
Kenneth Pouncey a237e972cc [wasm] Modify HttpClient to use a default handler provider. (#10152)
- Add a private static variable to HttpClient called `Func<HttpMessageHandler> GetHttpMessageHandler` that will be used to obtain the default message handler and can be set for example as follows:

```
		var httpMessageHandler = typeof(HttpClient).GetField("GetHttpMessageHandler", 
                            BindingFlags.Static | 
                            BindingFlags.NonPublic);

                httpMessageHandler.SetValue(null, (Func<HttpClientHandler>) (() => {
			return new MyHttpClientHandler ();
		}));
```

- If a handler is not set or returns null the default implementation HttpClientHandler will be returned.

- Add HttpClient.wasm.cs implementation to handle the default HttpClient
- Add simple test to the wasm test harness bindings-test.
- Reference https://github.com/mono/mono/issues/9941



<!--
Thank you for your Pull Request!

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

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-08-29 10:15:21 +02:00
Johan Lorensson 2fc3c3a939 Merge pull request #10321 from lateralusX/lateralusX/fix-cross-windows-llvm-support
Fix Windows LLVM mono cross compiler build.
2018-08-29 08:51:19 +02:00
Jay Krell 779ee79081 [cxx] int vs. enum -- bit overload version (#10274)
* [cxx] int vs. enum.

There are at least three or so approaches to this.

1. Sprinkle around casts.
2. Overload operators.
2a. Bit-only (| & ^ |= &= ^=)   This PR.
2b.  Also math (+ - ++ -- == !=)
3. typedef to int instead (https://github.com/mono/mono/pull/10231)

They all have tradeoffs.

1. Casts: The most line damage. Not huge, but the most.

2. Overloads: New idiom to some but an old idiom. Supported in this way by windows.h even.
  This is the most "C++y solution".

3. int: Highest level of source compat and semantic compat. Least line damage (just
change the declarations). Least debuggable and least typesafe.

In terms of semantic compat, even in C the guarantees aren't particularly strong.
Some enums will be int, some unsigned, depending on the values and the compiler.
Perhaps even other types, but I doubt it.

I observe C++ compilers don't tend toward unsigned the same way, so switching
to C++ will on some platforms lose unsignedness. Given we didn't have it portably
anyway, should be ok.

A typesafe enum has the properties that enum A cannot be silently assigned to enum B (ok,
there might be a warning), or from an integer.

A typesafe enum, bitfield or otherwise, can/will be shown symbolically by a debugger.
 (lldb does not handle bitfields, only strict enums)

A C enum might be debuggable, w/o typesafety.

A C enum can be freely mixed with other enums and integers.

A C++ enum is more restricted.

Using typedef int, is a maybe surprising option, but does provide the closest meaning to C enum.

Per guidance, this PR also changes one enum to #defines + int.

* PR: "mono" => "g"
"T" => "type"
static_cast where it works (not to reference)
Use templatized typedef instead of macro, if it works on g++4.4.
Add test.
Provide to build eglib tests.
Borrow CXXFLAGS_COMMON from https://github.com/mono/mono/pull/10271.
Add some const to test harness.

* g++4.4 compat (not quite C++11) -- use macro, not template typedef.

* Fix real problem with aliasing seen with g++4.4.
Use attribute(may_alias) when casting pointers/references.

* Add mono/eglib/test/enum.cpp.
2018-08-28 19:50:38 -07:00
Jay Krell 79d7029ef7 [cxx] C++ does not have restrict.
gcc/clang do have __restrict and/or __restrict__.
On MacOSX, __restrict is preprocessed out of the headers for C++.
On Linux, __restrict is used and preserved for C++.
I didn't check others.

__restrict does not appear to be part of the function signature.
You cannot overload on it.
It is not in the mangled name.
If you declare one way and implement the other, there is no warning or error.

Therefore, remove restrict.

There are alternatives.
One could preserve it for C only.
One could preserve it for C and for Linux/C++.
One could preserve it based on autoconf, and autoconf results on Mac and Linux.

Perhaps as well we will autoconf or ifdef wasm away use of these functions?
 If we merely if them away, we still need them.
2018-08-28 12:16:19 -07:00
Alexander Köplinger f0966dcd91 [metadata] Remove sysmath.h from Makefile.am
It was removed in c16ff9ab23.
2018-08-28 20:36:33 +02:00
Rodrigo Kumpera bd5cfc830b Merge pull request #10266 from kumpera/wasm-cleanup-4
[wasm] Another batch of AOT work. Now we crash when running AOT'd code!
2018-08-28 11:33:25 -04:00
Jay Krell 2dfa87f027 Fix misplaced const in mono_w32socket_setsockopt. (#10208) 2018-08-28 08:02:48 -07:00
Jay Krell 6a98a952df [Coop] Convert mono_TypedReference_ToObject. (#10296) 2018-08-28 10:54:19 -04:00
lateralusX 2f0a5a5526 Fix Windows LLVM mono cross compiler build.
This commit re-enables Windows LLVM mono cross compiler build + adjust to
new changes done in mono LLVM build system.
2018-08-28 15:26:16 +02:00
Egor Bogatov 76df02fb68 [corlib] Registry from CoreFX on Windows (#9855)
Needed for TimeZoneInfo.
Imports CoreFX's Registry API for Windows. Other platforms use old mono file-based Registry API implementation because CoreFX doesn't support it yet, see: https://github.com/dotnet/corefx/issues/14896
(however, some basic types such as enums are imported for all platforms)
Part of #8131
2018-08-28 14:30:48 +02:00
Martin Baulig a2515a0869 [System]: MonoTlsStream is now IDisposable and cleans up on error. (#10254)
When the TLS Handshake fails in `MonoTlsStream.CreateStream()`, then we must dispose
the `SslStream` to avoid a memory leak.

In addition to this, `MonoTlsStream` now implements `IDisposable` and is disposes
in `WebConnection.CloseSocket()`.

Fixes #8689
2018-08-28 14:29:31 +02:00
Maxim Lipnin 1450bde147 [System.Reflection] CoreFX import for MemberInfo (#9746)
Part of #9660.

The imported CoreFX types:
- MemberInfo;

The changes:
- used MemberInfo type from CoreFX;
- moved MetadataToken property from MemberInfo to leaf classes; added unit tests.
- updated icall-def.h for related types;
- updated corlib version;
- added overridings for new HasSameMetadataDefinitionAs property to leaf classes; 
- included more MemberInfo xunit tests to verify HasSameMetadataDefinitionAs property;
- renamed MemberInfoExtensions class to DbLinqMemberInfoExtensions in System.Data.Linq assembly to avoid a conflict with the class imported to System.Reflection namespace.
- [acceptance-tests] removed AssemblyExtensions class which duplicates the same functionality introduced in System.Reflection.
2018-08-28 12:26:57 +02:00
Marek Safar ce3c8ec3f2 Revert "[jit] Disable tail calls from gsharedvt code for now."
This reverts commit 6c47574ce3.
2018-08-28 11:30:47 +02:00
Zoltan Varga 6c47574ce3 [jit] Disable tail calls from gsharedvt code for now.
Fixes https://github.com/mono/mono/issues/9870.
2018-08-28 11:29:14 +02:00
Jay Krell 1e4b141286 [Coop] System.Threading.NativeEventCalls two NOHANDLES(). (#10051) 2018-08-27 20:41:44 -07:00
Egor Bogatov c16ff9ab23 [corlib] Math from CoreFX (#10033)
* Math from CoreFX

* bump corefx, delete sysmath.h

* update icall-def.h

* bring back native Math.Round

* uncomment System.Runtime.Numerics tests (~1.5k of tests)

* undo reorder in sysmath.c

* ignore ComplexTests.cs

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-27 21:52:56 +02:00
Per Allansson 06ea7efeee mkbundle: fix warning about unsigned char vs char 2018-08-27 21:41:57 +02:00
Per Allansson fbe5c8ad34 mkbundle: fix warnings about unused functions 2018-08-27 21:41:57 +02:00
Bernhard Urban 20f1d2194f [mini] callers of MONO_INIT_CONTEXT_FROM_FUNC are expected to flush register windows 2018-08-27 21:21:48 +02:00
Bernhard Urban 917639ecba [mini] remove unused MONO_INIT_CONTEXT_FROM_CURRENT 2018-08-27 21:21:40 +02:00
Jay Krell a99a4a9da8 Add parens missed in recent 784b2c715f. (#10291)
Add parens missed in recent 784b2c715f.
2018-08-27 13:25:47 -04:00
Zoltan Varga 717e13ec5a [llvm] Clean llvm/llvm_config.mk on configure since it can become stale. 2018-08-27 18:16:48 +02:00
Johan Lorensson ed5562bd0b Merge pull request #9138 from Unity-Technologies/upstream-fix-ip-exceptions
Fix IndexOutOfRangeException: No adapter found for index when getting network information
2018-08-27 16:42:06 +02:00
Rodrigo Kumpera 88b715136a [wasm] Bump emscripten version to latest. 2018-08-27 10:24:29 -04:00
Rodrigo Kumpera 6ccdec9c13 [cross] Fix offsets. 2018-08-27 10:23:42 -04:00
Rodrigo Kumpera 1622d69994 Merge pull request #9837 from nsivov/eglib_fixes
[eglib] Fix compilation warnings.
2018-08-27 09:52:58 -04:00
Filip Navara 1b5ebf2649 System.Windows.Forms: Fix regressions in layout code and TextBox Font handling (#10238)
* Fix layout of scrollbars in combobox.

* Fix TextBox height fixup to work properly inside TableLayout.

* Fix changing TextBox font before the Control handle has been created.

* Add test case.

* Reintroduce fix for TextBoxTest.Bug82749. We need to save the user requested control bounds outside of ExplicitBounds since ExplicitBounds are used by table layout engine.
2018-08-27 15:35:01 +02:00
monojenkins b058bb2ab9 [csproj] Update project files 2018-08-27 13:53:39 +02:00
Katelyn Gadd 3a9a69dc63 Fix broken finally blocks in the binaryreader tests 2018-08-27 13:53:39 +02:00
Katelyn Gadd 764e23e4e1 Add win32+net_4_x specific sources files that pull in the win32 ones 2018-08-27 13:53:39 +02:00
Katelyn Gadd 46d2506036 Change platform specific sources overrides from hostplatform_libname to hostplatform_defaultprofile_libname 2018-08-27 13:53:39 +02:00
Jay Krell 3e35b1d251 Strengthen mono_arch_get_seq_point_info() & CallInst.call_info from void*. (#10275) 2018-08-26 21:07:56 -07:00
Joe Groocock 6462ec09a1 [runtime] Use AC_FUNC_STRERROR_R() in Mono.Posix
Inspired by https://github.com/mono/mono/commit/3b3b48dbb4cdbda44ffa2f10e74f819acb78bd96
Fixes https://github.com/mono/mono/issues/9532

Signed-off-by: Joe Groocock <[email protected]>
2018-08-26 23:21:24 +01:00
Jay Krell 4bb29fdf21 [cxx] [jit] [arm64] Make ARM64 JIT valid C++ -- mostly casts, and small amount of type change. (#9950)
[cxx] [jit] [arm64] Make ARM64 JIT valid C++ -- mostly casts, and small amount of type change.
2018-08-26 15:01:40 -07:00
Jay Krell 50ed34972b Remove unused mono_tls_lmf. (#10267) 2018-08-26 11:53:35 -07:00
Rodrigo Kumpera 2cf4550cbd [wasm] Fix compilation due to changes in master. 2018-08-24 13:45:55 -04:00
Rodrigo Kumpera a7bd4621ea Fix windows build. 2018-08-24 11:47:45 -04:00
Rodrigo Kumpera f6604e5bf2 [runtime] Fix race in abi.c and cleanup abi-details.h 2018-08-24 11:16:49 -04:00
Vlad Brezae 055573cc22 [llvm] Use curl as fallback for wget (#10263) 2018-08-24 10:44:18 +02:00
Marek Habersack 105256cc0c [eglib] Fix URI to file name conversion
Hexadecimal ASCII to decimal integer conversion must be 10-based.
2018-08-24 09:21:53 +02:00
Zoltan Varga 88c9ee04b1 [llvm] Emit volatile loads in emit_volatile_load (), otherwise llvm might optimize the loads away.
Fixes https://github.com/mono/mono/issues/10035.
2018-08-24 09:17:18 +02:00
Egor Bogatov b0ac4701d3 Add llvmopts to helpstring 2018-08-24 00:58:31 +03:00
Rodrigo Kumpera 53917b2e2a Add -llvmllc to --aot=help 2018-08-23 17:42:14 -04:00
Rodrigo Kumpera 600a8b03ac [wasm] Improve the experimental AOT setup. Improve documentation. 2018-08-23 17:29:17 -04:00
Egor Bogatov 616f346a91 update mono.1 for llc 2018-08-24 00:19:42 +03:00
Rodrigo Kumpera 3e28c43d1e [wasm] Disable reliance on llvm_code_start and llvm_code_end under wasm. 2018-08-23 17:18:26 -04:00
Rodrigo Kumpera 147dc0d0e9 [wasm] Fix typo. 2018-08-23 17:16:10 -04:00
Rodrigo Kumpera 89f5423018 [runtime] Move offsets to abi.c and Make them avaiable without the offsets file. 2018-08-23 17:15:11 -04:00
Rodrigo Kumpera 68ba3edd38 [wasm] Compute pending ahead of loop to handle non-standard eager evaluated promises. 2018-08-23 17:14:59 -04:00
Rodrigo Kumpera 7ddc9edbda [wasm] Fix a signature. 2018-08-23 17:14:50 -04:00
Rodrigo Kumpera ca2b5c9228 [wasm] Host and target layout can differ even under the same bitness. 2018-08-23 17:14:32 -04:00
Rodrigo Kumpera 622ef91b0c [wasm] Fix mono_arch_cpu_optimizations. 2018-08-23 17:14:10 -04:00
Rodrigo Kumpera 0096507cb2 [wasm] Register the wasm icalls even under AOT so they can be found. 2018-08-23 17:14:00 -04:00
Rodrigo Kumpera b3952d370d [mini] Fix this code to follow our guidelines. 2018-08-23 17:13:53 -04:00
Rodrigo Kumpera ec054f873c [wasm] Make the wasm sdk not depends on desktop sdk.
The issue was that packager.exe was using Mono.Cecil from net_4_x, which is only built/installed if the desktop sdk is built. We replace

Finally, we change the CI script to disable desktop as well to ensure we don't regress in that scenario.
2018-08-23 17:09:17 -04:00
Rodrigo Kumpera f147414dd7 [wasm] Disable dedup with llvm-only and remove it from wasm aot flag soup. 2018-08-23 17:05:44 -04:00
Egor Bogatov b829de7c4d make llc configurable 2018-08-23 23:11:54 +03:00
Rodrigo Kumpera d001c50666 [cross] Fix MONO_STRUCT_SIZE when an offsets file is used. (#10236)
[cross] Fix MONO_STRUCT_SIZE when an offsets file is used.
2018-08-23 15:40:06 -04:00
Aleksey Kliger cbd861f544 [mini] Don't regen Makefile.am if llvm/llvm_config.mk changes
The llvm/llvm_config.mk makefile fragment just includes make (not automake)
variable definitions.  So there is no need to regenerate the mini/Makefile.am
file if the fragment updates - the include will pick it up.
2018-08-23 17:46:22 +02:00
Jay Krell 9dc3ae6be5 Pass the correct boolean type to FreeAssemblyName -- MonoBoolean(byte) not gboolean(int32). (#10234) 2018-08-22 23:56:48 -07:00
Alexis Christoforides e2e3d67c94 [System.Native] Build a reduced library on Android and iOS 2018-08-23 05:31:57 +02:00
Jay Krell c72823b085 Refactor ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal and ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal into common mono_w32socket_getname. (#10206)
* [w32socket] Refactor ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal and ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal into common mono_w32socket_getname.

* [w32socket] Zero consistently. Note that a statically sized struct sockaddr_storage would be appropriate here.

* [cxx] Remove goto around init.

* PR: [w32socket] Use gboolean local instead of function-pointer/string to mono_w32socket_getname.
Restore lost comment.

* [cxx] [w32socket] Remove ternary operator on allocators so that rvalue constructor
can be removed here: https://github.com/mono/mono/pull/10027#issuecomment-414848498
2018-08-22 17:08:25 -07:00
Jay Krell 784b2c715f [cxx] [glib] [coop] Auto void* to non-void*, some casts, remove register. (#10027)
Provide for void* to non-void* conversion on common allocators (g_malloc, etc.) to "just work", via perhaps a bit of a surprising twist ("hack" or "technique"?).
This greatly reduces the churn of C to C++ conversion.
This helps handle.h in 3 places, at least 2 of which could use C++11 `auto` instead.

Ternary operator has reduced functionality as a result.
Either:
 1. Put in rvalue constructor, omitted here.
 2. Cast both sides of the ternary.
 3. Don't ternary.
This impacted only here:
https://github.com/mono/mono/pull/10206/commits/b543f3f0fd71e5801af059663b4d7b01a6390707

Add some explicit casts.

Remove `register`, as it is deprecated (warning or error) and means little (it does prevent taking-address, which helps optimizers).

Add parens missing in macros.

Favor `gssize` over `long` for consistency on Win64.
2018-08-22 17:07:42 -07:00
Michael DeRoy f93c1362c6 Fix issue where getting network information from loopback causes IndexOutOfRangeException: No adapter found for index 2018-08-22 14:02:13 -04:00
Alexander Kyte 196eb7c123 Merge pull request #9928 from alexanderkyte/crash_privacy_toggle
[runtime] Fix crash reporting configure options
2018-08-22 13:50:35 -04:00
Jay Krell d1c4b786df [cxx] Prefer gpointer/gconstpointer over char*, guint8* for untyped data -- fewer casts generally. (#9881)
This  tends to be more C++ compatible, and really is in this case.
2018-08-22 12:17:29 -04:00
Alexander Kyte da319465e7 [runtime] Add pipeline to convert managed exception into telemetry format (#10133)
* [runtime] Expose merp sender to icall

* [runtime] Add initial support for Exc -> Telemetry

In order to allow managed crash reporting using the existing telemetry
format, I have added initial support for converting a MonoException into
a json blob for telemetry.

* [runtime] Zero out stack memory for mono-state dumper

* [runtime] Add test for managed telemetry reporting

To test the proprietary bits, you must first have a copy of MERP
installed somewhere.

Then run the following test:

using System;
using System.Reflection;

public class MinimalTelemetry {

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

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

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

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

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

	}

	public static void Main (string[] args)
	{
		//AppDomain.CurrentDomain.LoadFrom ("something that's not a valid path")
		throw new Exception ("MinimalTelemetrybar MinimalTelemetrybar");
	}
}

* [runtime] Create more ergonomic API for Exc to Telemetry

* [runtime] Consistently zero summarizer state memory

* [runtime] Stub out exception summarizer when crash reporting is disabled

* [runtime] Add interpreter support for walking Exception stacks
2018-08-22 11:36:00 -04:00
Alexis Christoforides 805556ca09 [runtime] Use getprotobyname_r() where needed and available
Fixes https://github.com/mono/mono/issues/7087
2018-08-22 16:40:52 +03:00
Calvin 7561ff4100 Fix runtime test suite with mcs (#10219)
mcs doesn't have a -langversion:7.3 yet but -langversion:latest implies 7.3 (at the moment).
2018-08-22 10:54:10 +02:00
Johan Lorensson 39d1961b58 Merge pull request #9476 from lateralusX/lateralusX/issue8708
Fix race condition in WaitAnyWithSecondMutexAbandoned test.
2018-08-22 09:19:33 +02:00
Zoltan Varga abcf884db3 [runtime] Fix the invocation of update_submodules.sh during configure so it works for out-of-tree builds as well. 2018-08-22 08:49:51 +03:00
Jay Krell dcf89fa098 [cxx] wchar_t is not guint16, on Windows (#10112)
[cxx] wchar_t is not guint16, on Windows

https://jenkins.mono-project.com/job/x/12791/parsed_console/log.html

icall-windows.c: In function 'MonoStringHandle mono_icall_get_machine_name(MonoError*)':
icall-windows.c:65:75: error: invalid conversion from 'gunichar2* {aka wchar_t*}' to 'const guint16* {aka const short unsigned int*}' [-fpermissive]
   return mono_string_new_utf16_handle (mono_domain_get (), buf, len, error);
                                                                           ^
In file included from ../../mono/metadata/icall-internals.h:11:0,
                 from ../../mono/metadata/icall-windows-internals.h:13,
                 from icall-windows.c:14:
../../mono/metadata/object-internals.h:1963:1: note:   initializing argument 2 of 'MonoStringHandle mono_string_new_utf16_handle(MonoDomain*, const guint16*, gint32, MonoError*)'
 mono_string_new_utf16_handle (MonoDomain *domain, const guint16 *text, gint32 len, MonoError *error);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
icall-windows.c: In function 'MonoArray* mono_icall_get_environment_variable_names(MonoError*)':
icall-windows.c:136:101: error: invalid conversion from 'WCHAR* {aka wchar_t*}' to 'const guint16* {aka const short unsigned int*}' [-fpermissive]
     str = mono_string_new_utf16_checked (domain, env_string, (gint32)(equal_str - env_string), error);
                                                                                                     ^
In file included from ../../mono/metadata/icall-internals.h:11:0,
                 from ../../mono/metadata/icall-windows-internals.h:13,
                 from icall-windows.c:14:
../../mono/metadata/object-internals.h:1960:1: note:   initializing argument 2 of 'MonoString* mono_string_new_utf16_checked(MonoDomain*, const guint16*, gint32, MonoError*)'
 mono_string_new_utf16_checked (MonoDomain *domain, const guint16 *text, gint32 len, MonoError *error);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
icall-windows.c: In function 'void mono_icall_set_environment_variable(MonoString*, MonoString*)':
icall-windows.c:162:20: error: invalid conversion from 'mono_unichar2* {aka short unsigned int*}' to 'gunichar2* {aka wchar_t*}' [-fpermissive]
  utf16_name = name ? mono_string_chars (name) : NULL;
                    ^
icall-windows.c:168:34: error: invalid conversion from 'mono_unichar2* {aka short unsigned int*}' to 'gunichar2* {aka wchar_t*}' [-fpermissive]
  utf16_value = mono_string_chars (value);
                ~~~~~~~~~~~~~~~~~~^~~~~~~
icall-windows.c: In function 'MonoStringHandle mono_icall_get_windows_folder_path(int, MonoError*)':
icall-windows.c:188:76: error: invalid conversion from 'WCHAR* {aka wchar_t*}' to 'const guint16* {aka const short unsigned int*}' [-fpermissive]
   return mono_string_new_utf16_handle (mono_domain_get (), path, len, error);
                                                                            ^
In file included from ../../mono/metadata/icall-internals.h:11:0,
                 from ../../mono/metadata/icall-windows-internals.h:13,
                 from icall-windows.c:14:
../../mono/metadata/object-internals.h:1963:1: note:   initializing argument 2 of 'MonoStringHandle mono_string_new_utf16_handle(MonoDomain*, const guint16*, gint32, MonoError*)'
 mono_string_new_utf16_handle (MonoDomain *domain, const guint16 *text, gint32 len, MonoError *error);
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

* PR: Move the 'g' vs. 'mono' boundary slightly.
2018-08-21 19:26:26 -07:00
Jay Krell 2c32ed847a [cxx] Favor gpointer for weakly typed data, vs. guint8*, gchar*, etc. to reduce casts. (#10211) 2018-08-21 18:40:44 -07:00
Jay Krell 06dd38a520 [cxx] Make WebAssembly to native transitions valid C++. (#10120)
Function pointers do not convert silently to void*. Cast them.
2018-08-21 15:49:12 -07:00
Jay Krell 1e33fec085 [cxx] Use -std=gnu++0x for Centos6/g++4.4. (#10111) 2018-08-21 15:00:52 -07:00
Jay Krell 593e15cc18 Fix return values in error paths of mono_w32socket_transmit_file. (#10205) 2018-08-21 16:42:10 -04:00
Jay Krell 81594cc471 [cxx] Port cominterop.c to C++ -- just add some casts. (#10209) 2018-08-21 13:06:41 -07:00
Aleksey Kliger (λgeek) a98264a1c4 Two phase STW for hybrid suspend (#10140)
Implement a two-phase hybrid suspend scheme:
1. In the _entente phase_ put all threads in the suspend request state (either `ASYNC_SUSPEND_REQUESTED` or `BLOCKING_SUSPEND_REQUESTED`).  Wait for pending operations (but only wait for the async ones) and let all threads try to self-suspend.
2. In the _aggressive mop-up phase_ - preemptively suspend any threads that are still in `BLOCKING_SUSPEND_REQUESTED`.
2018-08-21 14:45:35 -04:00
Aleksey Kliger (λgeek) 68d518a09f [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case (#10161)
* [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case

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

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

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

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

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

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

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

* fixup - remove coop assertion in check_async_suspend

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

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

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

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

This should not have any effect on full cooperative or full preemptive suspend
- in the full coop case we never call async suspend, in the full preemptive
case the thread never self-suspends in blocking.
2018-08-21 14:14:45 -04:00
Neale Ferguson d8a5d891be An implementation of the ChainStatus property for Btls. (#10134)
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-21 16:40:08 +02:00
Calvin 9ba87eaf1a IsDebuggerPresent for AIX (#9995)
IsDebuggerPresent for AIX

checks self for the "process is traced" flag
2018-08-21 08:25:49 -04:00
Maxim Lipnin f74b39a298 [System.Reflection] CoreFX import fot Pointer type (#10194)
Part of #9660
2018-08-21 11:53:42 +02:00
Calvin 8ca0305e8b Use argv for cli_launcher on OSes that don't return full path for process names; fix mono_w32process_get_path on Free/NetBSD (#9860)
Use argv for cli_launcher on OSes that don't return full path for process names; fix mono_w32process_get_path on Free/NetBSD

Should fix process-leak test on AIX, maybe more. Also tested that it fixes the
same behaviour on FreeBSD. Other OSes may be affected; consult and test with the
files `w32process-unix-*.c`.

From comments:

```c
/*
 * XXX: verify if other OSes need it; many platforms seem to have it so that
 * mono_w32process_get_path -> mono_w32process_get_name, and the name is not
 * necessarily a path instead of just the program name
 */

/*
 * mono_w32process_get_path on these can only return a name, not a path;
 * which may not be good for us if the mono command name isn't on $PATH,
 * like in CI scenarios. chances are argv based is fine if we inherited
 * the environment variables.
 */
```
2018-08-21 05:40:08 -04:00
lateralusX b3a524e421 Fix race condition in WaitAnyWithSecondMutexAbandoned test.
There is a small race condition during the completion of a native thread join
call. During that period of time the tid is no longer included on the
internal list tracking joinable threads so a thread that will join on the
tid while another thread (like the finalizer thread) is waiting on native
join to complete for the same tid, will cause the managed Thread.Join call
to complete before the native join call has completed. This race could cause
issues on some OS:es that clear's up some thread resources, like abandoned
mutexes when the thread has exited. This race is hit by WaitAnyWithSecondMutexAbandoned
since the call to Thread.Join will return before the thread owning the mutex
has terminated meaning that it doesn't get ownership of the abandoned mutex
as assumed by the test.

Fix makes sure Thread.Join won't complete until native thread join is complete.
Increasing the join timeouts in the test also eliminates a timeout error making it
harder to hit the problematic code path, primarily during reproduction
in the debugger.

Fix also switch to coop mutex for joinable threads.
2018-08-21 11:28:05 +02:00
Jay Krell 80a064a912 HOST_WIN32 and HAVE_UNISTD_H are not mutually exclusive. (#10077)
And they are not checked in a consistent order, leading to bugs, or at least
somewhat surprises. This incorrect/unintended code fails to compiles as C++.

We should check them in a consistent order.
This favors Win32 over unistd.h but the opposite is probably ok too.

Also fix infinite loop in error path.

See https://jenkins.mono-project.com/job/x/12739/parsed_console/log.html
```
sgen-protocol.c: In function 'void binary_protocol_open_file(gboolean)':
sgen-protocol.c:101:31: error: invalid conversion from 'int' to 'HANDLE {aka void*}' [-fpermissive]
   binary_protocol_file = open (filename, O_CREAT | O_WRONLY, 0644);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sgen-protocol.c:102:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   if (binary_protocol_file == -1) {
                                ^
sgen-protocol.c:114:38: error: invalid conversion from 'HANDLE {aka void*}' to 'int' [-fpermissive]
    ftruncate (binary_protocol_file, 0);
                                      ^
In file included from ../../mono/utils/mono-compiler.h:14:0,
                 from sgen-gc.h:30,
                 from sgen-protocol.c:16:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:65:18: note:   initializing argument 1 of 'int ftruncate(int, off32_t)'
 __CRT_INLINE int ftruncate(int __fd, off32_t __length)
                  ^~~~~~~~~
sgen-protocol.c:116:36: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
  } while (binary_protocol_file == -1);
                                    ^
sgen-protocol.c: In function 'void close_binary_protocol_file()':
sgen-protocol.c:164:36: error: invalid conversion from 'HANDLE {aka void*}' to 'int' [-fpermissive]
  while (close (binary_protocol_file) == -1 && errno == EINTR)
                                    ^
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
                 from ../../mono/utils/mono-compiler.h:14,
                 from sgen-gc.h:30,
                 from sgen-protocol.c:16:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:328:15: note:   initializing argument 1 of 'int close(int)'
   int __cdecl close(int _FileHandle) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
               ^~~~~
sgen-protocol.c: In function 'void binary_protocol_flush_buffer(BinaryProtocolBuffer*)':
sgen-protocol.c:229:82: error: invalid conversion from 'HANDLE {aka void*}' to 'int' [-fpermissive]
   ret = write (binary_protocol_file, buffer->buffer + written, to_write - written);
                                                                                  ^
In file included from /usr/x86_64-w64-mingw32/sys-root/mingw/include/unistd.h:10:0,
                 from ../../mono/utils/mono-compiler.h:14,
                 from sgen-gc.h:30,
                 from sgen-protocol.c:16:
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:344:15: note:   initializing argument 1 of 'int write(int, const void*, unsigned int)'
   int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
               ^~~~~
```
2018-08-21 02:23:15 -07:00
Jay Krell 27fafcf65b Change mono_dynamic_image_add_to_blob_cached and mono_dynstream_add_data to accept gconstpointer instead of char* or const char* -- fewer casts. (#10203) 2018-08-21 02:08:56 -07:00
Jay Krell f4c5a56047 [cxx] Strengthen some types away from gpointer. (#9888) 2018-08-21 00:17:35 -07:00
Jay Krell 6be875c89e Abstract out CAS of MonoNativeThreadId and accomodate 4 bytes or pointer-sized, (#10037)
i.e. Windows is always 4 bytes.
2018-08-20 22:20:49 -07:00
Jay Krell 1555e3fb5f [cxx] Change large constants to unsigned to avoid truncation warning/error in some configuration. (#10053)
That is, >=0x80000000 does not fit in a signed 32bit long.

Linux manpage acknowledges the mess and says "unsigned int" will work "for most systems".
So let's do that and hope, "most systems" and other C runtimes besides glibc.

http://man7.org/linux/man-pages/man2/statfs.2.html

The __fsword_t type used for various fields in the statfs structure
definition is a glibc internal type, not intended for public use.
This leaves the programmer in a bit of a conundrum when trying to
copy or compare these fields to local variables in a program.  Using
unsigned int for such variables suffices on most systems.

Remove excess const and add more meaningful const.
2018-08-20 21:51:13 -07:00
Rodrigo Kumpera 92df599f13 [wasm] First code drop of the LLVM backend. (#10171)
* [wasm] Add no-opt aot compiler option to skip running opt.

* [wasm] Add initial scafold to support AOT'ing wasm modules.

* [wasm/llvm] Fix some wasm+llvm issues.

* [aot] Disable trampoline initialization if AOT compiling.

* [docs] Update manpage for new aot option.

* [wasm] Make mono_arch_emit_inst_for_method not assert.
2018-08-20 19:11:06 +02:00
Rodrigo Kumpera a05ee71e1b [sdks] Fix iOS SDK recent regression. (#10193)
* [sdks] Ensure out is created before we unpack llvm.

* [cross] Fix abi-details when offset files are used.
2018-08-20 19:00:43 +02:00
Jonathan Chambers a4ca0e01cf Properly inflate pointer types in inflate_generic_type. Generic pointer types are encountered with 'unmanaged' constraint. (#10145)
Properly inflate pointer types in inflate_generic_type. 

Generic pointer types are encountered with 'unmanaged' constraint.

Fixes #10144
2018-08-20 17:40:07 +02:00
Calvin e1651e85fa Truncate MachineName (and UserDomainName) at first period (#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-08-20 17:21:07 +02:00
Calvin 396559769d [System.Runtime.InteropServices] Detect Arm/Arm64 in RuntimeInformation (#10088)
* For ProcessArchitecture, use the DllMap arch of the runtime.

* For OSArchitecture, make an educated guess combining ProcessArchitecture and Environment.Is64BitOperatingSystem.

* For non-Intel/ARM architectures, (supported by Mono and not on the chopping block are PPC32/64, z, and WebAssembly) please dogpile onto dotnet/corefx#30706.
2018-08-20 17:18:06 +02:00
Alexander Kyte ddda3063e4 [runtime] Test GetPid for Mono.Posix (#9039) 2018-08-20 17:15:19 +02:00
Maxim Lipnin 69aa5ad38d [System.Reflection] CoreFX import for ModuleResolveEventHandler (#10190)
* [System.Reflection] CoreFX import for ModuleResolveEventHandler

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-20 17:10:20 +02:00
monojenkins 28b2bf9471 [bcl] Update BCL Linked Size (#10089) 2018-08-20 13:03:15 +02:00
Alexander Köplinger 8f67fb9fb1 Bump nunitlite to get NUnit2 xml output fix and failure on file not found fix (#10188)
See mono/NUnitLite#11 and mono/NUnitLite#12
2018-08-20 12:59:23 +02:00
Alexander Kyte ffe1866b81 Revert "[runtime] Cache culture locale name in managed" (#10172)
This reverts commit ae4bd53944.
2018-08-20 12:35:26 +02:00
Rolf Bjarne Kvinge a60c082cd7 [System.Xml.Linq] Fix namespace conflict with new Xamarin.Mac namespace in test code. (#10164)
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:07:29 +02:00
Vlad Brezae bbd6a6a286 [arm64] Unwind info for generic trampoline (#10149)
Fixes https://github.com/mono/mono/issues/9566
2018-08-20 13:05:14 +03:00
Jay Krell e89e9a5975 [cxx] C++ constants must be initialized, even if to zeros (mono_null_value_handle). (#10146)
```
$ cat constants-must-be-initialized-error.cpp

const struct { char a; } b;

$ cc -c constants-must-be-initialized-error.cpp
constants-must-be-initialized-error.cpp:2:26: error: default initialization of an object of const type 'const struct (anonymous struct at
      constants-must-be-initialized-error.cpp:1:7)' without a user-provided default constructor
const struct { char a; } b;
                         ^
                           = {}
1 error generated.

$ cat constants-must-be-initialized-fixed.cpp
const struct { char a; } b = { 0 };

$ cc -c constants-must-be-initialized-fixed.cpp
```
2018-08-17 15:27:56 -07:00
Ludovic Henry a1aa022dca [sdks] Fix local testing for Android (#10169) 2018-08-17 15:10:39 -04:00
Alexander Kyte 9bc111e2f4 Merge pull request #9911 from alexanderkyte/merp_timeout_detached
[runtime] Speed-up MERP timeout
2018-08-17 13:45:17 -04:00
Rodrigo Kumpera ddf5ab2f78 [wasm] Enough scafold to enable AOT work with the SDKs (#10136)
* [wasm] add wasm-aot and wasm-aot-runtime

* [runtime] Add MONO_STRUCT_SIZE that works similarly to MONO_STRUCT_OFFSET and handles mini types.

* [wasm] Add enough scafold for the AOT compiler.

* [wasm] Make some functions available for the interp to satisfy the linker.

* [wasm] Add aot-sample and link-sample helper targets for AOT development.

* [wasm/sdks] Update documentation.

* Update README.md
2018-08-17 19:11:42 +02:00
Jay Krell c4d2d34c4f Fix process leak in process enumeration. (#10156)
Dispose rejected ones.
https://github.com/mono/mono/issues/10143
2018-08-17 10:07:53 -07:00
Rodrigo Kumpera a01b8ee09a [llvm] Fix non-wasm build configure string. 2018-08-17 17:08:17 +03:00
Alexis Christoforides 51e8d322c0 Merge pull request #10153 from kumpera/fix-the-build
Reapply #10068 and fix the sdk build.
2018-08-17 16:49:31 +03:00
Jay Krell c62bdca50a [cxx] fmod is overloaded, assign to local to disambiguate. (#10147)
broken:
```c
#include <math.h>

void * pmod = fmod;

fmod-broken.cpp:3:15: error: address of overloaded function 'fmod' does not match required type 'void'
void * pmod = fmod;
              ^~~~
```

fixed:
```c
#include <math.h>

typedef double (*fmod_t)(double, double);

fmod_t pfmod = fmod;
```

A wrapper function would  also work:
```c
double mono_fmod (double a, double b)
{
  return fmod (a, b);
}

fmod_t pfmod = mono_fmod;
```

This may be advantagous, if the standard allows fmod to be a macro ("cannot take address of macros") or its signature to not match this.
However this would veer even further from apparent C compatibility (if our previous code was portable), so probably not.
2018-08-17 00:20:21 -07:00
Jay Krell 81815997bf [cxx] C++ does not allow goto around initialization. (#10132) 2018-08-16 23:36:23 -07:00
Jay Krell cf29d6eb7a [cxx] LLVM-specific C++ fixes -- just some casts. (#10045)
mini-llvm.c: In function 'void process_call(EmitContext*, MonoBasicBlock*, LLVMOpaqueBuilder**, MonoInst*)':
mini-llvm.c:3278:50: error: invalid conversion from 'gpointer {aka void*}' to 'LLVMValueRef {aka LLVMOpaqueValue*}' [-fpermissive]
     LLVMValueRef tramp_var = g_hash_table_lookup (ctx->jit_callees, call->method);

mini-llvm.c:5946:30: error: invalid conversion from 'gpointer {aka void*}' to 'LLVMValueRef {aka LLVMOpaqueValue*}' [-fpermissive]
    var = g_hash_table_lookup (ctx->module->objc_selector_to_var, name);

mini-llvm.c:6893:46: error: invalid conversion from 'void*' to 'void**' [-fpermissive]
  while (g_hash_table_iter_next (&iter, NULL, (gpointer)&l))
					      ^~~~~~~~~~~~

mini-llvm.c:7560:40: error: invalid conversion from 'gpointer {aka void*}' to 'GSList* {aka _GSList*}' [-fpermissive]
    GSList *addrs = g_hash_table_lookup (domain_info->llvm_jit_callees, callee);

mini-llvm.c: In function 'void add_intrinsic(LLVMModuleRef, int)':
mini-llvm.c:8146:29: error: invalid conversion from 'gpointer {aka void*}' to 'const char*' [-fpermissive]
  name = g_hash_table_lookup (intrins_id_to_name, GINT_TO_POINTER (id));

and there was one other error, fixed here.
2018-08-16 23:34:41 -07:00
Jay Krell c114ff59d9 [glib] About half of glib does not use config.h. (#10105) 2018-08-16 15:53:56 -07:00
Aleksey Kliger (λgeek) c636efec40 [reflection] Assembly.LoadFile should throw ArgumentException for relative paths (#10081)
* [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-16 17:43:50 -04:00
Jay Krell 5b918bf880 gcc/win32 emulates __thread, which is not clearly worthwhile. (#9672) 2018-08-16 13:11:29 -07:00
Alexander Kyte f6a66d50bd [runtime] Shorten merp timeout 2018-08-16 14:54:26 -04:00
Vlad Brezae 0fd0f172d6 [tests] Enable old test that seems to pass now 2018-08-16 21:28:49 +03:00
Vlad Brezae cc108cbfe0 [interp] Restore frame ip after running finally handler
EH still uses the original ip for determining whether there are any abort protected blocks to be exited, once the frame is unwinded.

Fixes delegate2.exe
2018-08-16 21:28:49 +03:00
Alexander Kyte 58258e8f23 [runtime] Add verbose/non-private crashes on CI 2018-08-16 13:53:37 -04:00
Alexander Kyte 80e600016f [runtime] Fix crash reporting configure options 2018-08-16 13:53:37 -04:00
Rodrigo Kumpera 9f495889ae [wasm] Fix llvm scripts for the sdks 2018-08-16 10:01:26 -04:00
Rodrigo Kumpera 933ddeb0ac Revert "Revert "Merge pull request #10068 from kumpera/wasm-target-cleanup""
This reverts commit 3dd1e1d92a.
2018-08-16 09:31:34 -04:00
Alexander Köplinger 3dd1e1d92a Revert "Merge pull request #10068 from kumpera/wasm-target-cleanup"
This reverts commit 5553faffcb, reversing
changes made to 790e6f6ff9.
2018-08-16 13:27:20 +02:00
Alexander Köplinger 6b92aef33b Revert "Fix llvm build"
This reverts commit bb8a7f4bda.
2018-08-16 13:26:49 +02:00
Alexander Köplinger bb8a7f4bda Fix llvm build 2018-08-16 12:45:46 +02:00
Aleksey Kliger (λgeek) b7a5575209 [sdks] Fix typo in ios template (#10130)
[sdks] Fix typo in ios template
2018-08-16 12:10:12 +02:00
Jay Krell 6d495bd4a6 [cxx] C++ does not have designated initializers. (#10109)
Current clang supports them, current g++ has partial support, Centos6 g++ 4.4 has no support.
2018-08-16 02:22:15 -07:00
Jay Krell fbfd1bff88 [cxx] More build support -- compile more as C++ if configure -enable-cxx. (#10115) 2018-08-15 17:59:03 -07:00
Jay Krell f892f95843 Fix bug -- dupe and dup are quite different. (#10117)
https://jenkins.mono-project.com/job/x/12802/parsed_console/log.html

ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken(gpointer, MonoError*)':
mono-security-windows.c:214:62: error: invalid conversion from 'int (*)(int)' to 'gpointer {aka void*}' [-fpermissive]
  return DuplicateToken (token, SecurityImpersonation, &dupe) ? dup : NULL;
                                                              ^
The code is confusing the local variable dupe with an 'e' at the end
with the function dup.
2018-08-16 00:05:27 +02:00
Jay Krell aaac994ddc [cxx] Use __typeof__ instead of typeof for Centos6/g++4.4. (#10110) 2018-08-15 14:56:34 -07:00
Maxim Lipnin 47cb859775 [System.Reflection] CoreFX import for ManifestResourceInfo and ResourceLocation types (#10098)
* [System.Reflection] CoreFX import for ManifestResourceInfo and ResourceLocation types.

Part of #9660.

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-15 20:50:12 +02:00
Jay Krell c14491aaff [cxx] One more MONO_API ahead of MONO_RT_EXTERNAL_ONLY. (#9964) 2018-08-15 09:37:31 -07:00
Jay Krell d6becb07e2 Bump corlib version (#10122)
Missed in e26c958.
2018-08-15 18:33:53 +02:00
Alexander Köplinger 5553faffcb Merge pull request #10068 from kumpera/wasm-target-cleanup
[wasm] Cleanup build system plus some required stubs.
2018-08-15 18:09:42 +02:00
Jay Krell 790e6f6ff9 mono_thread_info_set_is_async_context assert that setting to false is correct, i.e. no nesting
mono_thread_info_set_is_async_context assert that setting to false is correct, i.e. no nesting
Possibly related to #9566
2018-08-15 08:13:42 -07:00
Alexander Kyte bf0e9fac2b [merp] Fix json formatting bug (symbolicator already has workaround) (#9927) 2018-08-15 00:24:43 -04:00
Alexander Kyte 7e2b62cbbb [runtime] Remove O(N) traversal in class init (#9985) 2018-08-15 00:10:56 -04:00
Aleksey Kliger (λgeek) e26c958f3b [reflection] Implement RuntimeType.IsSubclassOf in native (#10012)
* [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:07:49 -04:00
Vlad Brezae 32d9b9ec3a [interp] Fix missing InvalidProgramException (#10095)
* [interp] Throw proper exception instead of warning

Fix code causing wrong stack state.

* [interp] Compile method for errors when needed

Delegate creation doesn't require compiling the method.

* [interp] Enable System.Core xunit tests
2018-08-15 00:05:01 -04:00
Filip Navara 583bae5a0a 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-08-14 23:52:47 -04:00
Zoltan Varga 3b30f85ab8 [bcl] Disable a test which fails with linking. (#10103)
Fixes https://github.com/xamarin/xamarin-macios/issues/4617.
2018-08-15 01:05:10 +02:00
Jay Krell 566b81fe7f [cxx] Better types at the mono_gc_alloc layer per https://github.com/mono/mono/pull/6695#discussion-diff-167398359L5601. (#10042)
This allows for fewer casts from void* to non-void* elsewehere.
2018-08-14 14:18:11 -07:00
Jay Krell 675c94ec7a [cxx] Make gunichar2==wchar_t on Windows. (#10056) 2018-08-14 13:45:57 -07:00
Jay Krell 8d47ae9ee3 [cxx] CentOS 6/gcc 4.4 and Android stdint.h/inttypes.h do not give everything without asking. (#9802) 2018-08-14 12:37:01 -07:00
Alon Zakai 7cb477cc1b fix a typo in scripts/mono-test-install (#10099) 2018-08-14 20:54:13 +02:00
Jay Krell 4d5af36293 Move icalls from utils to metadata. (#10052)
Functions added here https://github.com/mono/mono/commit/58efe9419268250709a6694abfa519b9b5d2c05c#diff-eba0fd0052bf3ec9dd60f2f3e90f19e1R8483
but icall-def.h entries missed.
2018-08-14 14:17:30 -04:00
Jay Krell ce3f4f5ebc [cxx] Types need to be unique in Wasm. (#10091)
https://jenkins.mono-project.com/job/test-mono-pull-request-wasm/3652/parsed_console/log.html

invalid enum type
!19255 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !7355, producer: "clang version 5.0.0  (emscripten 1.37.36 : 1.37.36)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !19256, retainedTypes: !19257, imports: !19263)
!19256 = !{!7363, !6973, !168}
!7363 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !7364, line: 192, size: 128, elements: !7365, identifier: "_ZTS10ParseState")
/mnt/jenkins/workspace/test-mono-pull-request-wasm/sdks/builds/toolchains/emsdk/clang/e1.37.36_64bit/llvm-link: error: linked module is broken!
2018-08-14 10:58:39 -07:00
Zoltan Varga df266dec2d [aot] Emit ref instances of the InternalArray methods only in corlib. (#10086)
* [aot] Emit ref instances of the InternalArray methods only in corlib.

* [aot] Use strncmp ().
2018-08-14 18:16:30 +02:00
Alexander Köplinger b70ea694c6 [xbuild] Ignore test-config-file-* 2018-08-14 18:07:02 +02:00
Jay Krell 3af676035b [cxx] Cast function pointers to gpointer esp. for thread create. (#9992)
Longer term some functions accepting function pointers can/should take
a stronger type, and the parameters match w/o casting.
Also cast int to enum one same line.
One of these is under if 0.

Should fix the following:

attach.c:494:13: error: no matching function for call to 'mono_thread_create_internal'
        internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (void *)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^

threadpool-io.c:585:7: error: no matching function for call to 'mono_thread_create_internal'
        if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, error))
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (gpointer)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^

gc.c:957:14: error: no matching function for call to 'mono_thread_create_internal'
        gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (gpointer)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^

attach.c:494:13: error: no matching function for call to 'mono_thread_create_internal'
        internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (void *)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^

threadpool-io.c:585:7: error: no matching function for call to 'mono_thread_create_internal'
        if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, error))
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:82:1: note: candidate function not viable: no known conversion from 'gsize (gpointer)' (aka 'unsigned long (void *)') to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, MonoThreadCreateFlags flags, MonoError *error);
^

:411:24: error: no matching function for call to 'mono_create_ftnptr'
                                func = (TestMethod)mono_create_ftnptr (mono_get_root_domain (), func);
                                                   ^~~~~~~~~~~~~~~~~~
../../mono/mini/mini-runtime.h:432:11: note: candidate function not viable: no known conversion from 'TestMethod' (aka 'int (*)()') to 'gpointer' (aka 'void *') for 2nd argument; take the address of the argument with &
gpointer  mono_create_ftnptr                (MonoDomain *domain, gpointer addr);

driver.c:1170:2: error: no matching function for call to 'mono_thread_create_checked'
        mono_thread_create_checked (mono_domain_get (), compile_all_methods_thread_main, &args, error);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
../../mono/metadata/threads-types.h:441:1: note: candidate function not viable: no known conversion from 'void (CompileAllThreadArgs *)' to 'gpointer' (aka 'void *') for 2nd argument
mono_thread_create_checked (MonoDomain *domain, gpointer func, gpointer arg, MonoError *error);
^
2018-08-14 08:51:20 -07:00
Alexander Kyte 7edc1024db [runtime] Make mini-llvm use only mono_aot_can_dedup (#10084)
LLVM was using the helper for the abandoned prototype linkonce work that
much predated when I picked up the project.

This is a problem because it can lead to aot-compiler thinking a method
is dedupable, while llvm thinking it's not. When this happens, the
symbol does not have the Assembly baked into it's name to ensure
uniqueness.
2018-08-14 17:10:50 +02:00
Alexander Köplinger 6ef65c3246 Disable unhandled-exception-4.exe test too
See https://github.com/mono/mono/issues/10031
2018-08-14 16:34:57 +02:00
Alexander Köplinger ff89616792 Add .gitignore for mono/tests/assembly-load-reference 2018-08-14 13:51:01 +02:00
Alexander Köplinger ab19ebffc8 [ci] Bump timeout for bockbuild in run-test-mac-sdk.sh 2018-08-14 13:32:15 +02:00
Maxim Lipnin 54380f84e3 [System.Reflection] CoreFX import for ConstructorInfo type (#9970)
Part of #9660
2018-08-14 10:54:47 +02:00
Jay Krell 2d5fb7b497 Strengthen the type of mono_gc_get_range_copy_func -- return a typed function pointer (#10057)
instead of a void*. And add const on the source of a memcpy.
2018-08-13 23:01:01 -07:00
Calvin 2bf8bb5a87 Fix mono_string_from_blob for big endian systems (#10072)
(Commit attributed to @kumpera because he wrote this quick fix, thanks!)

Fixes #10070
2018-08-14 02:28:37 +02:00
monojenkins daeab45ebb Bump API snapshot submodule 2018-08-13 19:56:31 +02:00
Martin Baulig d033472473 X509Certificate is now immutable.
We now adopt CoreFX's behavior in `X509Certificate` regarding serialization and immutability.

* All serialization APIs now throws `PlatformNotSupportedException`.
  (this was initially part of #9650, but had to be taken out due to problems with Xunit 2.4).

* All `Import()` overloads now throw `PlatformNotSupportedException`.

* The property setter of `X509Certificate2.PrivateKey` now also throws `PlatformNotSupportedException`.
2018-08-13 19:56:31 +02:00
monojenkins db2e884f00 [bcl] Update BCL Linked Size 2018-08-13 18:52:12 +02:00
Rodrigo Kumpera e5dc8fff6c [wasm] We can't build the debugger under the AOT compiler. 2018-08-13 11:21:04 -04:00
Rodrigo Kumpera a00fe46467 [wasm] Add some missing stubs required by the AOT compiler. 2018-08-13 11:19:27 -04:00
Rodrigo Kumpera eece4e8d86 [wasm] Switch to wasm32 triplet instead of configure hack. Depends on automake 1.16.1. 2018-08-13 11:14:44 -04:00
Aleksey Kliger (λgeek) d36902effd [mini] Don't assert on MONO_PATCH_INFO_GC_SAFE_POINT_FLAG if coop is disabled (#9974)
If an AOT library is loaded that was compiled with safepoints, but currently
we're running with preemptive suspend (e.g. MONO_THREADS_SUSPEND=preemptive is
set), don't assert.  `mono_polling_required` will always be false, so the
safepoint will be ignored.

Fixes https://github.com/mono/mono/issues/9947
2018-08-13 16:23:39 +02:00
Alexander Köplinger d8918ebd4a Merge pull request #9999 from kumpera/cleanup_p1
[wasm] First round of changes for the AOT compiler to handle WASM.
2018-08-13 15:31:02 +02:00
Rodrigo Kumpera 592e2a04cb Merge pull request #10048 from NattyNarwhal/iconv-fixes
Fix iconv in eglib, remove GNU libiconv-ism
2018-08-13 09:03:58 -04:00
Marek Safar d4e9972577 [corlib] Tweaks DependencyInjector to work with default linker setups 2018-08-13 13:27:28 +02:00
Filip Navara c3112e17cc Minor corlib cleanups (#10060)
- Remove two unused types from corlib (DecoupledTask is not used since migrating to StreamReader/StreamWriter from referencesources).
- Fix indentation in System.Security.Policy/Site.cs which mixed tabs and spaces.
- Fix comment in Test/System.Diagnostics/DebuggerTypeProxyAttribute.cs (to avoid false results when using grep on the source code).
2018-08-13 13:03:47 +02:00
Kenneth Pouncey 6db65716f3 [wasm] Add support for marshalling ArrayBuffer and TypeArrays (#10023)
* Add support for marshalling ArrayBuffer and TypeArrays from JavaScript to C#.

-  The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer.   More Info ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays#ArrayBuffer
-  JavaScript typed arrays are array-like objects and provide a mechanism for accessing raw binary data. (...).  More Info ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays
-  Some examples of API's that use these are Fetch, WebGL, Canvas, Web Audio API, XMLHttpRequests, WebSockets, Web Workers, Media Source API and File APIs.

| ArrayBuffer		| uint8_t	| byte[]	| byte or Byte (unsigned byte)
| Int8Array 		| int8_t	| sbyte[]	| byte or SByte (signed byte)
| Uint8Array		| uint8_t	| byte[]	| byte or Byte (unsigned byte)
| Uint8ClampedArray| uint8_t	| byte[]	| byte or Byte (unsigned byte)
| Int16Array		| int16_t	| short[]	| short (signed short)
| Uint16Array		| uint16_t	| ushort[]	| ushort (unsigned short)
| Int32Array		| int32_t	| int[]		| int (signed integer)
| Uint32Array		| uint32_t	| uint[]	| uint (unsigned integer)
| Float32Array		| floa	t	| float[]	| float
| Float64Array		| double	| double[]	| double

- Added tests to the bindings-test test harness.

* Add support for marshalling TypeArrays from C# to JavaScript.

- Add tests to test harness.
2018-08-13 11:41:38 +02:00
Marek Safar 3d4ba670f1 Bump linker to fix reflection deps (#9929)
<!--
Thank you for your Pull Request!

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

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-08-13 08:30:49 +02:00
Calvin Buckley b0ab59fa93 Fix iconv in eglib, remove GNU libiconv-ism
iconv in eglib was broken due to a broken define. Also fix linking
of iconv when iconv isn't in libc.

Also remove the usage of a GNU libcharset specific function and rely
on a standard POSIX function that outputs the same value on every
modern Unixoid I've tried it on. (Ubuntu/macOS/i/FreeBSD)

This comment explains a lot of things for the latter:

```c
/*
 * This function used used to use the "locale_charset" call in
 * libiconv's libcharset library. However, this isn't always
 * available on some systems, including ones with GNU libc. So,
 * instead use a function that's a standard part of POSIX2008.
 *
 * nl_langinfo is in POSIX2008 and should be on any sane modern
 * Unix. With a UTF-8 locale, it should return "UTF-8" - this
 * has been verified with Ubuntu 18.04, FreeBSD 11, and i 7.3.
 *
 * The motivation for using locale_charset was likely due to
 * the cruftiness of Unices back in ~2001; where you had to
 * manually query environment variables, and the values were
 * inconsistent between each other. Nowadays, if Linux, macOS,
 * AIX/PASE, and FreeBSD can all return the same values for a
 * UTF-8 locale, we can just use the value directly.
 *
 * It should be noted that by default, this function will give
 * values for the "C" locale, unless `setlocale (LC_ALL, "")`
 * is ran to init locales - driver.c in mini does this for us.
 */
```
2018-08-11 20:02:34 -04:00
Neale Ferguson 6d07dd66f1 Fix s390x build broken by incorrect specification of the msgfi instuc… (#10026)
Fix s390x build broken by incorrect specification of the msgfi instruction used in MUL_IMM type operations. The instruction had been encoded as its 32-bit counterpart (msfi). 

In addition, the s390x microcode makes the mono_strength_reduction_division unnecessary so this can be bypassed.

The change to basic.make is just to avoid error messages when basic-profile-check.exe hasn't been built yet.
2018-08-12 01:33:58 +02:00
Filip Navara 9343d6a2b6 Remove unnecessary Mono.Security references from corlib. (#10022)
<!--
Thank you for your Pull Request!

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

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-08-11 23:01:17 +02:00
Alexander Köplinger 37b78f0640 [ci] Disable unhandled-exception-2.exe
See https://github.com/mono/mono/issues/10031
2018-08-10 23:27:51 +02:00
Alexander Köplinger 7a9264c95d [linker] Fixup html template 2018-08-10 23:20:19 +02:00
Alexander Köplinger 40d2c8d663 [linker] Add BCL size diff for wasm profile 2018-08-10 22:45:49 +02:00
Aleksey Kliger (λgeek) 86d67fce03 [ci] Disable sgen-new-threads-collect.exe until #9959 is addressed (#10028)
The test times out due to an issue in hyrbid suspend.  Turn off the test
temporarily while we work on a solution.

https://github.com/mono/mono/issues/9959
https://github.com/mono/mono/issues/9921
2018-08-10 22:35:03 +02:00
Alexander Köplinger 22c9616fe2 [System.ServiceModel] Replace SynchronizedCollection with referencesource (#10021)
* [System.ServiceModel] Replace SynchronizedCollection with referencesource

This fixes a bug in the old implementation where we didn't have proper
locking in Add().

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=43447
Closes https://github.com/mono/mono/pull/10007

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-10 21:47:14 +02:00
Alexander Köplinger b15f577ef3 [utils] Include complex.c in the tarball
It's being included directly since 36956720f7
2018-08-10 18:50:03 +02:00
Alexander Köplinger 86f11bf8f6 Revert "Add default msbuild parameters so 'msbuild bcl.sln' will succeed (#9990)"
This reverts commit 4b7f40931c.

It broke a bunch of stuff because all msbuild projects picked up the new
command line args, not just bcl.sln.
2018-08-10 17:53:11 +02:00
Jay Krell 49bf2b31e8 [cxx] [boehm] extern "C" and interface void* instead of char* for use by C++ (#9953)
* [cxx] Add extern "C" to libgc so that it can be C, and used from C++.
This tracks mainline https://github.com/ivmai/bdwgc, barely.
See https://github.com/ivmai/bdwgc/commit/f4fbef0f7f0e3446856d2177535080158e16e403#diff-74e77959a62b8a560274f69789f50a94

* [cxx] [boehm] favor void* over char* interface for easier use from C++.
This tracks, barely.
See https://github.com/ivmai/bdwgc/blob/ae3d724f3645af119e1b2c2cefbb71c97d467546/mark.c#L1337

Mainline and Unity Boehm are valid C++, which is not the case here.
2018-08-10 08:46:35 -07:00
Calvin ffad4eb52d autotools fixes for AIX, FreeBSD and some stuff for Haiku (#9967)
* Fix build on AIX

	* crash reporting requires dladdr, a function AIX (at least
	  the version on CI) lacks

	* fix build with a powerpc64-*-(aix|os400)* triplet as IBM
	  wishes to do

* Fix some stuff for Haiku

Some stuff requires CoreFX PAL changes that haven't been merged and
thus one or two more items for configure to detect.

	* sigaltstack is broken for haiku

	* getifaddrs is available and PAL would like it, so fix it

* Fix detection of flock64

This erroneously detected flock64 on platforms that lacked it.
Fixes the build of CoreFX PAL on FreeBSD and Haiku.

* Fix flock64 define

* Fix define for flock64 in PAL block

* Remove nonsense comment that only applied to an older unreleased version of the patch
2018-08-10 15:19:06 +02:00
Alexander Köplinger 1dd7629f25 [metadata] Add nullfs to list of recognized filesystems (#9969)
Noticed this today when the corlib test which checks for unknown filesystems failed. Turned out it was because of a .dmg I had mounted:

```
$ mount | grep nullfs
/Volumes/Skype Meetings App/Skype Meetings App.app on /private/var/folders/cs/kt8x25p14g9dlk_p192rd7th0000gn/T/AppTranslocation/957CCB05-C113-4897-9C80-700C2CE4809E (nullfs, local, nodev, nosuid, read-only, noowners, quarantine, nobrowse, mounted by alexander)
```
2018-08-10 12:57:01 +02:00
Katelyn Gadd 4b7f40931c Add default msbuild parameters so 'msbuild bcl.sln' will succeed (#9990)
By default ```msbuild bcl.sln``` will fail because of our non-standard platform names and the need to restore nuget packages. Add a default response file so it just works. (Response files can be suppressed)
2018-08-10 01:14:31 +02:00
Rodrigo Kumpera 70d4d59e27 [wasm] Import the debugger proxy and split it into a pair of projects. (#9626)
This imports github.com/kumpera/ws-proxy into mono.
It facilitates distribution and coordination of upstream as there's a clean version connect between the two bits.
The proxy is currently version locked with the runtime.
2018-08-10 01:13:08 +02:00
Rodrigo Kumpera 4d45f25a38 [wasm] Call the correct single step trampoline. Fixes some step-into scenarios. (#9611)
* [wasm] Call the correct single step trampoline. Fixes some step-into scenarios.

* [wasm] Make the debugging sample a bit more complicated.

* [wasm] Add debugger support for removing breakpoints.
2018-08-10 01:12:19 +02:00
Rodrigo Kumpera 2f748975f8 [runtime] Sprinkle more mono_runtime_get_no_exec to make it work. 2018-08-09 19:06:51 -04:00
Ludovic Henry 5e96ce8f0d [w32file] Fix typo (#10001) 2018-08-09 18:01:13 -04:00
Jay Krell 67906d3118 [cxx] Mostly port utils. (#9819)
* [cxx] mono-logger.c int vs. enum and casts void* to non-void*

mono-logger.c:18:16: error: cannot initialize a variable of type 'GLogLevelFlags' with an rvalue of type 'int'
GLogLevelFlags mono_internal_current_level      = INT_MAX;
               ^                                  ~~~~~~~
mono-logger.c:19:16: error: cannot initialize a variable of type 'MonoTraceMask' with an rvalue of type 'int'
MonoTraceMask  mono_internal_current_mask       = ~((MonoTraceMask)0);
               ^                                  ~~~~~~~~~~~~~~~~~~~
mono-logger.c:305:17: error: cannot initialize a member subobject of type 'const MonoTraceMask' with an rvalue of type 'int'
                { "io-layer", MONO_TRACE_IO_LAYER_PROCESS
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-logger.c:315:12: error: cannot initialize a member subobject of type 'const MonoTraceMask' with an rvalue of type 'int'
                { "all", ~((MonoTraceMask)0) },
                         ^~~~~~~~~~~~~~~~~~~
mono-logger.c:316:11: error: cannot initialize a member subobject of type 'const MonoTraceMask' with an rvalue of type 'int'
                { NULL, 0 },
                        ^
mono-logger.c:392:30: error: cannot initialize a variable of type 'UserSuppliedLoggerUserData *' with an lvalue of type 'void *'
        UserSuppliedLoggerUserData *ll =logCallback.user_data;
                                    ^   ~~~~~~~~~~~~~~~~~~~~~
mono-logger.c:400:30: error: cannot initialize a variable of type 'UserSuppliedLoggerUserData *' with an lvalue of type 'void *'
        UserSuppliedLoggerUserData *ll = logCallback.user_data;
                                    ^    ~~~~~~~~~~~~~~~~~~~~~
mono-logger.c:451:30: error: cannot initialize a variable of type 'UserSuppliedLoggerUserData *' with an rvalue of type 'gpointer' (aka 'void *')
        UserSuppliedLoggerUserData *ll = g_malloc (sizeof (UserSuppliedLoggerUserData));
                                    ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 errors generated.

* [cxx] Add missing cast from void* to non-void* in g_renew.

* [cxx] mono-flight-recorder.c:97:22: error: cannot initialize a variable of type 'MonoFlightRecorder *' with an rvalue of type 'gpointer' (aka 'void *')
        MonoFlightRecorder *recorder = g_malloc0 (size_of_recorder_prefix + size_of_item_ptrs + size_of_items);
                            ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

add cast

* [cxx] mono-error.c:769:18: error: cannot initialize a variable of type 'MonoErrorBoxed *' (aka '_MonoErrorBoxed *') with an rvalue of type 'gpointer' (aka 'void *')
        MonoErrorBoxed* box = mono_image_alloc (image, sizeof (MonoErrorBoxed));
                        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cast from void* to non-void*

* [cxx] lock-free-alloc.c:358:27: error: no viable overloaded '='
                new_anchor = old_anchor = *(volatile Anchor*)&desc->anchor.value;
                             ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lock-free-alloc.c:90:9: note: candidate function (the implicit copy assignment operator) not viable: 1st argument ('volatile Anchor') would lose volatile qualifier
typedef union {
        ^
lock-free-alloc.c:90:9: note: candidate function (the implicit move assignment operator) not viable: 1st argument ('volatile Anchor') would lose volatile qualifier
typedef union {
        ^
lock-free-alloc.c:465:27: error: no viable overloaded '='
                new_anchor = old_anchor = *(volatile Anchor*)&desc->anchor.value;
                             ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lock-free-alloc.c:90:9: note: candidate function (the implicit copy assignment operator) not viable: 1st argument ('volatile Anchor') would lose volatile qualifier

C++ does not by default allow copying volatile aggregates (struct, union, class).
This is mostly reasonable because, imagine the struct does not fit in a register. How would it work?
Here, and it is probably common, the struct does fit in a register and the intent and implementation
is pretty obvious.
Anyway, you can provide operator= or copy the constituents (i.e. one integer that unions over the rest).

* [cxx] mono-threads.c strengthen type from gpointer to actual type,
add casts from void* to non-void*, add casts between int and enum,
remove excess GSList type that caused some errors.

mono-threads.c:568:2: error: no matching function for call to 'mono_threads_signal_thread_handle'
        mono_threads_signal_thread_handle (handle);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-threads.c:491:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'MonoThreadHandle *' for 1st argument
mono_threads_signal_thread_handle (MonoThreadHandle* thread_handle);
^
mono-threads.c:570:2: error: no matching function for call to 'mono_threads_close_thread_handle'
        mono_threads_close_thread_handle (handle);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./mono-threads.h:516:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'MonoThreadHandle *' for 1st argument
mono_threads_close_thread_handle (MonoThreadHandle *handle);
^
mono-threads.c:776:12: error: cannot initialize return object of type 'MonoThreadInfoFlags' with an rvalue of type 'gint32' (aka 'int')
    return mono_atomic_load_i32 (&info->flags);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-threads.c:783:22: error: cannot initialize a variable of type 'MonoThreadInfoFlags' with an rvalue of type 'gint32' (aka 'int')
        MonoThreadInfoFlags old = mono_atomic_load_i32 (&info->flags);
                            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-threads.c:794:8: error: definition of type 'GSList' conflicts with typedef of the same name
struct GSList {
       ^
../../mono/eglib/glib.h:330:24: note: 'GSList' declared here
typedef struct _GSList GSList;
                       ^
mono-threads.c:811:22: error: assigning to 'GSList *' (aka '_GSList *') from incompatible type 'gpointer' (aka 'void *')
        wait_request.next = old;
                            ^~~
mono-threads.c:852:10: error: assigning to 'GSList *' (aka '_GSList *') from incompatible type 'gpointer' (aka 'void *')
                        old = old_read;
                              ^~~~~~~~
mono-threads.c:866:3: error: no matching function for call to 'mono_os_sem_post'
                mono_os_sem_post (curr->data);
                ^~~~~~~~~~~~~~~~
./mono-os-semaphore.h:166:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'MonoSemType *' (aka 'unsigned int *') for 1st argument
mono_os_sem_post (MonoSemType *sem)
^
mono-threads.c:1865:10: error: cannot initialize return object of type 'MonoThreadInfoWaitRet' with an rvalue of type 'int'
                return MONO_THREAD_INFO_WAIT_RET_SUCCESS_0 + (res - MONO_OS_EVENT_WAIT_RET_SUCCESS_0);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 errors generated.

* [cxx] mono-threads-coop.c In C++, enums are not quite ints.
Their default underlying type (you can change it, per type, nice!), is int,
but they are unique types not automatically interchangable with int.

mono-threads-coop.c:530:9: error: cannot initialize return object of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
        return 0; /* unset */
               ^
mono-threads-coop.c:558:27: error: cannot initialize a variable of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
        MonoThreadsSuspendPolicy policy = 0;
                                 ^        ~
mono-threads-coop.c:571:27: error: cannot initialize a variable of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
        MonoThreadsSuspendPolicy policy = 0;
                                 ^        ~
mono-threads-coop.c:590:34: error: cannot initialize a variable of type 'MonoThreadsSuspendPolicy' with an rvalue of type 'int'
        static MonoThreadsSuspendPolicy policy = -1;
                                        ^        ~~
4 errors generated.

* [cxx] mono-utility-thread.c; cast from void* to non-void*.

mono-utility-thread.c:85:21: error: cannot initialize a variable of type 'MonoUtilityThread *' with an rvalue of type 'gpointer' (aka 'void *')
        MonoUtilityThread *thread = g_malloc0 (sizeof (MonoUtilityThread));
                           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-utility-thread.c:128:27: error: cannot initialize a variable of type 'UtilityThreadQueueEntry *' with an rvalue of type 'gpointer' (aka 'void *')
        UtilityThreadQueueEntry *entry = mono_lock_free_alloc (&thread->message_allocator);
                                 ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mono-utility-thread.c:154:27: error: cannot initialize a variable of type 'UtilityThreadQueueEntry *' with an rvalue of type 'gpointer' (aka 'void *')
        UtilityThreadQueueEntry *entry = mono_lock_free_alloc (&thread->message_allocator);
                                 ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.

* [cxx] Fix assignment of volatile aggregate without raising specter of ifdef __cplusplus.
Does this violate the abstraction? i.e. wouldn't it be better to assign entire aggregate
at the caller than to dig into its constituent member data?


All the casts of (x) can be replace with G_CAST (x) that I developed this morning and am working through.
2018-08-09 12:59:55 -07:00
Rodrigo Kumpera 7f786b2c13 [runtime] Rewrite mono_get_corlib_version to not allocate objects. 2018-08-09 13:33:00 -04:00
Rodrigo Kumpera 5651654795 [wasm/aot] Sprinkle some mono_runtime_get_no_exec to make sure we don't alloc objects during AOT. 2018-08-09 13:32:24 -04:00
Rodrigo Kumpera c96cbf6bd9 [runtime] Add mono_metadata_read_constant_value and mono_string_from_blob.
mono_metadata_read_constant_value was extracted from mono_get_constant_value_from_blob
but removing the bits that require GC interaction. This function will be used to read corlib version without allocating strings.

mono_string_from_blob decodes a string from a blob pointer, returns g_malloc'd memory.
2018-08-09 13:29:02 -04:00
Rodrigo Kumpera b0aaec2154 [wasm]Add --enable-wasm-aot hack to autocrap. 2018-08-09 13:15:56 -04:00
Rodrigo Kumpera de8bbe47f9 [wasm] Add support in utils for TARGET_WASM. 2018-08-09 13:06:46 -04:00
Jay Krell 36956720f7 [cxx] Port complex math to small portable C and C++. (#9821)
* [cxx] Port complex math to small portable C and C++ with the only dependency being hypot and non-complex math, and small preexisting code we already had for msvc.

I.e. we already had two versions, with varying portability.
Use one of them, adding about three lines to it.

There was some debate back and forth about macros/renames here.
This version significantly reduces line damage and is much easier to read.
Doing the rename as a separate step may still be advisable, to erase any doubt as to portable semantics, i.e. namespace isolation.

Mono style divergence is also left unfixed to avoid further line damage.
i.e. consider `double_complex` => `MonoComplex`.
`mono_double_complex_` => `mono_complex_`.
2018-08-08 22:52:56 -07:00
Katelyn Gadd 14d20074ff Move to generating msbuild choose elements to get if-else selection behavior for sources in projects so that we don't get erroneous duplicate files in cases where there are both profile and host platform criteria (#9952)
A recent commit revealed that in cases where we select based on a mix of host platform and profile, genproj csproj files can end up with duplicate sources because the existing <ItemGroup Condition= approach could make multiple groups match for a given compile when we really just want one.

This PR changes to generating a cascade of msbuild <Choose> elements, which give if-else selection to ensure that we only ever build a single set of files.
2018-08-09 02:52:37 +02:00
Marek Safar bd50f070bd [Facades] Adds System.Threading.Tasks.Extensions for mobile profiles (#9968)
* [Facades] Adds System.Threading.Tasks.Extensions for mobile profile

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-09 00:01:18 +02:00
Jay Krell bcd0864ed4 [cxx] C++ esp. clang does not allow goto around initialization. (#9785)
* [cxx] C++ does not allow goto around initialization.
The result would be undefined/uninitialized -- presumably that is what we get in C,
not as safe as it seems. Though, since variable not typically/ever used after goto target, it is ok. A little bit of language requirement for the compiler to do such analysis would have gone a long way, not sophisticated analysis, just used/not-used.

Not a problem in C89 because variables only at top.
Not a problem in idiomatic C++ because, often, early return + destructors.
But definitely a problem with C99, and goto for error handling.
Not a problem with msvc in default permissive mode.
Not likely a problem with gcc due to permissive option.
But a problem with clang.

* [cxx] Split declaration from initialization, instead of go up to within if (0).
2018-08-08 14:07:35 -07:00
Alexander Kyte a29ad08d00 [runtime] Add a reference queue cleanup for MonoInternalThread (#9914) 2018-08-08 22:13:28 +02:00
Jay Krell 64d7a6e57a [cxx] Remove two excess toplevel consts in structs, one a C++ problem, one very obscure/hypothetical. (#9955)
* [cxx] mono-merp.c:83:9: error: implicit default constructor for 'MERPStruct' must explicitly initialize the const member 'systemModel'

There are possible other solutions involving initializing up front, and later casting away const for additional initialization. Having public-const private-mutable is a good-seeming interface, but is pretty rare. Maybe in [cxx]future can restore const, add a constructor,  etc.

* Remove toplevel const in struct for extremely obscure reasons, again pretty rare pattern.

The obscure reason:

given:
```
typedef struct foo
{
  const int i; // remove const to fix
} foo;

foo global = { 1 };
```
compiled as C++, with some recent versions of Visual C++, there is a regression
where it thinks this is a dynamic initialization. Which is usually ok, but can be a problem in unusual cases (true story..delayload implementation..).
2018-08-08 11:45:28 -07:00
Aleksey Kliger (λgeek) e8c3dc775b [coop] Thread.JoinInternal should not call mono_error_set_pending_exception (#9948)
The icall was converted to use HANDLES(), so the icall wrapper will set the
pending exception from the MonoError.  If the icall does it, too, the second
use (in the wrapper) will assert that the MonoError is being reused after
cleanup without being reinitialized.

Also add an assertion in mono_error_get_message that we're not trying to get a
message from a cleaned up MonoError.

Fixes https://github.com/mono/mono/issues/9935
2018-08-08 12:07:19 -04:00
Zoltan Varga b3c9487377 [llvmonly] Fix a regression caused by 55950a0608. (#9942) 2018-08-08 10:49:28 -04:00
Jay Krell 80d7861331 [cxx] various fixes in mono/metadata (#9815)
* console-unix.c:221:21: error: cannot initialize a variable of type 'MonoMethod *' (aka '_MonoMethod *') with an rvalue of type 'gpointer' (aka 'void *')
        static MonoMethod *System_Console_DoConsoleCancelEventBackground_method = ((gpointer)-1);
                           ^                                                      ~~~~~~~~~~~~~~

* ../../mono/metadata/opcodes.h:27:14: error: ISO C++ forbids forward references to 'enum' types
typedef enum _MonoOpcodeEnum MonoOpcodeEnum;

* w32socket-unix.c:601:9: error: no matching function for call to 'mono_w32socket_send'
                ret = mono_w32socket_send (((MonoFDHandle*) sockethandle)->fd, buffers->Head, buffers->HeadLength, 0, FALSE);

Change parameter from char* to void*.

* In file included from console-unix.c:479:2: error: no matching function for call to 'set_control_chars'
        set_control_chars (MONO_ARRAY_HANDLE_PIN (control_chars_arr, gchar, 0, &h), mono_attr.c_cc);
        ^~~~~~~~~~~~~~~~~
             ^
console-unix.c:362:1: note: candidate function not viable: cannot convert argument of incomplete type 'gpointer' (aka 'void *') to 'gchar *' (aka 'char *') for 1st argument
set_control_chars (gchar *control_chars, const guchar *cc)

add cast in MONO_ARRAY_HANDLE_PIN

* w32socket-unix.c:635:11: error: assigning to 'gchar *' (aka 'char *') from incompatible type 'gpointer' (aka 'void *')
        buffer = g_malloc (SF_BUFFER_SIZE);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~

Change buffer to gpointer, and another similar.

* w32socket-unix.c:1136:99: error: cannot initialize a member subobject of type 'gpointer' (aka 'void *') with an lvalue of type 'gboolean (SOCKET, OVERLAPPED *, guint32, guint32)' (aka 'int (int, OVERLAPPED *, unsigned int, unsigned int)')
        { {0x7fda2e11,0x8630,0x436f,{0xa0,0x31,0xf5,0x36,0xa6,0xee,0xc1,0x57}} /* WSAID_DISCONNECTEX */, extension_disconect },
                                                                                                         ^~~~~~~~~~~~~~~~~~~
w32socket-unix.c:1137:99: error: cannot initialize a member subobject of type 'gpointer' (aka 'void *') with an lvalue of type 'gboolean (SOCKET, gpointer, guint32, guint32, OVERLAPPED *, TRANSMIT_FILE_BUFFERS *, guint32)' (aka 'int (int, void *, unsigned int, unsigned int, OVERLAPPED *, TRANSMIT_FILE_BUFFERS *, unsigned int)')
        { {0xb5367df0,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} /* WSAID_TRANSMITFILE */, extension_transmit_file },

Add cast to gpointer.
Also add const while there.

* w32process-unix.c:2189:14: error: no matching function for call to 'process_wait'
                        waitret = process_wait (process_info->process_handle, MONO_INFINITE_WAIT, NULL);

Add cast from void* to non-void*.

* w32process-unix.c:2099:3: error: cannot jump from this goto statement to its label
                goto done;
                ^
w32process-unix.c:2111:13: note: jump bypasses variable initialization
        gunichar2 *args = utf16_concat (utf16_quote, lpFile, utf16_quote, lpParameters ? utf16_space : NULL, lpParameters, (const gunichar2 *)NULL);
                   ^
w32process-unix.c:2104:19: note: jump bypasses variable initialization
        const gunichar2 *lpDirectory = coop.length.working_directory ? coop.working_directory : NULL;
                         ^
w32process-unix.c:2103:19: note: jump bypasses variable initialization
        const gunichar2 *lpParameters = coop.arguments;
                         ^
w32process-unix.c:2102:19: note: jump bypasses variable initialization
        const gunichar2 *lpFile = coop.filename;
                         ^
w32process-unix.c:2285:3: error: cannot jump from this goto statement to its label
                goto exit;
                ^
w32process-unix.c:2291:13: note: jump bypasses variable initialization
        gunichar2 *dir = coop.length.working_directory ? coop.working_directory : NULL;
                   ^
w32process-unix.c1 error generated.
:2288:13: note: jump bypasses variable initialization
        gunichar2 *args = coop.length.arguments ? coop.arguments : NULL;

etc.

Separate declaration from initialization.

* appdomain.c:554:22: note: jump bypasses variable initialization
        MonoAppDomainHandle ad = mono_domain_create_appdomain_internal (friendly_name, setup, error);
                            ^
appdomain.c:590:2: error: cannot jump from this goto statement to its label
        goto_if_nok (error, leave);
        ^
etc.

Split local declaration from initialization.

* w32process-unix.c:1914:27: error: no matching function for call to 'mono_handle_new'

and error on every typesafe MONO_HANDLE_NEW call

Have MONO_HANDLE_TYPECHECK_FOR return MonoObject* instead of gpointer, by casting.
Could probably also change mono_handle_new to accept gpointer.

* class-accessors.c:247:9: error: cannot initialize return object of type 'MonoMarshalType *' with an rvalue of type 'void *'
        return mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_MARSHAL_INFO);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:265:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'void *'
        Uint32Property *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_REF_INFO_HANDLE);
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:273:19: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'void *'
                Uint32Property *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_REF_INFO_HANDLE);
                                ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:279:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'gpointer' (aka 'void *')
        Uint32Property *prop = mono_class_alloc (klass, sizeof (Uint32Property));
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:294:19: error: cannot initialize a variable of type 'PointerProperty *' with an rvalue of type 'gpointer' (aka 'void *')
        PointerProperty *prop = mono_class_alloc (klass, sizeof (PointerProperty));
                         ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:334:9: error: cannot initialize return object of type 'MonoClassPropertyInfo *' with an rvalue of type 'void *'
        return mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_PROPERTY_INFO);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:347:9: error: cannot initialize return object of type 'MonoClassEventInfo *' with an rvalue of type 'void *'
        return mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_EVENT_INFO);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:372:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'void *'
        Uint32Property *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_DECLSEC_FLAGS);
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:379:18: error: cannot initialize a variable of type 'Uint32Property *' with an rvalue of type 'gpointer' (aka 'void *')
        Uint32Property *prop = mono_class_alloc (klass, sizeof (Uint32Property));
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:412:18: error: cannot initialize a variable of type 'WeakBitmapData *' with an rvalue of type 'gpointer' (aka 'void *')
        WeakBitmapData *info = mono_class_alloc (klass, sizeof (WeakBitmapData));
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:423:18: error: cannot initialize a variable of type 'WeakBitmapData *' with an rvalue of type 'void *'
        WeakBitmapData *prop = mono_property_bag_get (m_class_get_infrequent_data (klass), PROP_WEAK_BITMAP);
                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:454:19: error: cannot initialize a variable of type 'DimConflictData *' with an rvalue of type 'gpointer' (aka 'void *')
        DimConflictData *info = mono_class_alloc (klass, sizeof (DimConflictData));
                         ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-accessors.c:469:19: error: cannot initialize a variable of type 'DimConflictData *' with an rvalue of type 'void *'
        DimConflictData *info = mono_property_bag_get (&klass->infrequent_data, PROP_DIM_CONFLICTS);
                         ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Cast from void* to non-void*.

* class.c:3005:16: error: assigning to 'char *' from incompatible type 'const char *'
        if ((nested = strchr (name, '/'))) {
                      ^~~~~~~~~~~~~~~~~~
class-init.c:437:11: error: assigning to 'MonoClass *' (aka '_MonoClass *') from incompatible type 'gpointer' (aka 'void *')
                klass = mono_image_alloc0 (image, sizeof (MonoClassGtd));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-init.c:442:11: error: assigning to 'MonoClass *' (aka '_MonoClass *') from incompatible type 'gpointer' (aka 'void *')
                klass = mono_image_alloc0 (image, sizeof (MonoClassDef));
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class-init.c:500:5: error: cannot jump from this goto statement to its label
                                goto parent_failure;
                                ^
class-init.c:599:6: note: jump bypasses variable initialization
        int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
            ^
class-init.c:597:6: note: jump bypasses variable initialization
        int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
            ^
class-init.c:496:5: error: cannot jump from this goto statement to its label
                                goto parent_failure;
                                ^
class-init.c:599:6: note: jump bypasses variable initialization
        int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
            ^
class-init.c:597:6: note: jump bypasses variable initialization
        int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
            ^
class-init.c:490:4: error: cannot jump from this goto statement to its label
                        goto parent_failure;
                        ^
class-init.c:599:6: note: jump bypasses variable initialization
        int first_method_idx = cols [MONO_TYPEDEF_METHOD_LIST] - 1;
            ^
class-init.c:597:6: note: jump bypasses variable initialization
        int first_field_idx = cols [MONO_TYPEDEF_FIELD_LIST] - 1;
            ^
class-init.c:838:14: error: no matching function for call to 'class_kind_may_contain_generic_instances'
        image_set = class_kind_may_contain_generic_instances (eclass->class_kind) ? mono_metadata_get_image_set_for_class (eclass) : NULL;
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* class.c:3005:16: error: assigning to 'char *' from incompatible type 'const char *'
        if ((nested = strchr (name, '/'))) {
                      ^~~~~~~~~~~~~~~~~~

class.c:427:10: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
                        char *s = strchr (klass_name, '`');
                              ^   ~~~~~~~~~~~~~~~~~~~~~~~~

add const, add cast, and also fix adjacent integer truncation

* assembly.c:2964:8: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *'
        char *eqsign = strchr (pair, '=');

add cast

* cominterop.c:664:2: error: no matching function for call to 'register_icall'
        register_icall (cominterop_get_method_interface, "cominterop_get_method_interface", "ptr ptr", FALSE);
        ^~~~~~~~~~~~~~

repeatedly

Add cast in macro.

Also another need for a cast on a string (error not recorded).

* [cxx] icall.c:
 casts
 change char* to void*
 split local declaration from initialization
 add extern "C" around external code (environ -- probably merged to master already)

* image.c:726:8: error: no matching function for call to 'strcmp'
                        if (strcmp (list_iter->data, name) == 0) {
                            ^~~~~~
image.c:1184:20: error: constant expression evaluates to 2218203019 which cannot be narrowed to type 'int' [-Wc++11-narrowing]
        IGNORED_ASSEMBLY (0x8437178B, SYS_NET_HTTP, "C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0", "4.3.0 net46"),
                          ^~~~~~~~~~
 repeatedly

add casts

* [cxx] marshal.c

marshal.c:224:3: error: no matching function for call to 'register_icall'
                register_icall (mono_marshal_string_to_utf16, "mono_marshal_string_to_utf16", "ptr obj", FALSE);

repeatedly; add cast in macro

Also possible int/enum mixup -- add cast.

* [cxx] property-bag.c

property-bag.c:44:37: error: cannot initialize a variable of type 'MonoPropertyBagItem *' (aka '_MonoPropertyBagItem *') with an lvalue of type 'void *'
        MonoPropertyBagItem *cur, **prev, *item = value;

Add cast here, and another.

* [cxx] metadata.c
add casts from void* to non-void*
indicate future enum instead of int
remove designated intitializers

* [cxx] more appdomain.c

* PR: Repatriate orphaned comment.

* PR: include opcodes.h instead of duplicating MonoOpcodeEnum
2018-08-08 01:48:13 -07:00
Jay Krell b8416e942e Remove extern "C" from MONO_LLVM_INTERNAL.
Consider also putting it at start of prototype instead of end, like MONO_API.
2018-08-08 10:29:01 +02:00
Jay Krell 6e6b4740f6 Remove gratuitous ifdef and variable-length array. (#9896)
We might as well just have one more portable form here.
2018-08-08 01:16:10 -07:00
Zoltan Varga da89b32e14 [sdks] Use separate temporary dirs for llvm36/llvm. 2018-08-08 09:15:18 +02:00
Jay Krell 7f4b669ec1 [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192. (#9884) 2018-08-07 20:03:47 -07:00
nsivov d7cb4f260e [corlib] Fix method access failures for __ComObject instances hosted in dummy assembly. (#9936)
Otherwise I get consistent access failures for CALLVIRT from mono_method_to_ir().

Stacktrace looks like this:

```
System.InvalidOperationException: WinForms_SeeInnerException ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an        invocation. ---> System.MethodAccessException: Method `System.__ComObject..ctor()' is inaccessible from method `System.__ComObject..ctor()'
445286   at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_throw_method_access(intptr,intptr)
445287   at System.__ComObject..ctor () [0x00000] in <430892d2beef407ea6b21748b72c1144>:0
445288   at (wrapper cominterop-invoke) System.__ComObject..ctor()
445289   at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
445290   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445291    --- End of inner exception stack trace ---
445292   at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445293   at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x000a8] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445294   at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <b683bf5ced8643af8ec       2e589dfb23c2b>:0
445295   at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <b683bf5ced86       43af8ec2e589dfb23c2b>:0
445296   at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
445297   at System.Activator.CreateInstance (System.Type type) [0x00000] in <b683bf5ced8643af8ec2e589dfb23c2b>:0
```

My understanding is that misleading exception message is due to exact same name used for dynamic type, in fact it means that some type in dummy assembly can't access internal method from corlib.
2018-08-08 01:18:51 +02:00
Jay Krell d73de73f59 Replace many uses of alloca with g_newa. (#9894) 2018-08-07 14:45:27 -07:00
Jay Krell 02e166e361 Fix overallocate by factor of four -- this was len * sizeof(guint8*) instead of len * sizeof(guint8), which devolves here to just alloca(len). (#9885)
* Fix overallocate by factor of four -- this was len * sizeof(guint8*) instead
of len * sizeof(guint8), which devolves here to just alloca(len).
2018-08-07 14:09:29 -07:00
Alexander Kyte 413a185f4c Merge pull request #8654 from alexanderkyte/enable_linux_dumping
Enable mono-state-based telemetry for crashing on CI
2018-08-07 15:35:48 -04:00
Jay Krell bcd3b53f04 [cxx] threadpool-worker-default.c other than complex math: casts on functions and ints/enums (#9822) 2018-08-07 14:50:32 -04:00
Marek Safar 9e592d3483 [corlib] Update linker descriptors 2018-08-07 19:39:25 +02:00
Jo Shields 7c50c6ac26 Merge pull request #9937 from directhex/fix-mkbundle-gen
Allow override of mkbundle generation library extension
2018-08-07 11:10:46 -04:00
Jo Shields d02cf68f3e Allow override of mkbundle generation library extension 2018-08-07 11:09:40 -04:00
Aleksey Kliger (λgeek) 8690d0aeb0 [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority (#9916)
* [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority

   Observed pthread_getschedparam taking a lock on OSX

* [win32] Capture GetLastError before MONO_EXIT_GC_SAFE
2018-08-07 10:47:15 -04:00
Kenneth Pouncey 00f64d2998 Wasm Bindings enhancements (#9865)
* Fix Tasks and Promises in bindings.

- Tasks were not being marshalled correctly in some circumstances.  The only place that I could reproduce this was in the bindings tests.  Running from outside the test harness would not reproduce this error.
- Promises would intermittently throw Exceptions:  NullReferenceException, ArrayIndex out of bounds.
- When using Promises from JS to CS there were random Memory access exceptions.  Looks like memory was being trampled on.  Adding an integer variable to the create_task_completion_source call fixed these problems as the CreateTaskSource is defined as receiving an int variable.  This also fixed the NullReferenceExceptions and ArrayIndex out of bounds exceptions.

* Make JSObject disposable

- Add the ability to dispose of a JSObject.
- The dispose will remove the object from the tracked object list and will allow the reference counter to be recycled later.
- By keeping a recycled list of references and reusing those will keep the tracked objects array from growing out of hand.
- Add test to the Test Harness.
- Modifiy the way the bindings init works by passing in of the Assembly and Class `[asm]namespace.class`.  Modfiy test.js to use the new format.

* Add support for Get and Set of javascript properties on a JSObject.

* The namespace problem was fixed in https://github.com/mono/mono/pull/9836

* Cleanup unused and duplicate definitions
2018-08-07 11:50:16 +02:00
Zoltan Varga 371de430b6 [sdks] Rename LLVM_VERSION make var to LLVM_RELEASE, LLVM_VERSION is already used by versions.mk. (#9919) 2018-08-07 05:16:48 -04:00
Marek Safar ad219e63bc [linker] Pass more profile flags to calculate size 2018-08-07 10:20:13 +02:00
Steve Pfister 4dfc22398a Modified most of the reflection member lookup methods to support prefix searches (PropertyName*). This matches the refsrc behavior. 2018-08-07 09:12:50 +02:00
Jay Krell 8a15c5f722 [cxx] Fix enum/int mixup in new code. (#9886) 2018-08-06 20:46:08 -07:00
Alexander Kyte 65582de451 [runtime] Disable crash reporting on the SDKS 2018-08-06 23:32:49 -04:00
Jay Krell 61fbc7fee2 Remove unconditional alloca by a constant. (#9895) 2018-08-06 19:51:46 -07:00
Aleksey Kliger (λgeek) 4aa4c01274 [loader] Determine assembly load context from path (#9858)
* [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.

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

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

* [loader] Pass requesting assembly to mono_assembly_open_predicate

   In LoadFrom and LoadFile icalls, pass the currently executing assembly as the
   requesting assembly.

* [utils] Add mono_path_filename_in_basedir

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

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

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

* [tests] AOT assembly-load-reference tests
2018-08-06 19:05:55 -04:00
Vlad Brezae 60643fccb4 [metadata] Fix use after free of signatures of some dynamic methods (#9863)
* [metadata] Cache method signature in correct image hash

When freeing dynamic methods in mono_free_method, we remove entries in the method image's hashtables, hashed by the soon to be freed method signature.

* [metadata] Avoid unnecessary alloc
2018-08-06 22:18:53 +02:00
Jo Shields a8a7c146e4 Merge pull request #9907 from directhex/master
Bump version to 5.19.0
2018-08-06 14:36:22 -04:00
nsivov 830c726b7c Add missing return from the function. (#9836)
Was accidentally removed in 3780114620.
2018-08-06 20:04:16 +02:00
Alexander Kyte d5d68eff8a [runtime] Speed-up MERP timeout 2018-08-06 12:46:11 -04:00
Alexander Kyte 4d22561f8c Merge pull request #9862 from alexanderkyte/culture_speedup
[runtime] Cache culture locale name in managed
2018-08-06 12:36:23 -04:00
Jo Shields 29f3ad4c9a Bump version to 5.19.0 2018-08-06 11:46:01 -04:00
Rodrigo Kumpera d4c5708379 Merge pull request #9789 from nsivov/master
[mini] Increase inline cost linearly to number of calls.
2018-08-06 08:51:46 -04:00
Marek Safar c7e9b58154 [build] Updated script after xunit runner utility rename 2018-08-06 14:26:26 +02:00
Zoltan Varga 119cd74023 [llvm] Fix OP_ABSF. (#9878)
Fixes https://github.com/mono/mono/issues/9869.




<!--
Thank you for your Pull Request!

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

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

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

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

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

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

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

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

* [coop] Add mono_threads_suspend_override_policy ()

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

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

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

* [coop] Enter GC Safe around mono_threads_join_lock ()

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

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

   Move safepoint suspend check to mono_runtime_set_execution_mode

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

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

* [sgen] SgenDescriptor should use the target wordsize.

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

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

* Fix typo

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

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

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

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

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

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

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

But it is not needed "everywhere".

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

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

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

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

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

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

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

* Bump API snapshot submodule

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

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

* [jit] Use target sizes in many places.

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

* [runtime] Fix the arm build.
2018-08-03 04:53:43 -04:00
Zoltan Varga 4224af359c [runtime] Add a drive type entry for the Paragon NTFS drive on macos. (#9677) 2018-08-02 21:24:13 -04:00
Alexander Kyte ae4bd53944 [runtime] Cache culture locale name in managed
Every different locale getter in unmanaged attempts to
cache the result from this icall. Some of them fail to do so in a manner
that is correct.

CFLocaleCopyCurrent (); in get_darwin_locale ends up being called
thousands of times. In an app with a few dozen printfs, it's easy to see
18mb of leaked memory through this.

Rather than trying to fix them all in unmanaged in a perfect manner, I
thought it better to also avoid the icall overhead and to cache it in
C#.

Without this fix, a memory traffic stress test (debian shootout's pidigits) leads to 66% of
memory pressure being due to this  icall. With this fix, it is 4.3%.

If this caching is wrong for correctness reasons (we expect it to change?),
I would like to point out that we have similar caching done in unmanaged
and that we should then bring both into a correct design.
2018-08-02 17:02:46 -04:00
Michael DeRoy 84df14cff4 Fix issue where get offset could return 0 when the type is uninited 2018-08-02 15:09:41 +02:00
Maxim Lipnin 6734b30f3b [System.Reflection] CoreFX import for several simple types. (#9844)
Part of #9660.

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

* [offset-tool] Emit sizes for structures.

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

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

* [runtime] Add missing object offsets for x86.

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

* [runtime] Fix the windows build.

* [offset-tool] Fix indentation.

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

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

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

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

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

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

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

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

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

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

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

Unless I fucked up, should fix #9772.
2018-08-01 16:20:03 +02:00
Nikolay Sivov b7a2d5d61c [eglib] Fix compilation warning, remove unused and broken functions. 2018-08-01 13:53:01 +03:00
Nikolay Sivov 8a936cde3a [eglib] Fix misleading indentation warning. 2018-08-01 13:53:01 +03:00
Filip Navara 60b95ba08d Fix System.Drawing on 64-bit macOS. (#9824)
Carbon implementation now throws exception instead of crashing in the mismatched p/invoke calls.
Cocoa implementation now support 64-bit mode and uses the handle of `NSView` that is passed in instead of relying on `NSGraphicsContext.CurrentContext`. It also fixes handling of flipped views.

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

* [runtime] MONO_API mono_domain_set_config needs GC Unsafe

* [runtime] MONO_API mono_dllmap_insert sometimes needs GC Unsafe

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

* [runtime] MONO_API mono_g_hash_table_insert needs GC Unsafe

* [runtime] MONO_API mono_g_hash_table_new_type needs GC Unsafe

* [runtime] MONO_API mono_gc_reference_queue_new needs GC Unsafe

* [runtime] mono_thread_detach_if_exiting thread state change

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

* [metadata] Make mono_class_get_fields external only

   - Runtime should use mono_class_get_fields_internal
   - MONO_API mono_class_get_fields needs GC Unsafe

* [runtime] MONO_API mono_gc_reference_queue_add needs GC Unsafe

* [metadata] Make mono_class_get_name and namespace external only

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

* [metadata] MONO_API mono_class_get_parent needs GC Unsafe

   - mark it external only; runtime should use m_class_get_parent

* [metadata] Make mono_class_is_delegate external only

   - runtime should use m_class_is_delegate
   - MONO_API mono_class_is_delegate needs GC Unsafe

* [metadata] Make mono_class_is_valuetype external only

   - runtime should use m_class_is_valuetype
   - MONO_API mono_class_is_valuetype needs GC Unsafe

* [metadata] Make mono_class_is_enum external only

   - runtime should use m_class_is_enum_type
   - MONO_API mono_class_is_enum needs GC Unsafe

* [metadata] Mark mono_class_get_element_class external only

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

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

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

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

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

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

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

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

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

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

* [interp] Correctly hande a few conv ovf cases

For conversion from unsigned value to i1 and i2.

* [interp] Fix multiplication overflow case

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

Fixes the XUnit 2.4 problem.

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

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

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

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

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

* [Coop] ves_icall_System_Threading_Thread_MemoryBarrier is NOHANDLES().

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

* Make YieldInternal NOHANDLES and remove two potential layers.

* [Coop] Make ves_icall_System_Threading_Thread_current_lcid NOHANDLES().

* [Coop] mono_100ns_ticks nohandles.

* [Coop] More nohandles volatile reads/writes.

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

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

* [interp] Use fast versions for icalls

* [interp] Include more fast pinvoke/icall signatures

These cover almost all icalls

* [interp] Fix fast icall return value

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

Commits since last update:

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

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

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

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

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

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

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

* Bump API snapshot submodule

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

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

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

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

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

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

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

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

* Add tests

* add test file and make tests actually output something

* Smarter unit test around disassembling methods

* Try single quoting environment variable value

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* [interp] fix compiler warning around MINT_INTRINS_BYREFERENCE_CTOR

fixes those warnings:

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

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

* Avoid affecting Boehm.

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

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

* Added a new static internal class `MonoCertificatePal`:

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

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

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

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

* Cleaned up and removed some ancient dead code.

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

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

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

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

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

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

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

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

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

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

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

* [runtime] MONO_API mono_signature_get_params_internal needs GC Unsafe

* [runtime] MONO_API mono_domain_foreach needs GC Unsafe

* [runtime] MONO_API mono_class_is_subclass_of needs GC Unsafe

* [runtime] MONO_API mono_domain_create_appdomain needs GC Unsafe

* [runtime] MONO_API mono_signature_get_return_type needs GC Unsafe

* [mini] MONO_API mono_jit_exec needs GC Unsafe

* [mini] MONO_API mono_jit_cleanup needs GC Unsafe

* [runtime] MONO_API mono_class_get_type needs GC Unsafe

  Switch runtime to call m_class_get_byval_arg almost everywhere.

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

* [runtime] MONO_API mono_domain_from_appdomain needs GC Unsafe

* [runtime] MONO_API mono_domain_get_by_id needs GC Unsafe

* [runtime] MONO_API mono_domain_unload needs GC Unsafe

* [runtime] MONO_API mono_exception_from_name_msg needs GC Unsafe

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

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

* [runtime] MONO_API mono_debug_open_image_from_memory needs GC Unsafe

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

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

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

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

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

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

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

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

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

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

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

* [interp] Fix delegate invocation

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

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

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

…e on watchos.

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



<!--
Thank you for your Pull Request!

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

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

* Bump API snapshot submodule

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

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

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

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

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

Enable more tailcall AOT tests.

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

Split up F# test into individual tests.

Simplify test IL and make it stack overflow upon failure.

Cleanup test code before splitting.

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

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

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

Disable some FullAOT tests that are broken by gsharedvt.

Lower apparent memory use.

Move tests into directories and reset disabled lists.

Centralize tailcall debug helpers.

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

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

Print more in failure.

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

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

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

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

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

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

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

* Some refinement/correction/commenting to mono_string_to_utf8str_handle.

* Fix index out of bounds.

* Fix error handling.

* Remove some mono_error_set_pending_exception.

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

* tweaks

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

* cleanup

* Fix PtrToStructure GC assertion failure tests/marshal2 interpreter.

* Fix merge.

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

This reverts commit ca8456a05f75f0fc05f6559e2f075e18a455a362.

* Try harder to support fixed in array copying.

* Allow for overlap.

* Put mono_ in front of type and fix Windows.

* Fix small problems on Windows build.

* Fix Windows and support larger data.

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

* Bump corlib higher.

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

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

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

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

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

* [csproj] Update project files

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

* CoreFX import for AlgorithmIdentifier type

* Update CoreFX submodule

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

* Remove unused cominterop_get_hresult_for_exception.

* Guids are constant.

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

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

* PR feedback: g_assert(ex)

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

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

* Combine two versions of mono_cominterop_init.

* g_new0 instead of g_new+memset

* Remove obviously redundantly error_init.

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

* add const

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

* Initialize with declaration.

* Use integers for sizes, not pointers.

* More asserts though redundant.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


<!--
Thank you for your Pull Request!

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

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

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

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

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

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

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

* Added `RNGCryptoServiceProvider` based fallback implementation.

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

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

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

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



<!--
Thank you for your Pull Request!

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

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


<!--
Thank you for your Pull Request!

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

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

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

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

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

But this change addresses only ReadFile/WriteFile.

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

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

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

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

fixes regression from 67e995c6e2

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

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

* Add SERIALNUMBER for BTLS implementation.

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

Speeds up allocation by 30-40%

<!--
Thank you for your Pull Request!

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

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

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

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

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

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

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

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

* [runtime] Add a constant for darwin 18.

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

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

The following error is printed:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The logic is:

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

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

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

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

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

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

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

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

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

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

* Fix disabled COM.

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

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

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

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

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

* [wasm] Add missing dependency.

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

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

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

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

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

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

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

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

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

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

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

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

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

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Fix rebase issue

* Checkpoint

* Checkpoint

* Fix built sources only being added to one profile

* Fix typo

* Checkpoint

* Fix indentation

* Use csc instead of mcs

* Checkpoint

* Fix BUILT_SOURCES only being handled for the first profile processed

* Checkpoint

* Checkpoint

* Strip double slashes from paths to fix spurious csproj change

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint: Fix genproj compilation

* Checkpoint

* Checkpoint

* Checkpoint

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

* Checkpoint

* Checkpoint

* Checkpoint

* Fix TryParseTargetInto bug

* Checkpoint

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

* Remove gensources tracing

* Checkpoint

* Fix handling of oddball sources paths from executable.make

* Fix jay not being set to build

* Fix wrong slashes being used for embedded resource paths

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

* [runtime] MONO_API mono_assembly_name_get_name needs GC Unsafe

* [runtime] MONO_API mono_assembly_name_get_culture needs GC Unsafe

* [runtime] MONO_API mono_assembly_name_free needs GC Unsafe

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

* [runtime] MONO_API mono_class_vtable needs GC Unsafe

* [metadata] Add mono_class_is_assignable_from_checked that sets a MonoError

  Change mono_class_is_assignable_from to call the checked version.

* [runtime] MONO_API mono_class_is_assignable_from needs GC Unsafe

* [runtime] MONO_API mono_class_get_property_from_name needs GC Unsafe

* [runtime] MONO_API mono_config_for_assembly needs GC Unsafe

* [runtime] MONO_API mono_type_is_byref needs GC Unsafe

* [runtime] MONO_API mono_class_from_mono_type needs GC Unsafe

* [metadata] Mark mono_class_get_field_from_name external only

  Runtime should use mono_class_get_field_from_name_full

* [runtime] MONO_API mono_class_get_field_from_name needs GC Unsafe

* [metadata] Mark mono_class_get_method_from_name_flags external only

  Runtime should use mono_class_get_method_from_name_checked

* [metadata] Mark mono_class_get_method_from_name as external only

  Runtime should use mono_class_get_method_from_name_checked

* [runtime] MONO_API mono_class_get_method_from_name needs GC Unsafe

* [runtime] MONO_API mono_class_get_methods_from_name_checked needs GC Unsafe

* [sgen] MONO_API mono_gc_collect needs GC Unsafe

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

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

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

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

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

* [csproj] Update project files

* Add CoreFX unit tests.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fixes #9031.

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

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

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

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

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

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

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

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

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

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

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

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

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

* [runtime] Added regression stress test for #9176

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

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

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

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

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

Examples to run all JIT regression tests:

run-jit-regression.bat all

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

run-jit.bat [full path to assembly]

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

run-jit.bat basic.exe

Examples to build all regression tests using full AOT:

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

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

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

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

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

Examples to run all regression tests using full AOT:

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

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

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

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

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

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

* Fixed some review feedback.

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

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

* [mini] Remove duplicate patch type.

* expand a FIXME to include what needs fixing.

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

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

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

* Bye bye, annoying AIX setschedparam warning

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

* Remove more assumptions of /proc on AIX

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

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

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

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

Fixes #9232

* Enable failing on missing files in gensources

* Copy over the missing file checks from genproj2

* Trim whitespace off file names from sources files

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

* [runtime] MONO_API mono_array_length needs GC Unsafe

* [runtime] Make MONO_API mono_reflection_load_from_full external only

  Also mono_reflection_load_from ()

  Also make them both transition to GC Unsafe

* [runtime] Make MONO_API mono_assembly_load_full external only

  And make it transition to GC Unsafe

* [runtime] Make MONO_API mono_assembly_loaded external only

  Runtime should use mono_assembly_loaded_full.

  Make mono_assembly_load transition to GC Unsafe

* [runtime] MONO_API mono_assembly_open needs GC Unsafe

  Also mono_assembly_open_full

* [runtime] MONO_API mono_check_corlib_version needs GC Unsafe

* [runtime] MONO_API mono_class_enum_basetype needs GC Unsafe

* [runtime] MONO_API mono_value_box needs GC Unsafe

* [runtime] Make mono_type_get_object external only

  Runtime should use mono_type_get_object_checked or mono_type_get_object_handle

* [runtime] MONO_API mono_string_to_utf8 needs GC Unsafe

* [runtime] MONO_API mono_raise_exception needs GC Unsafe

* [runtime] Make mono_reflection_type_get_type external only

  Also make it use GC Unsafe.

  Runtime should use mono_reflection_type_get_handle

* [runtime] MONO_API mono_object_new needs GC Unsafe

* [runtime] MONO_API mono_domain_assembly_open needs GC Unsafe

* [runtime] MONO_API mono_method_get_object needs GC Unsafe

* [runtime] MONO_API mono_method_full_name needs GC Unsafe

* [runtime] MONO_API mono_method_signature needs GC Unsafe

* [runtime] MONO_API mono_thread_create needs GC Unsafe

* [runtime] MONO_API mono_field_get_type needs GC Unsafe

* [runtime] MONO_API mono_field_get_value needs GC Unsafe

* [runtime] MONO_API mono_field_set_value needs GC Unsafe

* [runtime] Mark mono_image_open_from_data_with_name external only

  Runtime should use mono_image_open_from_data_internal

* [runtime] MONO_API mono_image_open_from_data_with_name needs GC Unsafe

* [runtime] MONO_API mono_field_static_set_value needs GC Unsafe

* [runtime] MONO_API mono_property_set_value needs GC Unsafe

* [runtime] Make MONO_API mono_assembly_load_with_partial_name external only

  Runtime should use mono_assembly_load_with_partial_name_internal.

  Make mono_assembly_load_with_partial_name transition to GC Unsafe

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

* [test] Fixup return type of mono_gc_toggleref_add

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

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

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

Build mono LLVM branch using the following cmake configuration:

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

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

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

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

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

* [bcl] Add Nullable tests from corefx.

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

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

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

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

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

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

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

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

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

 * Fix MONO_HANDLE_IS_NULL (NULL_HANDLE) to not null dereference.

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

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

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

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

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

* Remove mono_handle_new_full prototype, the function does not exist.

* Remove unnecessary casts.

* Remove unused MONO_HANDLE_INIT.

* Add an assert to handle_assign.

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

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

ldstr_section can be taken during jit compilation.

* [runtime] Switch to non recursive mutex

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

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

* Change 'as' operator to a cast.

* Add missing EnvelopedCms overloads.

* Include CMS signing classes in all builds.

* [csproj] Update project files

* Add missing DSACertificateExtensions class.

* Update references.

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

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

* Update references.

* Bump API snapshot submodule

* Disable xunit tests that may depend on Windows PAL.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* [bcl] Bump corlib version

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

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

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

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


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

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

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

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

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

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

* [mini] Change printf to g_print

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

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

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

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

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

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

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

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

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

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

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

* [jit] Add span intrinsics.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* [jit] Add tests for fullaot+interp mode

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

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

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

This reverts commit 0f78c230b5102d625c300a4e1c6eaf97ad055dd5.

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

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

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

* [Coop] Convert ves_icall_System_ComObject_GetInterfaceInternal.

* [Coop] Convert ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal.

* [Coop] Partial convert ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

dotnet/corefx#30012 is blocking on this.
2018-06-01 11:18:14 +02:00
Rodrigo Kumpera 081c4b4c14 [sdb] Extract try_process_suspend. 2018-06-01 01:25:05 -04:00
Rodrigo Kumpera fc24b16072 [sdb] Remove duplicate code in process_breakpoint. 2018-06-01 01:25:05 -04:00
Rodrigo Kumpera 1626ad0026 [sdb] [wasm] Extract DbgEngineStackFrame struct that has the fields used by bp/ss. 2018-06-01 01:25:05 -04:00
Jay Krell ca4c26380f Fix race condition in ves_icall_Mono_Interop_ComInteropProxy_AddProxy. 2018-05-31 16:53:37 -07:00
Jay Krell f3157ed8ed Cleanup varargs. (#8589)
Change 3 ifdef versions to one portable one.
Remove supporting autoconf that did not work as intended.
See https://github.com/mono/mono/issues/8587.
2018-05-31 15:59:15 -07:00
monojenkins ab4d81e794 [csproj] Update project files 2018-05-31 23:34:33 +02:00
monojenkins d361c88e67 Bump API snapshot submodule 2018-05-31 23:34:33 +02:00
Marek Safar 7787785af3 [corlib] Removes multiplex approach 2018-05-31 23:34:33 +02:00
Miguel de Icaza c05effd7f4 Bring ikdasm changes to support private protected decompilation 2018-05-31 13:47:34 -04:00
Martin Baulig da2de44fe8 [corlib]: Add System.HashCode - revisiting #8822 and #8879. (#8934)
Enable `System.HashCode` again, cleanup the `.sources` files and fix the Windows build.
2018-05-31 16:46:00 +02:00
Martin Baulig e5cd5a992e [build]: Make 'gensources' look for platform-specific .sources files as well. 2018-05-31 15:59:36 +02:00
Nick Craver 23fd728c9a Issue template: update help link to https://
Since GitHub pages rolled out HTTPS support, links to `www.mono-project.com` can now be `https://` :) This also removes a `www.` 301 users currently hits.
2018-05-31 14:24:28 +02:00
Zoltan Varga c972668876 [runtime] Fix the --enable-minimal=aot build. (#8952)
Fixes https://github.com/mono/mono/issues/8430.
2018-05-30 19:52:50 -04:00
monojenkins 3a630bff26 Bump API snapshot submodule 2018-05-31 00:01:58 +02:00
EgorBo 8afcf1b455 remove implicit operator String (ReadOnlySpan<char> value) 2018-05-31 00:01:58 +02:00
Alexis Christoforides 42b9868dda Merge pull request #8719 from mono/fix-gh-8712
[System.IO] Finish initializing all FileSystemWatchers, not just the f…
2018-05-30 15:31:49 -04:00
Marek Safar 7912154616 [acceptance-tests] Bump roslyn tests to match bundled version 2018-05-30 17:41:21 +02:00
Alexis Christoforides bc4a1b31c5 [System.IO] Dispatch events asynchronously in FileSystemWatcher.DispatchEvents()
This used to happen in RaiseEvents(), but some CoreFX FSW tests require that a derived FSW be able to fire its event synchronously.
2018-05-30 09:54:02 -04:00
Alexis Christoforides 2fe6c6bfba [System.IO] Prevent the CoreFX bridge from even try-entering a monitor.
In the case of the FSEvent FileSystemWatcher, the CFRunLoop event loop thread has already an interrupt handler installed in the icall, and mono_monitor_try_enter  may try to install one as well which is not supported. So we create separate event tasks before we use the Operation() method.
2018-05-30 09:42:57 -04:00
Bernhard Urban 2731ac99f8 [native crash] limit output of process mapping (#8910)
[native crash] limit output of process mapping

less noise
2018-05-30 09:40:09 -04:00
Bernhard Urban a7f8569be7 [native crash] dump memory around instruction pointer (#8911)
[native crash] dump memory around instruction pointer

It can help to identify issues in generated code. We don't want to ship a disassembler, so we just do a hexdump. It looks like this:

```
Memory around native instruction pointer (0x10ca1b50e):
0x10ca1b4fe  48 c7 04 24 00 00 00 00 48 8b 44 24 10 48 8b f8  H..$....H.D$.H..
0x10ca1b50e  83 38 00 48 8d 64 24 00 49 bb 3a b5 a1 0c 01 00  .8.H.d$.I.:.....
0x10ca1b51e  00 00 41 ff d3 48 89 04 24 e9 00 00 00 00 48 8b  ..A..H..$.....H.
0x10ca1b52e  04 24 e9 00 00 00 00 48 83 c4 18 c3 e8 c1 1c 53  .$.....H.......S
```

Offline tools can be used to disassemble the code.
2018-05-30 09:25:08 -04:00
Alexander Köplinger 3a8218e5d5 [bcl] Fix ONO_PATH warning during resgen (#8933)
We'd get the following warning during the build:

```
'/Users/alexander/dev/mono/mcs/class/System.Data.Services.Client/ONO_PATH' in MONO_PATH doesn't exist or has wrong permissions.
```

The reason is that we didn't escape the $ symbol in the resgen template
so the embedded $$MONO_PATH in the RESGEN variable ended up being mangled.

I'm kinda surprised this worked at all for so many years ¯\_(ツ)_/¯
2018-05-29 20:01:07 -04:00
Marek Safar f37db9cf90 [System.Web] Fix bug with not preserving state of CheckBoxList after postback because of value beeing rendered (#8928) 2018-05-30 00:31:51 +02:00
Marek Safar 6a7bd7be27 [Facades] Adds few netcore extensions (#8907)
* [Facades] Adds few netcore extensions

Fixes #7947

* Bump API snapshot submodule

* [csproj] Update project files
2018-05-30 00:22:36 +02:00
Ankit Jain 4adf7104ea Bump binary-reference-assemblies (#8929)
Includes the fix for https://bugzilla.xamarin.com/show_bug.cgi?id=23668
via https://github.com/mono/reference-assemblies/pull/7
2018-05-30 00:10:37 +02:00
Ankit Jain dd6fe29769 [roslyn][msbuild] Copy the new Microsoft.Managed.Core.targets file in roslyn. (#8931)
Fixes https://github.com/mono/mono/issues/8897 .
2018-05-30 00:09:31 +02:00
Rodrigo Kumpera 49bf0734af [debugger-engine] Extract breakpoint code from sdb into debugger-engine. 2018-05-29 16:40:21 -04:00
Alexis Christoforides 183d994a91 [System.IO] Finish initializing all FileSystemWatchers, not just the first one
Fixes https://github.com/mono/mono/issues/8712
2018-05-29 16:25:21 -04:00
Rodrigo Kumpera 010eb31409 [sdb] Move domain handling to debugger-engine. 2018-05-29 16:16:05 -04:00
Rodrigo Kumpera 42e03148ac [sdb] Move all iteration over domain to use foreach. Will make it easy to move domain management to DE later. 2018-05-29 16:07:41 -04:00
Marek Safar 362fc27e2b [build] Includes tools used by XI/XA build CI in build profile (#8924) 2018-05-29 13:36:07 -04:00
Marek Safar 8a26830b47 Update issues template (#8920) 2018-05-29 13:35:02 -04:00
Aleksey Kliger (λgeek) 6bd212f142 [loader] Ignore version if asssembly name isn't a strong name (#8821)
* [loader] Make mono_assembly_names_equal_flags visible

Previously was static assembly_names_equal_flags in assembly.c

Add "mono" prefix to all the names

* [loader] Ignore version if assembly name isn't a strong name

When checking if a loaded assembly satisfies a request for a given assembly
name, don't compare versions if requested name doesn't include a public key
token.

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

* [loader] Add MONO_ANAME_EQ_IGNORE_CASE flag

In some circumstances we may need to compare one MonoAssemblyName to another
ignore case differences in simple names (ie "Asm1" vs "asm1" should be
considered equal)

* [tests] Regression test for simple name assembly preloading

Regression test for https://github.com/mono/mono/issues/8820

If one assembly references another that has a simple name (no public key), then
the requested version and the actual version don't need to match.

Also - the simple names are compared case-insensitively.

* [loader] When looking for already loaded assemblies, ignore case differences

When we're looking for a loaded assembly by simple name, ignore case differences.
2018-05-29 13:26:04 -04:00
Vlad Brezae afa15fe0a0 [interp] Fix monitor-abort.exe (#8880) 2018-05-29 13:21:08 -04:00
Rodrigo Kumpera 93748c6453 [sdb] Extract event_requests_cleanup from breakpoints_cleanup. 2018-05-29 13:15:27 -04:00
Marek Safar cc131fedcc [sdks] Fixes llvm branch name (#8926) 2018-05-29 13:08:20 -04:00
Rodrigo Kumpera 6963fc5cd5 [debugger-engine] Transplant logging macros to ease landing sdb code. 2018-05-29 13:07:28 -04:00
Rodrigo Kumpera 26bb29b842 [sdb] Extract collect_breakpoints_by_sp and cleanup ifdef in remove_breakpoint. 2018-05-29 12:57:26 -04:00
Jay Krell 3c7a203fc0 Fix failure to set out parameter. (#8902)
* Fix failure to set out parameter.
2018-05-29 05:10:41 -07:00
Marek Safar 4f50921689 [runtime] Remove incorrect checks which are also duplicates of MakeTypedReference checks.
Fixes #8915
2018-05-29 13:22:58 +02:00
EgorBo fbb7c4d877 make SocketAsyncEventArgs reusable 2018-05-29 08:18:47 +02:00
Zoltan Varga 7c38aca9ab [sdks] Include the embedded.mobileprovision file in the generate apps on ios. (#8906) 2018-05-28 08:54:14 -04:00
Alexis Christoforides a1bb39504f Bump corefx 2018-05-27 11:13:36 +02:00
Marek Safar e6192eaa59 Bump corefx 2018-05-26 19:27:14 +02:00
Bernhard Urban 92d9a3ca16 [Mono.Debugger.Soft.Test] Use interp on debugee (#8851)
* [debugger tests] use runtime flags for debugee

* [debugger] handle managed-to-native frames

fixes DebuggerTests.InspectThreadSuspenedOnWaitOne on the interpreter

* [interp] set SP in monoctx that is passed to exception handling

fixes DebuggerTests.ExceptionFilter on the interpreter

* [debugger] fix debugger_invoke frame in interp case

fixes DebuggerTests.BreakpointDuringInvoke on the interpreter
2018-05-25 17:57:51 -04:00
Jay Krell fae3b3506a Fix bunch of new gcc/linux warnings I recently introduced by accident. (#8810)
Due to commits 1507b9b531 and 298aa78a47.

Note the warnings to not indicate a bug and fixing the warnings does not change behavior.
2018-05-25 14:51:24 -07:00
Ludovic Henry 583a9960f0 [icall] Add a NOHANDLES wrapper (#8862) 2018-05-25 17:43:06 -04:00
Alexander Kyte 2e6adee718 [runtime] Fix capitalization on merp config file field name (#8868) 2018-05-25 14:39:54 -04:00
Mikayla Hutchinson acb62ba21a Add wasm gitignore (#8890) 2018-05-25 14:39:18 -04:00
Vlad Brezae ba0c0591f3 [threadpool] Clear data field of MonoListItem after we are done with it (#8863)
Currently the list elements are allocated in the root domain, while the data can be allocated in other domains. We need to clear the reference when removing the list element so we are not left with hidden cross domain refs.

Ideally we should have per domain lists, so we also would just let the list and elements die, without having to iterate through them at domain unload time.
2018-05-25 14:31:17 -04:00
Rodrigo Kumpera 446fff38fc [debugging] Move start/stop single stepping to debugget-engine.c 2018-05-25 14:12:36 -04:00
Alexander Köplinger 84d0f324c3 Bump boringssl submodule 2018-05-25 19:36:01 +02:00
Alexander Köplinger e59628c27c Bump api-snapshot for HashCode revert 2018-05-25 18:53:14 +02:00
Rodrigo Kumpera d82d67c707 [sdb] Extract try_process_suspend. 2018-05-25 12:48:55 -04:00
Rodrigo Kumpera be4c5f7ebf [sdb] Remove duplicate code in process_breakpoint. 2018-05-25 12:48:55 -04:00
Rodrigo Kumpera 542b072a4f [sdb] [wasm] Extract DbgEngineStackFrame struct that has the fields used by bp/ss. 2018-05-25 12:48:55 -04:00
Marek Safar df0267f2c6 Bump Roslyn to 2.8.2 2018-05-25 18:14:36 +02:00
Rodrigo Kumpera 32424b1668 Sanitize TLS handling in the profiler. (#8824)
* [mono-threads] Introduce mono_thread_info_get/set_tools_data so they can store data sanely.

The tools_data is a helper to bind tls data lifecycle to MonoThreadInfo.
This is needed to make it sane to deal with posix TLS destructors.

* [profiler] Switch tls storage to use mono_thread_info_get/set_tools_data. Fixes #7683

External threads are detached using TLS destructors and this leads to non-determinism around to cleanup ordering of keys.
This causes the profiler to see the profiler tls key null'd even though it was not detached yet.

* [profiler] Since we depend on thread_info to be attached before tls works, do so for the helper threads.

We can't just move the mono_thread_attach call earlier as it leads to all sorts of weird crashes (as it generates events and we won't be attached).
2018-05-25 17:23:37 +02:00
Alexander Köplinger 5ee38e0694 Revert "[corefx] Import System.Hashcode (#8822)" (#8879)
It broke the Windows build.
2018-05-25 17:16:47 +02:00
Rodrigo Kumpera d8b0e7a74e [wasm] [sdb] Initial PR towards making some of sdb's code shareable. (#8750)
This PR adds the new files, moves the enums / structs and a small bit of code to validate the change.
2018-05-25 17:10:58 +02:00
Marek Safar f09bac7e1c [corlib] Optimizes Stream:CopyTo 2018-05-25 16:21:55 +02:00
Zoltan Varga 6fca21119e [jit] Fix the EqualityComparer.get_Default () optimization, a different comparer type is used on mobile platforms. (#8874) 2018-05-25 05:50:39 -04:00
monojenkins 61d1fe5a73 Bump API snapshot submodule 2018-05-25 11:01:42 +02:00
Martin Baulig 5715aee671 [System]: Epic: Client Certificate Support - Part Two.
This is the second and final part to bring Client Certificate support.
It needs to be landed on top of #8753 and #8756.

* `Mono.Security.Interface.IMonoSslStream`: Add `CanRenegotiate` and `RenegotiateAsync()`.

* `Mono.Security.Interface.MonoTlsSettings`: Add `DisallowUnauthenticatedCertificateRequest`.

* `AppleTlsContext`: fully support renegotiation.
  - we may now receive `SslStatus.PeerAuthCompleted` and `SslStatus.PeerClientCertRequested`
    during `Read()`.  It should in theory not happen during `Write()`, but I added it there
    as well just to be on the safe side.
  - `SetSessionOption()` may only be called before the initial handshake.

* `MobileAuthenticatedStream`: this is the major part of the work and the most complex one.
  - added a new `Operation` enum to keep track of what is going on and detect invalid state.
  - a renegotion may only be triggered while we're idle - that is no handshake, read or write
    operation is currently active.
  - `InternalWrite()` may now be called from `SSLRead()`, the new `Operation` tells us what
    is currently happening.
  - `ProcessHandshake()` now takes a `bool renegotiate` argument.
  - added sanity checks to `ProcessRead()` and `ProcessWrite()`.

* `MobileTlsContext.SelectClientCertificate()`: check for
  `MonoTlsSettings.DisallowUnauthenticatedCertificateRequest`

* `MonoTlsProviderFactory.InternalVersion`: bump the internal version number.

Tests have already been added to `web-tests/master`, they will auto-enable themselves when
using a Mono runtime that contains this code.
2018-05-25 11:01:42 +02:00
Alexis Christoforides 5076f806dc [corefx] Import System.Hashcode (#8822)
* [System.Native] Add pal_random

* Bring HashCode.cs.

* Use platform-specific .sources files.

* Bump API snapshot submodule
2018-05-25 10:57:24 +02:00
monojenkins 41ba0b6d2e [csproj] Update project files 2018-05-25 10:27:21 +02:00
Marek Safar a64209caf0 Bump linker to resolve XA issues 2018-05-25 10:27:21 +02:00
Joshua Peterson aaa49b7ff4 Remove two methods with incorrect arguments (#8860)
* Remove two methods with incorrect arguments

These two methods on `IPersonalizable` don't match the .NET 4.7.1 API.
In both cases the methods should take one `PersonalizableDictionary`
argument, but _that_ type does not exist.

Since nothing in the current class library code is using these methods,
just remove them.

* Bump API snapshot submodule
2018-05-24 21:59:39 +02:00
Martin Baulig 0c2e5133d3 [System]: Epic: Client Certificate Support - Part One. (#8756)
This is the first of two Pull Requests to implement Client Certificates :-)

Part One binds the new native APIs that will be used internally, finishes
the certificate selection callbacks, but without the more riskly changes
to the underlying handshake and I/O layer.

Part Two will bring support for TLS Renegotiation - and due to the required
changes in the underlying handshake, it is the more risky one.

* `Mono.Security.Interface.MonoTlsSettings`: Add `ClientCertificateIssuers`.

* `MobileTlsContext`:
  - fully implement `SelectClientCertificate()`; the `acceptableIssuers` parameter
    is now actually set and we also have a reasonable default selection.
  - add `CanRenegotiate` and `RenegotiateAsync()` - these are not hooked up yet.

* `AppleTlsContext`:
  - we will only ever call `RequirePeerTrust()` once per session, so we can
    also remove it alltogether and just use `EvaluatePeerTrust()` instead.
  - use proper exceptions for `SslStatus.PeerNoRenegotiation` and `PeerUnexpectedMsg`.
  - don't call `SetClientSideAuthenticate()` on the client side.
  - bind and hook up `SSLAddDistinguishedName()` and `SSLCopyDistinguishedNames()`.
  - bind `SSLReHandshake()`.

* `MobileAuthenticatedStream`: minor cleanups; there will be more uses of the new
  `GetInvalidNestedCallException()` helper class once Part Two lands.

* Enable some more constants in `SecureTransport.cs`.

* Add new `MonoBtlsError.GetErrorReason()` and `mono_btls_error_get_reason()`
  implementation, only supporting `SSL_R_NO_RENEGOTIATION` at the moment.

* Add new native `mono_btls_ssl_ctx_set_client_ca_list()` function and managed
  `MonoBtlsSslCtx.SetClientCertificateIssuers()`; hooked up via
  `MonoTlsSettings.ClientCertificateIssuers`.

* According to a comment in the header file, `SSL_get_client_CA_list()` may only
  be called during the selection callback or while the handshake is paused.
  To respect this restriction, we now call it during the client certificate
  selection callback and pass the list from native to managed.
  - changed signature of `MonoBtlsSelectFunc` from
    `int (* MonoBtlsSelectFunc) (void *instance)` to
    `int (* MonoBtlsSelectFunc) (void *instance, int countIssuers, const int *sizes, void **issuerData)`.
  - the managed counter-part is in `MonoBtlsSslCtx.NativeSelectFunc` / `NativeSelectCallback`.

* MonoBtlsContext:
  - use the new `MonoBtlsError.GetErrorReason()` to throw a `TlsException` with
    `AlertDescription.NoRenegotiation` that can be checked for by user code.
  - `SelectCallback()` now has a `string[] acceptableIssuers` argument; pass it
    to `SelectClientCertificate()`.
  - the native backend does not support TLS Renegotiation, so `CanRenegotiate`
    always returns false.

Implements #7075
2018-05-24 21:12:49 +02:00
Alexander Kyte d6af9f7bf7 [runtime] Change merp to emit files for MERP upload mode (#8694)
An example of the emitted files can be found here
https://gist.github.com/alexanderkyte/47307c95f77ef6e6a2d5efc73cb76dec
2018-05-24 14:27:36 -04:00
Zoltan Varga 9bef90a845 [jit] Disable the EqualityComparer.get_Default () optimization for now, it seems to cause failures in the corlib tests on the ios simulator. (#8856) 2018-05-24 14:24:24 -04:00
Jay Krell e4d72f88f3 Prune unused incorrect looking zip code. (#8752)
Not sure what is happening here. Is the type incorrect throughout, or being passed to wrong function?
2018-05-24 13:56:05 -04:00
Alexander Kyte c8efdaff17 [runtime] Gracefully handle crashes before mono-state dependencies initialized (#8840) 2018-05-24 12:38:58 -04:00
David Benjamin 27c4f785e2 [btls] rewrite mono_btls_ssl_ctx_set_ciphers (#8849)
Rather than reaching into the library internals and potentially
violating its invariants, assemble a cipher string and call the
supported public API. (There's no need to touch the version-specific
cipher lists because mono/btls never configures them.) The existing code
also had a bug; it incorrectly assumed OPENSSL_malloc returned a
zero-initialized buffer for in_group_flags. (Though Mono doesn't set
SSL_OP_CIPHER_SERVER_PREFERENCE, so I suspect this was a no-op.)

Additionally, this should hopefully ease updating to a less outdated
version of BoringSSL in the future.

Note I've changed the return value of this function from returning the
number of ciphers to merely returning 0/1 for whether the operation
succeeded. The only caller of this function, MonoBtlsSslCtx.SetCiphers,
only cares about success vs. failure.
2018-05-24 12:33:19 -04:00
monojenkins 435ea75843 [csproj] Update project files 2018-05-24 15:00:15 +02:00
monojenkins 0c27e0a02e Bump API snapshot submodule 2018-05-24 15:00:15 +02:00
Marek Safar e1e94cb6b1 [corlib] Finish System.Memory facade types import
Fixes #8623
2018-05-24 15:00:15 +02:00
Zoltan Varga c06c9b78c1 [interp] fullAOT mixed mode (#8838)
* [jit] Move the handling of special methods like pinvoke etc. into mini-runtime.c, since they are not handled by the JIT.

* [jit] Add a --full-aot-interp command line argument which is the same as --full-aot with a fallback to the interpreter.

* [jit] Implement fallback to the interpreter in full-aot+interp mode.

* [jit] Add a 'methods using the interpreter' stat.
2018-05-24 11:49:19 +02:00
monojenkins 319b410764 Bump API snapshot submodule 2018-05-24 10:00:52 +02:00
Marek Safar ac0cdca9ae Bump cecil 2018-05-24 10:00:52 +02:00
Marek Safar 2824c84427 [corlib] Update TaskFactory tests to accommodate running on different sync context
Fixes #8721
2018-05-24 09:23:26 +02:00
Marek Safar 178a49de7b [mcs] Adds parser support for C# 7.2 readonly references 2018-05-24 09:09:38 +02:00
Zoltan Varga b10647c0cf [jit] Fix box+brtue optimization broken by 298aa78a47. (#8846) 2018-05-23 23:37:34 -04:00
Zoltan Varga f3bf7e880f [jit] Add a 'verbose-gdb' option to turn on very verbose gdb crash dumps. (#8844) 2018-05-23 23:09:38 -04:00
Bernhard Urban c5eafe18c4 [ppc64] implement move_f_to_i8 / move_i8_to_f 2018-05-24 00:48:23 +02:00
Bernhard Urban f37d7a9fce [ppc] use different thunk machinery that works on ppc64
The old thunk machinery was sort of working on 64bit (before
f4bd084438 ), but it relies on having on
the memory layout of allocated chunks for code. Either the property got
lost due to some refactoring, or it was never true on ppc64. Anyway,
this patch switches the implementation to something we do on arm32 too:
If we potentially need some thunks for the emitted code, we reserve some
space for it at the end of the code buffer. That wastes a bit more
memory, because we often don't need it, but at least it works reliable.

Untested on 32bit systems.
2018-05-24 00:48:23 +02:00
Bernhard Urban 74735b55c9 [ppc] narrow immediate value for relative branches
since we don't know the exact distance yet, we have to guess. sometimes
this guess was not defensive enough.
2018-05-24 00:48:23 +02:00
Bernhard Urban 2789bdb592 [ppc] use gcc builtin for icache flushing 2018-05-24 00:48:23 +02:00
Zoltan Varga 9511ca1604 [llvm] Disable the 'x86-call-frame-opt' pass on x86, it generates code which breaks unwinding. (#8831) 2018-05-23 14:27:21 -04:00
Zoltan Varga c889056dea [llvm] Set the visibility of the llvm globals referring to the jit module to hidden, otherwise they can resolve to symbols outside the aot image. (#8833) 2018-05-23 14:26:32 -04:00
Marek Safar 0f8862bee4 [corlib] Disables test which depends on LogicalCallContext for mobile
Fixes #8787
2018-05-23 16:12:22 +02:00
Alexis Christoforides 52f79b48de Merge pull request #7412 from mono/update-macsdk-nuget
[MacSDK] Update Nuget to 4.7.0
2018-05-23 09:51:16 -04:00
Alexis Christoforides c1c7daa697 [MacSDK] Update Nuget to 4.7.0
This update includes (should include) https://github.com/NuGet/NuGet.Client/commit/eca1a8d23a54818c116eef63875de6a554227ea7 which we need in Mono.
2018-05-23 09:50:13 -04:00
Marek Safar 054e087471 [mcs] Don't report internal error when Span type is not available 2018-05-23 13:46:45 +02:00
Aleksey Kliger 0ed55711ad fix uninited var 2018-05-23 12:15:13 +02:00
Aleksey Kliger 9ad5255338 [loader] LoadFrom of problematic images should reprobe
The "problematic images" are Windows-specific assemblies that are often
included with applications that do not work on Mono, but for which Mono has its
own implementation.

Previously (9ec8ec5389) we changed mono to deny
loading problematic images using Assembly.Load or when one assembly references
another and we find a problematic image using the usual assembly search.

For Assembly.LoadFrom, we used to emit a warning and then load the assembly anyway.

In this commit, we change the behavior: If Assembly.LoadFrom tries to open a
problematic image, we will instead probe for an assembly of that name in the
default context.  That should eventually end up opening Mono's version of that
assembly.

Example:
  Suppose a problematic System.Runtime.InteropServices.RuntimeInformation.dll
  is in the application bin path: /home/user/myapp/bin

  1. User code does (for whatever reason)
  Assembly.LoadFrom ("/home/user/myapp/bin/System.Runtime.InteropServices.RuntimeInformation.dll")

  2. We find the image and try to open it; add it to the images absfpath to
  image hash; note that there are no binding redirects; but that it is a
  problematic image.  We extract the assembly
  name ("System.Runtime.InteropServices.RuntimeInformation", version x.y.z.w
  and public key token 123456789a) from the problematic image.

  3. We probe for "System.Runtime.InteropServices.RuntimeInformation version
  x.y.z.w public key token 123456789a" in the default context.

  4. We find
  /home/user/myapp/bin/System.Runtime.InteropServices.RuntimeInformation.dll in
  the application bin path; we try to open it, we see it's already in the
  images hash, but it's a problematic image,  and we're not in a loadfrom
  context (we re-probed with default!) so we keep probing

  5. We find
  <prefix>/lib/mono/4.5/Facaded/System.Runtime.InteropServices.RuntimeInformation.dll,
  it's not a problematic image, so we open that and return it to (3)

  6. We return to (2) and close the problematic image and return the good one
  instead.

  7. Assembly.LoadFrom returns with the good image.

Fixes https://github.com/mono/mono/issues/8726
2018-05-23 12:15:13 +02:00
Alexander Köplinger 3ac579420b Bump api-snapshot 2018-05-23 11:20:13 +02:00
Bernhard Urban 8df4a70439 [ppc] disable some tailcall tests (#8825)
they fail similar:

```
===============
tailcall/coreclr/JIT/Methodical/nonvirtualcall/tailcall.exe.stdout
===============
* Assertion at method-to-ir.c:2259, condition `tailcall || !mini_get_debug_options ()->test_tailcall_require' not met, function:test_tailcall, tailcalllog fail from CallFromInsideGrandChild
```
2018-05-23 11:16:58 +02:00
Vlad Brezae 4adac40657 [monitor] Fix abort of synchronisation wrapper
When we switched to the new version of Monitor.Enter, we didn't expand the try block to include the call. This led to unreleased locks when we acquired the lock but were aborted shortly afterwards.
2018-05-23 08:59:54 +02:00
Vlad Brezae 8ad36032d5 [tests] Fix pinvoke test (#8774)
Pinvoke signatures need to match the native ones from libtest.c

Fixes https://github.com/mono/mono/issues/7058
2018-05-22 17:17:50 -04:00
Martin Baulig 89441b5acc [System]: Pull some 'System.Net.Mail' APIs from CoreFX. (#8794)
This brings the internal `MailAddressParser` class and switches `MailAddress` and `MailAddressCollection` to the CoreFX version.

The tests have been updated to reflect the CoreFX behavior, which is more strict about rejecting invalid addresses.
2018-05-22 23:04:14 +02:00
Alexander Kyte 6a8795f9d7 [debugger] Add locking around tls->frames usage/freeing (#6456)
* [debugger] Add locking around tls->frames usage/freeing

* [debugger] more locking and avoid race around mono_threads_join_lock & loader lock
2018-05-22 21:43:30 +02:00
sancheolz 6c6c52958f [System.Windows.Forms] Fix PropertyGrid (#8813)
When PropertyGrid contains more than one propertyTab it crashes whith NullReferenceException. And when clicking on propertyTab toolstripbutton it didn't switch to this tab.
2018-05-22 20:47:21 +02:00
Rodrigo Kumpera 8de852ea9e [wasm] Improve binding code with support for booleans and binding of static C# methods. (#8714) 2018-05-22 14:04:48 -04:00
Zoltan Varga 34795a59cd [jit] Implement devirtualization of some EqualityComparer<T>.Equals calls, the corefx code assumes this. (#8690)
* [jit] Unify the way the results of inlined calls are pushed on the stack.

* [jit] Allow class inits during inlining if the class has no cctor.

* [bcl] Mark EqualityComparer<T>.get_Default () with MethodImplOptions.AggressiveInlining, its used in inner loops in the corefx code.

* [jit] Implement devirtualization of some EqualityComparer<T>.Equals calls, the corefx code assumes this.

* [jit] Rename has_array_access to needs_decompose to better reflect its meaning.
2018-05-22 13:32:54 -04:00
Marek Safar a925220d9d [wasm] Unify csc settings with the rest of Mono tree 2018-05-22 18:49:14 +02:00
Josh Peterson 227f15a3ad Add missing sre features to the mscorlib link.xml
To make sure that System.Reflection.Emit types in the class libraries
are properly removed by the linker, mark them with the "sre" feature in
the embedded linker descriptor file for mscorlib.
2018-05-22 16:14:28 +02:00
Alexander Köplinger 7f347cfc10 [packaging] Ignore Mac path in MSBuild .targets file during check
It contains this fragment:

```
<TargetFrameworkFallbackSearchPaths Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworkFallbackSearchPaths);/Library/Frameworks/Mono.framework/External/xbuild-frameworks</TargetFrameworkFallbackSearchPaths>
```
2018-05-22 16:09:12 +02:00
Alexander Köplinger 9cc1ddee72 Bump api-snapshot 2018-05-22 15:53:27 +02:00
Martin Baulig e74758bc10 [corlib]: Bring 'System.Buffers.Text.Utf8Parser' and 'Utf8Formatter' from CoreFX. (#8680)
Part of #8623
2018-05-22 13:12:24 +02:00
Martin Baulig 544fb5d84f Bump CoreFX and reflect latest StringBuilderCache changes. (#8800)
* Bump CoreFX and reflect latest StringBuilderCache changes.

* [csproj] Update project files
2018-05-22 12:39:21 +02:00
Marek Safar 6d4a96667a [Facades] Enables more forwarders in System.Memory (#8790) 2018-05-22 12:33:50 +02:00
Niklas Therning fa17b541f9 Added corlib .sources files for the ORBIS profile (#8783) 2018-05-22 12:32:49 +02:00
Katelyn Gadd f5d42d2d55 [bcl] Start replacing gensources.sh with gensources.cs (#8619)
This PR introduces a new tool, gensources.cs, which replaces gensources.sh. It is able to parse the whole set of .sources files for a library in one go so that genproj can use that information to encode all our platform and profile specific files into one csproj file.

For now this PR just introduces it and switches libraries to using it instead of gensources.sh.
2018-05-22 12:22:53 +02:00
Zoltan Varga f04da0f7c7 [jit] Disable an invalid IL test when running with bitcode. (#8809) 2018-05-22 05:56:47 -04:00
Jay Krell ad24751ad5 Fix assert to print and not crash, build the eglib tests and fix their warnings. (#8727)
* Fix assert to print the error, and not sometimes itself crash. It was evaluating varargs twice.

* Fix all the warnings in the eglib tests. Leave them not building for now.
2018-05-21 21:05:50 -07:00
Ludovic Henry eec6abca72 [corefx] Build System.Native (#8051) 2018-05-21 14:26:23 -04:00
Vlad Brezae ae5d45e559 [monitor] Fix monitor aborts (#8757)
Replaces semaphore usage with condition variable.

Fixes https://github.com/mono/mono/issues/6834
2018-05-21 14:04:56 -04:00
Jay Krell d878e6fde1 LLVM 6.0 JIT fails always. Fix it:
$  cat 1.cs
class B
{

    public static void  Main(string[] args)
    {
    }
}

MONO_PATH=/s/mono/mcs/class/lib/monolite-darwin/1051500005/  /s/mono/mono/mini/mono --llvm 1.exe
Expected<T> must be checked before access or destruction.
Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).
Stacktrace:

Native stacktrace:

    0   mono                                0x00000001028a00e8 mono_handle_native_crash + 264
    1   libsystem_platform.dylib            0x00007fffb3ca2b3a _sigtramp + 26
    2   mono                                0x0000000105217860 _ZZN4llvm4dbgsEvE7thestrm + 0
    3   libsystem_c.dylib                   0x00007fffb3b27420 abort + 129
    4   mono                                0x00000001028f1892 _ZNK4llvm8ExpectedINSt3__115__list_iteratorINS1_10unique_ptrINS_3orc28RTDyldObjectLinkingLayerBase12LinkedObjectENS1_14default_deleteIS6_EEEEPvEEE22fatalUncheckedExpectedEv + 226
    5   mono                                0x00000001028edd86 _ZN11MonoLLVMJIT9addModuleEPN4llvm8FunctionENSt3__110shared_ptrINS0_6ModuleEEE + 246
    6   mono                                0x00000001028ecd70 _ZN11MonoLLVMJIT7compileEPN4llvm8FunctionEiPP15LLVMOpaqueValuePPvS7_ + 304
    7   mono                                0x00000001028d79a5 emit_method_inner + 12165
    8   mono                                0x00000001028d47d1 mono_llvm_emit_method + 849
    9   mono                                0x00000001027f10ae mini_method_compile + 878
2018-05-21 18:42:59 +02:00
EgorBo ea5701b9c0 don't fail on unsupported ipv6 in BeginConnect 2018-05-21 18:36:38 +02:00
Zoltan Varga 14c8a6c57f [jit] Decompose CEE_BOX later, to enable more optimization opportunities. Optimize Enum.HasFlags (). (#8428)
* [jit] Decompose some CEE_BOX opcodes later to allow more optimizations.

Optimize a code sequence emitted for Enum.HasFlag () by newer csc versions.
Also mark the temporary bblocks used by decompose_vtypes () as out-of-line if
the bblock under processing is out-of-line. Mark the domainvar as volatile to avoid
optimizing it away since references to it can now be generated later from the
decomposition of OP_BOX.

* [jit] Check that the enum types are the same.

* [jit] Fix support for generic enums.

* [jit] Disable the optimization with 64 bit enums on 32 bit platforms.
2018-05-19 08:43:11 -04:00
Jay Krell d8af77551d Use size_t for gsize if it matches, else C99 uintptr_t. type-based instead of size-based autoconf printf(size_t) (#8570)
* Use size_t for gsize if it matches, else C99 uintptr_t.

Using size_t provides for an exact match with functions like malloc and pthread_attr_getstack, no warnings.

* GINT_TO_POINTER and co. need no autoconf, beyond chosing gsize, gssize.

* Use autoconf to find size_t among unsigned int, long, long long, __int64 for printf purposes.
Avoid 18+ year old C99 print("zu") dependency but still less likely to warn than the previous approach which only looked for matching size, not matching type.
2018-05-18 23:49:02 -07:00
Calvin b7061fa90b Small cleanups for mini-ppc.h (#8764)
* mini-ppc-os.h doesn't exist. If the OS lacks a define,
	  give an error instead of a broken include.

	* Remove redundant Mac OS case.

	* Move AIX define for sigaction above cross-compile case,
	  so it won't get lost in the noise there.
2018-05-19 02:06:48 -04:00
Zoltan Varga 36843e8ac8 [aot] Fix encoding/decoding of types with custom modifiers. (#8729)
* [aot] Fix encoding/decoding of types with custom modifiers.

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

* [aot] Add a test, disabling for now because it depends on c# 7.2.

* [aot] Bump AOT file format version.

* [aot] Only disable the test with mcs.

* [aot] Fix compilation of test.
2018-05-18 19:10:55 -04:00
Jay Krell 31be0a13a6 No _Static_assert in old compiler. (#8760)
Fixes #8759
2018-05-19 00:26:13 +02:00
Alexander Köplinger 9e778b9e37 Fix csproj diff 2018-05-19 00:25:22 +02:00
Jay Krell 21a4dfa094 Disambiguate test output. (#8755) 2018-05-18 14:23:21 -07:00
Aleksey Kliger (λgeek) 459bfdca0c [sre] ParameterBuilder.SetConstant for a Nullable<T> parameter (#8736)
* [sre] ParameterBuilder.SetConstant should work with Nullable<T>

Rewrite ParameterBuilder.SetConstant like CoreCLR

Same logic as TypeBuidler.SetConstantValue from coreclr at
    src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs

The details are different because we don't have CorElementType in corlib (so
use TypeCode), and we want to write to a var instead of directly invoking an icall.

Among other things, this enables ParameterBuilder to work with Nullable<T>.
If a parameter is of type Nullable<T> then pb.SetConstant (null) should work.
Also pb.SetConstant (value) should work when T is one of the supported
types (primitives, enum, datetime, etc).

Fixes https://github.com/mono/mono/issues/8597 and fixes https://github.com/mono/mono/issues/8504

* [test] ParameterBuilder.SetConstant with a nullable type
2018-05-18 15:13:15 -04:00
Marek Habersack 170e9442c9 mkbundle interop changes
mkbundle works by generating a small C source file which, in addition to
embedded assemblies/configs/etc, contains a certain amount of code to initialize
the bundle, uncompress the assemblies and set runtime options (e.g. AOT mode).
This source code is generated based on a number of templates shipped as
resources inside `mkbundle.exe` and is not part of any public, maintained API.

The generated code contains calls to Mono runtime which work just fine when
mkbundle is used to generate a desktop application bundle with the default
template code. However, it breaks when a third party (like Xamarin.Android)
embeds Mono runtime and loads it dynamically **after** the application is
initialized. Such third parties must ensure that the bundle's startup code is
able to access the Mono runtime functions it needs by providing pointers to
them, loaded using e.g. the `dlsym` function.

However, as the Mono calls are hard-coded into the generated source code, the
third party needs to resort to search-and-replace methods (e.g. Xamarin.Android
https://github.com/xamarin/xamarin-android/blob/62e7792ca52949f2fa213330d292865ad78d2bfa/src/Xamarin.Android.Build.Tasks/Tasks/MakeBundleNativeCodeExternal.cs#L159-L166)
which are very fragile and prone to undetected breakage.

One example of such breakage which slipped under the radar is
https://github.com/xamarin/xamarin-android/issues/1651 which was caused by
addition of the `mono_jit_set_aot_mode` call to the generated code. The change
slipped under the radar and was discovered only after release.

This commit attempts to make the situation better by establishing a sort of a
code contract between "upstream" mkbundle and the third party. Since the
template code is not "public" (nor should it be), the third party cannot simply
include a header file with the API definitions. Instead, the idea here is to
ensure that all and any Mono runtime calls needed by the template code are
placed in a dispatch structure as pointers to functions and that the structure
needs to be initialized by the embedding party before calling the
`mono_mkbundle_init()` function. The third party is responsible for maintenance
of its own version of the dispatch structure as well as for its initialization
via the `initialize_mono_api` function in the template code. The generated code
must include the third party's version of the structure, in place of the default
one as shipped with `mkbundle`, and to make it possible this commit adds the
`--mono-api-struct-path` mkbundle parameter which points to a file that's
injected into the generated code, replacing the default structure definition.

Following that, the `mono_mkbundle_init()` code calls the `validate_api_struct`
function which checks each and every pointer in the structure for `null`,
exiting the application with error if any `null` pointer is encountered.
This (along with the `initialize_mono_api` function in the template) has the
additional effect that if the third party's structure is incompatible with the
default one a build error will happen, thus allowing early detection of obvious
incompatibilities/omissions.

As long as all the new Mono runtime calls are added to the structure, the above
should make it possible for issues like the one linked to above to not happen in
the future.
2018-05-18 19:37:04 +02:00
Martin Baulig 0429856f02 [System]: Cleanup SslStream callbacks and internal validation code. (#8753)
* `SslStream`: Reject attempts of setting conflicting callbacks using both the
  Mono-specific `MonoTlsSettings` and the new `SslClientAuthenticationOptions` /
  `SslServerAuthenticationOptions`.

  This makes it consistent with CoreFx behavior where those callbacks may only be
  specified in one of the possible places.

* `ChainValidationHelper` - this internal class has received a major overhaul and
  lots of old and unused code removed.

  All callbacks are not invoked with the correct `sender` parameter to make it
  match the .NET / CoreFx behavior.

* `Mono.Security.Interface.CertificateValidationHelper`: remove unused internal code.
2018-05-18 12:35:24 -04:00
Cody Russell 890bfea319 Bump bockbuild to get Pango patch (#8748) 2018-05-18 16:52:13 +02:00
Joshua Peterson 2447ab1149 Correct the base types for a few enum types (#8740)
To match the .NET 4.7.1 profile, these enum types should have special
base types.

* Bump API snapshot submodule
2018-05-18 15:31:03 +02:00
Ankit Jain fe34b9dae9 Bump msbuild to track xplat-master (#8725) 2018-05-18 15:14:23 +02:00
Alexis Christoforides 0ecd9dcef5 Merge pull request #8746 from lewurm/fix-PrincipalFlowsToAsyncTask
[corlib tests] improve ThreadPrincipalTests regarding SynchronizationContext
2018-05-18 09:06:21 -04:00
Alexander Köplinger fa9579a8fa [ci] Fix URL for apidiff/csprojdiff report
The upgraded HTML publisher plugin on Jenkins now generates a different URL.
2018-05-18 14:23:21 +02:00
Bernhard Urban 5bb972e99a [corlib tests] improve ThreadPrincipalTests regarding SynchronizationContext 2018-05-17 18:23:44 +02:00
Ludovic Henry 9805cda80f [android] Fix truncating of messages longer than 4096 characters (#8735)
Fixes https://github.com/mono/mono/issues/8282
2018-05-17 12:00:22 -04:00
Zoltan Varga a88c24b0d6 [jit] Fix casting of arrays of special array interfaces. (#8741)
Fixes https://github.com/mono/mono/issues/6647.
2018-05-17 11:58:45 -04:00
Jay Krell 4304788610 [jit] Volatile static field accesses lack barriers, contributing to FullAOT-LLVM test failure. (#8738)
* Volatile static field accesses lack barriers.
This is a contributing factor to https://github.com/mono/mono/issues/8321.
finally_block_ending_in_dead_bb.exe does not poll the volatile field.
This is not the entire problem.

* [llvm] Notice the MONO_INST_VOLATILE flag on load/store, not just MONO_INST_FAULT.
This is related to https://github.com/mono/mono/issues/8321 finally_block_ending_in_dead_bb.exe
however emitting a barrier suffices to get LLVM to do the read.
2018-05-17 01:29:11 -07:00
Zoltan Varga 2674424a1b [runtime] Fix the marshalling of class types using MarshalAs(UnmanagedType.Struct). (#8732)
Fixes https://github.com/mono/mono/issues/8250.
2018-05-16 20:48:19 -04:00
Jay Krell 298aa78a47 method_to_ir: factor out operand decoding and stack checking (#8718)
* method_to_ir: Factor out operand decoding, including of constants.
* Cleanup unused file.
* Use MonoOpcodeEnum_Invalid instead of (MonoOpcodeEnum)-1.
* Move CHECK_STACK and CHECK_STACK_OVF mostly to central place, except variable
ones like call/ret/newobj.
* No _Static_assert on msvc.
2018-05-16 11:41:12 -07:00
Ankit Jain 3d8125e54d Bump msbuild to track xplat-master (#8681) 2018-05-16 02:17:23 +02:00
Cody Russell 6e14d3f143 Bump bockbuild to pull in GTK userSpaceScaleFactor deprecation warning fix. (#8541) 2018-05-16 02:13:30 +02:00
Marek Safar 9dd02f8ce5 [packaging] Bump mono-basic to fix build with master and add deprecation message (#8722) 2018-05-16 02:11:22 +02:00
Jay Krell 1507b9b531 Some method-to-ir cleanup. (#8667)
* Remove some FIXMEs.

* Remove an inline.

* Less use  of `tailcall_calli`, more use  of `tailcall`, by assigning first to second.
And then eliminate `tailcall_testvalue`, as it just becomes `tailcall`.

* Merge the end, almost just the end, of CALLI with CALL/CALLVIRT.
Also merge the start, and with JMP, i.e. initializing shared variables.

This eliminates a bunch of shared code, without being too complicated (subjective)
and gives CALLI its missing sequence point.

goto here is disliked, maybe later a function.

* Change virtual_ from int to gboolean, assign it TRUE and FALSE instead of 0 and  1.

* Change guint32 call_opcode to MonoOpcodeEnum il_op.

* Replace *ip with il_op.

il_op is chosen over op, to disambiguate IL from IR.

And this is why C++ enums are not just ints:
	enum Animal {dog, cat};
	enum Color {red, blue};
	Color color = dog; //  valid C, invalid C++ (sometimes a warning in C)
	Animal animal;
	if (color == animal) ... // valid C, invalid C++ (sometimes a warning in C)

* add a FIXME
2018-05-15 12:12:07 -07:00
Jay Krell 2b9145d215 Use guchar instead of unsigned char for brevity/style. (#8717) 2018-05-15 09:02:45 -07:00
Martin Baulig dc93f55a0e [System]: New SslStream APIs from CoreFX. (#8665)
* Bring `SslClientAuthenticationOptions`, `SslServerAuthenticationOptions`
  and `SslApplicationProtocol` from CoreFX.

* SslStream: Added new public overloads from CoreFX:
  - All authentication methods have a new overload without the `SslProtocols` argument.
  - New `AuthenticateAsClientAsync(SslClientAuthenticationOptions,CancellationToken)`.
  - New `AuthenticateAsServerAsync(SslServerAuthenticationOptions,CancellationToken)`.
  - We now use `SecurityProtocol.SystemDefaultSecurityProtocols` (which is zero) as
    default value everywhere.

Everything below is internal:

* `Mono.Security.Interface`: Add internal `MonoServerCertificateSelectionCallback`,
  `IMonoAuthenticationOptions`, `IMonoSslClientAuthenticationOptions` and
  `IMonoSslServerAuthenticationOptions`.

* `Mono.Security.Interface.IMonoSslStream`: Add new overloads without the
  `SslProtocols` argument.

* `Mono.Security.Interface.IMonoSslStream2`: New internal interface, extending
  `IMonoSslStream` with the new internal APIs.

* `Mono.Net.Security`: New internal `MonoSslAuthenticationOptions`,
  `MonoSslClientAuthenticationOptions` and `MonoSslServerAuthenticationOptions`
  classes; these are just proxies for `SslClientAuthenticationOptions` and
  `SslServerAuthenticationOptions` (which unfortunately don't share a common
  base class).

* `Mono.Net.Security.MobileAuthenticatedStream`:
  - Implement `IMonoSslStream2`.
  - `ProcessAuthentication()` now takes `MonoSslAuthenticationOptions` instead
    of the old argument list, added `CancellationToken`.
  - All `IMonoSslStream` facing APIs now construct `MonoSslAuthenticationOptions`
    to pass it to `ProcessAuthentication()`.

* `Mono.Net.Security`: `MobileTlsContext` and `MobileTlsStream` now use
  `MonoSslAuthenticationOptions` to store all options.

Tests for the new APIs are in https://github.com/xamarin/web-tests/commit/fe347589326206f36d3cd42b59d305ff3c291857.
2018-05-15 13:06:17 +02:00
EgorBo 5dabf277f8 match .net behavior in ParameterInfo.ToString 2018-05-15 09:56:49 +02:00
Jay Krell 0e30bebf4c Fix incorrect readbehind and try to make readahead clearer and easier. (#8691)
* Use MonoOpcodeEnum instead of int. Provide MonoOpcodeEnum_Invalid = -1.

* Fix and cleanup bounds checks.
Some were off by one, some could be clearer.
This pattern will go away anyway and is partly gone below.

* Prepare to fix incorrect read behind.

* Add test to hit assert in incorrect readbehind in ldvirtftn.

* Confuse the JIT (or runtime) into crashing.

* Fix parens.

* Move some macros from verify.c to verify-internals.h.

* Attempt to make IL readahead easier to understand, by having
less spread out instruction sizing and decoding.

This converts several readaheads but not all.

It is possible we should just convert to a large array of pointers,
and then do these optimizations.

This also fixes the incorrect readbehind.

* Disable new test. Fixing the readbehind fixes the assertion failure but still sigsegvs later in trampoline.

* More use of common code. More to do here.
2018-05-14 18:48:18 -07:00
Miguel de Icaza d32424632c [Mono.CSharp] Mimic the settings from System to track the feature flags, fixes GitHub #8698 (#8703)
* [Mono.CSharp] Mimic the settings from System to track the feature flags, fixes GitHub #8698

* [csproj] Update project files
2018-05-14 21:01:29 +02:00
Zoltan Varga 0f48e11945 Don't set LDFLAGS on the libmono-ee library. Fixes this warning: (#8671)
libtool: warning: '-version-info/-version-number' is ignored for convenience libraries
2018-05-14 10:50:25 -04:00
Zoltan Varga 2864dd4165 [jit] Extract the intrinsics generation functions into a separate intrinsics.c file. (#8664) 2018-05-14 10:20:33 -04:00
Maxim Lipnin 42459ca99d [System.Security] CoreFX import for SubjectIdentifierOrKeyType type. 2018-05-14 15:42:27 +03:00
Maxim Lipnin 342b1df757 [System.Security] CoreFX import for SubjectIdentifierOrKey type. 2018-05-14 15:42:22 +03:00
Maxim Lipnin 8764171a1a [System.Security] CoreFX import for DataProtectionScope type. 2018-05-14 15:42:17 +03:00
Maxim Lipnin 52d85bbe08 [System.Security] CoreFX import for RecipientInfoType type. 2018-05-14 15:42:12 +03:00
Maxim Lipnin 78bcca7505 [System.Security] CoreFX import for PublicKeyInfo type. 2018-05-14 15:42:08 +03:00
Maxim Lipnin eb5534eb5c [System.Security] CoreFX import for SubjectIdentifierType type. 2018-05-14 15:42:03 +03:00
Maxim Lipnin b338b6a128 [System.Security] CoreFX import for CmsRecipient, CmsRecipientCollection and CmsRecipientEnumerator classes. 2018-05-14 15:41:58 +03:00
Maxim Lipnin c12803841c [System.Security] CoreFX import for AlgorithmIdentifier class 2018-05-14 15:41:53 +03:00
Marek Safar 44b91804db [mdoc] tests updates 2018-05-14 14:38:30 +02:00
Marek Safar e115d0c796 [corlib] Copying null references to value type array is not allowed 2018-05-14 14:38:30 +02:00
Maxim Lipnin d703d1888c [System.Security] Replace some common System.Security.Cryptography files with corefx sources. (#8629)
As part of https://github.com/mono/mono/issues/7589
2018-05-14 14:22:54 +02:00
Vlad Brezae bdef03f6dd [interp] Add null checks for ldind (#8647) 2018-05-14 13:19:29 +02:00
Jay Krell afb9fcb573 Fix build failure on Redhat 6.8 with GCC 4.4.7. (#8579)
Old gcc does not allow pragma diagnostic within function.

Fixes #8572

#if is a deliberate shorter form than #ifdef
	- shorter
	- allows for #define foo 0
	- standardly undefined silently evaluates to 0
	- potential for if instead of #if, though that does require #define foo 0, no
	  silent undefined => 0
2018-05-14 11:00:52 +02:00
Zoltan Varga 76deacd047 [jit] Fix a warning about disabling an unknown warning: trace.c:147:32: warning: unknown warning group '-Wframe-address', ignored [-Wunknown-warning-option] (#8696)
* [jit] Fix a warning about disabling an unknown warning: trace.c:147:32: warning: unknown warning group '-Wframe-address', ignored [-Wunknown-warning-option]

* [jit] Fix a warning.

* [jit] Fix a warning.
2018-05-14 01:45:06 -04:00
Jay Krell 0106bc34e4 Fix OSX x86 warnings. (#8480)
Fix OSX x86 warnings.

In particular:

 1) Be sure to pass a function all of its parameters, no more, no less.
 You can't have a stack imbalance because parameters usually fit in registers,
 and because calling conventions except for __stdcall are explicitly designed
 to accomodate common programming mistakes, e.g. printf ("%d") and printf ("%d", 1, 2),
 are well defined on all modern ABIs to never crash (except for the extreme
 case of printf ("%d") where stack is near the top and it accesses invalid next page,
 most unlikely).

 2) size_t and gsize are not always the same type.
 For example, one can be unsigned int and the other unsigned long (32bit).
 Or unsigned long and unsigned long long (64bit).

 3) gsize is not necessarily unsigned long, nor even the same size as it.
 It could be any of:
  unsigned int -- viable on all 32bit (Win32 and Unix32)
  unsigned long -- viable on Win32 and all Unix (Unix32 and Unix64)
  unsigned long long -- viable on Win64 and Unix64
  unsigned __int64 -- viable on Win64, possibly same as unsigned long long

 To printf a gsize in the "u" style (not the "x" nor "d" styled), G_GSIZE_FORMAT is provided.
  (Fix for Win32 and Win64 forthcoming.)

 We should strongly consider typedef size_t gsize but this a larger change.

 4) Pop without push.

```
mono-publib.c:27:30: warning: incompatible function pointer types initializing 'gpointer (*)(gsize)' (aka 'void *(*)(unsigned int)') with an expression of type
      'void *(*)(size_t)' (aka 'void *(*)(unsigned long)') [-Wincompatible-function-pointer-types]
        GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
                                    ^~~~~~~~~~~~~~
mono-publib.c:27:46: warning: incompatible function pointer types initializing 'gpointer (*)(gpointer, gsize)' (aka 'void *(*)(void *, unsigned int)') with an
      expression of type 'void *(*)(void *, size_t)' (aka 'void *(*)(void *, unsigned long)') [-Wincompatible-function-pointer-types]
        GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
                                                    ^~~~~~~~~~~~~~~
mono-publib.c:27:77: warning: incompsatible function pointer types initializing 'gpointer (*)(gsize, gsize)' (aka 'void *(*)(unsigned int, unsigned int)') with an
      expression of type 'void *(*)(size_t, size_t)' (aka 'void *(*)(unsigned long, unsigned long)') [-Wincompatible-function-pointer-types]
        GMemVTable g_mem_vtable = { vtable->malloc, vtable->realloc, vtable->free, vtable->calloc};
                                                                                   ^~~~~~~~~~~~~~
mono-time.c:204:1: warning: unused label 'exit' [-Wunused-label]
exit:
^~~~~

mono-threads-posix.c:92:43: warning: incompatible pointer types passing 'gsize *const' (aka 'unsigned int *const') to parameter of type 'size_t *'
      (aka 'unsigned long *') [-Wincompatible-pointer-types]
                res = pthread_attr_getstacksize (&attr, stack_size);
                                                        ^~~~~~~~~~
/usr/include/pthread.h:250:85: note: passing argument to parameter here
int pthread_attr_getstacksize(const pthread_attr_t * __restrict, size_t * __restrict);
                                                                                    ^

profiler.c:1062:57: warning: incompatible pointer types passing 'void (MonoProfiler *, MonoProfilerGCEvent, uint32_t)' (aka 'void (struct _MonoProfiler *,
      MonoProfilerGCEvent, unsigned int)') to parameter of type 'MonoProfilerGCEvent2Callback' (aka 'void (*)(struct _MonoProfiler *, MonoProfilerGCEvent,
      unsigned int, int)') [-Wincompatible-pointer-types]
                mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
                                                                      ^~~~~~~~~~~
../../mono/metadata/profiler-events.h:85:1: note: passing argument to parameter 'cb' here
MONO_PROFILER_EVENT_3(gc_event, GCEvent2, MonoProfilerGCEvent, event, uint32_t, generation, mono_bool, is_serial)
^
profiler.c:908:2: note: expanded from macro 'MONO_PROFILER_EVENT_3'
        _MONO_PROFILER_EVENT(name, type)
        ^
profiler.c:897:103: note: expanded from macro '_MONO_PROFILER_EVENT'
        mono_profiler_set_ ## name ## _callback (MonoProfilerHandle handle, MonoProfiler ## type ## Callback cb) \
                                                                                                             ^
marshal.c:4770:72: warning: format specifies type 'unsigned long' but the argument has type 'gsize' (aka 'unsigned int') [-Wformat]
                mono_error_set_out_of_memory (error, "Could not allocate %lu bytes", size);
                                                                         ~~~         ^~~~
                                                                         %u

trace.c:146:32: warning: unknown warning group '-Wframe-address', ignored [-Wunknown-warning-option]
                               ^
trace.c:148:24: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
                       ^

```
2018-05-12 19:25:07 -04:00
Ludovic Henry 3fea4c7e0d [sdks] Only compile MXE on platforms where it's needed (#8666) 2018-05-11 21:52:48 -04:00
Jay Krell 43d27fee05 [jit] Cleanup IL opcode sizing and IP advancement -- mostly data driven (#8676)
* Cleanup IL operation size checks -- data driven.

* Removed duplicate declaration.

* Prepare to cleanup IL IP advancement. Do a self-checking run first, which found incorrect sizing of switch, dyncall, icall.

* Cleanup -- looks like macro debris.

* Cleanup IL IP advancement -- mostly data driven.
2018-05-11 11:19:48 -07:00
Aleksey Kliger (λgeek) ef97d0f00c [ppdb] Print some info if looking up an out of range method token (#8662)
Occasionally due to https://github.com/Microsoft/visualfsharp/issues/4637
Mono will assert if it tries to load a PPDB file that has an incorrect number
of MethodDebugInformation rows:

    * Assertion at metadata.c:1117, condition `idx < t->rows' not met

Instead of asserting, check that the method index is in bounds, and print a more informative error.
2018-05-11 19:58:30 +02:00
Jay Krell 822f75e8c7 Fix sizing of cee_switch, mono_dyn_call, mono_icall. (#8673)
* Fix mono_icall and mono_dyn_call operands in opcode.def.
This might require cpan install XML::Parser, or disable
the generation of opcode.def in Makefile.am.

* Fix sizing of switch instructions: 5 + 4 * n, not 4 + 4 * n.
2018-05-11 19:06:36 +02:00
Alexander Köplinger 72f1a21b2a [tests] Include assembly name in crash test result name
It'd just show up as "crash" in test reporting tools which is less useful
than e.g. "net_4_x_System.Xml_test.dll.crash".
2018-05-11 15:01:56 +02:00
Tony Valenti 13cefa9732 "On" field breaks compatibility with System.Net.Http because of "Internals Visible To" & member type mis-match (#8669)
* Hi Mono Team,
This commit fixes an interesting bug that relates to the  System.Net.Http nuget packages.

So the short story is that System.Net.Http can view the internals of this assembly because of InternalsVisibleTo and the HttpClient references System.Net.Logging's "On" _property_.  The problem is that mono has implemented "On" as a _field_ . When the latest version of System.Net.Http.HttpClient tries to invoke a SyncAsync using Mono, you get a MissingMethodException because:
bool System.Net.Logging.get_On()
does not exist.

This commit is simple and only changes the signature of On to match that of the reference source (property instead of field).  This will cause the Missing Method Exception not to be thrown.

* Fix indentation
2018-05-11 14:18:09 +02:00
Jay Krell ad58c88acf Fix s390x typo. (#8677) 2018-05-11 14:14:57 +02:00
Calvin 877466c432 Support setting thread names on Haiku (#8672)
Makes it easier to know what thread does what when trying to debug
these issues I've been having with things like finalizer threads.
2018-05-11 14:06:27 +02:00
Alexander Köplinger 6c621e2640 Update csproj files 2018-05-11 13:04:01 +02:00
Alexander Köplinger ef102dcbb9 [bcl] Fix bogus file paths in .sources files 2018-05-11 03:24:47 +02:00
Zoltan Varga 6baf32526e [aot] Avoid loading AOT images compiled without --llvm into a runtime running with --llvm, since --llvm was presumably used to achieve maximum performance. (#8661) 2018-05-10 21:22:11 -04:00
Martin Baulig d125afca84 [System]: The big WebConnectionStream cleanup. (#8569)
* [System]: The big WebConnectionStream cleanup.

`WebResponseStream` has been broken down into smaller pieces and now
fully supports GZip / Deflate decompression.

The entire `contentLength`, `readBuffer` and `totalRead` logic has been
replaced by a nested layer of `WebReadStream` classes.

* `WebReadStream` is a new abstract base class.

* `BufferedReadStream` handles the situation where we have some buffered
  data and an (optional) inner stream to read from.

* `ContentDecodeStream` takes care of GZip / Deflate decompression.

* `FixedSizeReadStream` handles the `contentLength` logic - ie. making sure
  we are only reading up to `contentLength` bytes from the stream.

* The old `MonoChunkStream` has been renamed into `MonoChunkParser` (as it was
  really just a parser and not a stream) and a new `MonoChunkStream` has been
  added that's based on `WebReadStream`.

* Remove HttpWebRequestTest.TestLargeDataReading().

This test was using Reflection to poke around implementation internals.

* [csproj] Update project files

* Cosmetic cleanups.
2018-05-10 20:17:21 -04:00
Martin Baulig c6158d4a00 [corlib]: Misc updates from CoreFX. (#8614)
* [corlib]: Misc updates from CoreFX.

* CancellationTokenRegistration: use the CoreFX version.

* String: add `implicit operator String (ReadOnlySpan<char> value)`.

* TimeSpan: add `TimeSpan operator / (TimeSpan timeSpan, double divisor)`
  and `double operator /(TimeSpan t1, TimeSpan t2)`.

* BitConverter: add `uint ToUInt32(ReadOnlySpan<byte> value)` and
  `ulong ToUInt64(ReadOnlySpan<byte> value)`.

* Fix the tests.

* Bump API snapshot submodule

* [csproj] Update project files
2018-05-11 00:04:26 +02:00
Jay Krell baf58ed6eb [btls] Fixes for windows. (#8653)
* [btls] Do not give gcc flags to msvc.

* [btls] #include "btls-foo.h" instead of #include <btls-foo.h> to work
with existing build system, on Windows, with out-of-tree build.
Not sure which factor does not like <> but "" should be ok.

* [blts] MONO_API is not used consistently and therefore errors on Windows.
1. Make it be nothing.
1b. Use a .def file if there are actual exports.
Really, .def files are a good idea.

 or

2. Use it consistently.

This does #1.
2018-05-10 14:35:27 -07:00
Jay Krell a7bebe779e [Tailcall] Classify some CoreCLR test problems, enable more, partially implement tail.calli for them. (#8621)
* Fix, classify, enable some CoreCLR tests.
* [Tailcall] Add partial calli support, so a test passes.
* Disable r4/r8 mismatch for all architectures, and one due to interface on ARM.
2018-05-10 12:40:21 -07:00
Aleksey Kliger (λgeek) 5e39d36bc7 [runtime] Transition to GC Unsafe in MONO_API functions (#8613)
* [runtime] Transition to GC Unsafe in MONO_API functions

The idea is that on any external->runtime transition we want to ensure that we
switch to GC Unsafe mode (and back on return).  This allows Mono embedders to
be oblivous about hybrid suspend - the runtime will run native embedder code in
GC Safe mode (and use preemptive suspend when necessary) and when they switch
back to the runtime we will switch to GC Unsafe mode (and use cooperative suspend).
2018-05-10 12:27:39 -04:00
Jay Krell 63bd3523ff Fix s390x more and make amd64.md file not executable. (#8649)
* Fix s390x more.

* Make it not executable.
2018-05-09 23:45:53 -04:00
Alexander Kyte bb15b3d963 Merge pull request #8511 from alexanderkyte/freeform_merp_cleanup
Implement Freeform Unmanaged Error
2018-05-09 23:17:16 -04:00
Alexander Kyte f72d9b0529 [runtime] Make unhandled state dumper OSX-specific
Since this needs to be backported, we're going to make this osx-specific
for now, and then I'll backport this. This is fully working on linux,
including the android SDK at the time of this commit
2018-05-09 17:19:24 -04:00
Aleksey Kliger (λgeek) 5a00750752 [runtime] Fix debug_log prototype in runtime callbacks (#8643)
The debug log fnptr is used with MonoStringHandle arguments since
cc7406b226

The corresponding functions and prototypes in mini/ have already been updated.
2018-05-09 17:06:03 -04:00
Jay Krell 613f15f720 Fix PowerPC64 not just PowerPC32. (#8645) 2018-05-09 20:55:46 +02:00
Alexander Köplinger d8531c5b86 [csproj] Fix diff rendering when XML comments appear in the diff (#8642)
The renderer would stop at the first XML comment `-->` which means
the diff was cut off.

We can fix this by switching from storing the diff in an HTML div to
a script tag instead.

Fixes https://github.com/mono/mono/issues/8469
2018-05-09 20:38:38 +02:00
Jay Krell cc236a3471 Fix powerpc and s390x compilation. (#8641) 2018-05-09 18:45:08 +02:00
Alexander Kyte 4f43fd12dd [runtime] Fix windows build 2018-05-09 11:26:40 -04:00
Alexander Kyte 0c6a69a188 [runtime] Fix merp reference in mono-state code 2018-05-09 11:25:59 -04:00
Alexander Kyte 581e2d866e [runtime] Add freeform dumper preprocessor symbols to autogen 2018-05-09 11:25:58 -04:00
Alexander Kyte 02689c25d6 [runtime] Add CI dumper using mono-state 2018-05-09 11:25:49 -04:00
Alexander Kyte 86045d13b6 [runtime] Integrate signal-based state machine with merp forking 2018-05-09 11:24:34 -04:00
Alexander Kyte 1b7cbbb2c0 [runtime] Write unmanaged exception dumper 2018-05-09 11:24:25 -04:00
Alexander Kyte 55d41889fb [runtime] Add helper to get portable IP value 2018-05-08 23:41:39 -04:00
Alexander Kyte 0fd43064f5 [runtime] Make assertion message fetchable 2018-05-08 23:41:39 -04:00
Jay Krell 1c91423be3 [Tailcall] Fill in some missing pieces: x86reg, armreg, armmembase, align x86patch, x86aot, armhardfloat. (#8591)
* [Tailcall]  Implement x86 OP_TAILCALL_REG (https://github.com/mono/mono/issues/8582)
This should enable calli, which isn't just for cee_calli but also internal purposes.

* [Tailcall] Split x86_align_for_patch out of emit_call.

* [Tailcall] Align x86 tailcall patches, using x86_align_for_patch.

* [Tailcall] Allow x86 tailcall to be AOTed.

* [Tailcall] Make all the 'missed tailcall' cases more similar looking.

* [Tailcall] Fill in a little more tailcall support.

* [arm] emit_big_add: Handle degenerate imm == 0 and dreg == sreg.

* [arm] Split emit_call_reg into emit_call_reg and emit_jmp_reg (for reuse by tailcall).

* [arm] handle hardfloat in tailcall

* [arm] Fill in TAILCALL_MEMBASE and TAILCALL_REG (reuse emit_jmp_reg)
virtual calls should work now (but not interface)

* [Tailcall] Comment about tail.calli -- no this-type in signature, to check for byref valuetype.
(data is available on compile-time staci, and a proposal to check for ldloca/ldarg pending)

* Add some asserts.

* More detangling of vtable_arg/imt_arg (extra_arg) from tailcall_supported -- they must be set, or nullness predicted, earlier.

* [Tailcall] Capture inputs to is_supported_tailcall and assert they don't change.

* [Tailcall] ARM32 tailcall not supported if mono_class_is_interface (cmethod->klass).
2018-05-08 19:02:37 -07:00
Jay Krell 5a3137214b [Coop] Convert Mono.SafeStringMarshal. (#8603) 2018-05-08 18:20:54 -07:00
Jay Krell f12cf1746c [Coop] Convert System.Diagnostics.DefaultTraceListener. (#8617) 2018-05-08 17:27:04 -07:00
Martin Baulig 89427f4938 [System]: Free ServicePoint instances when they're no longer used. (#8562)
* [System]: Free ServicePoints when they're no longer used.

* Cleanup.

* Don't crash when ServicePoint.CloseConnectionGroup() is called after the ServicePoint has been freed.

* Remove the CloseConnectionGroupConcurrency() test.

This test was for a regression in a piece of code that no longer exist
and the test is poorly designed as it depends on precise timings.
It also attempts to make a web request to a non-exisiting server and
just ignores the error - it is unclear whether that is intentional or not.
2018-05-08 23:21:46 +01:00
Martin Baulig e891290932 [tools]: resx2sr now takes an '-i file' argument.
Pass all manually created 'SR.cs' files using the new '-i' argument
and it will automatically eliminate all duplicates.
2018-05-08 23:19:20 +01:00
Martin Baulig 86981b96a5 [System]: Allow SecurityProtocolType.SystemDefault.
In CoreFX, `ServicePointManager.SecurityProtocol` defaults to
`SecurityProtocolType.SystemDefault` (which is zero).

We now allow this value to mean "whatever the system default is"
in both AppleTls and BTLS.

The default value of `ServicePointManager.SecurityProtocol` has also
been changed to be consistent with CoreFX.
2018-05-08 23:17:55 +01:00
Zoltan Varga ebdd620d29 [sdb] Fix some debugging logging before an assert so it prints even if the log level is 0. (#8628) 2018-05-08 18:11:51 -04:00
Alexander Köplinger 1280f6c1e3 [vscode] Update c_cpp_properties.json (#8630)
The C/C++ extension was updated yesterday and bumped the version in that file.
2018-05-08 14:35:29 -04:00
Jay Krell 423304db13 [jit x86] Move microoptimization down a level: x86_mov_reg_reg do not… (#8609)
* [jit x86] Move microoptimization down a level: x86_mov_reg_reg do nothing
if source == desta and size == 4 (size is always 4, except in amd64 reuse,
which was only used once, unnecessarily, remove it).

[jit x86] x86_mov_reg_reg size is always 4,
split into unused. x86_mov_reg_reg_size and specialized x86_mov_reg_reg

* Remove last parameter from x86_mov_reg_reg that is always 4.
2018-05-08 09:00:22 -07:00
Jay Krell cc7406b226 [Coop] Convert System.Diagnostics.Debugger. (#8618) 2018-05-08 11:45:25 -04:00
Vlad Brezae caad949923 [interp] Disable tailcall on valuetypes (#8616)
It is not guaranteed to work if the valuetype was allocated in the same stackframe.

This was initially leading to crashes because when storing in **this**, we were storing as a valuetype instead of the pointer (**this** valuetype is passed as pointer). Even if we fixed this issue, the other problem still exists.
2018-05-08 11:31:17 -04:00
Jay Krell 0b5e692323 [Coop] Convert Mono.RuntimeMarshal. (#8602) 2018-05-07 20:47:48 -07:00
Jay Krell 311d75e902 [Coop] Convert Mono.RuntimeClassHandle. (#8600) 2018-05-07 19:51:52 -07:00
Jay Krell 42dd7d3e84 [Coop] Convert Mono.RuntimeGPtrArrayHandle. (#8601) 2018-05-07 14:20:08 -07:00
Jay Krell 2f38e6454d [Coop] Convert Mono.Runtime to coop. (#8599) 2018-05-07 13:44:39 -07:00
Jay Krell 856e93838c [Coop] Convert System.CLRConfig to coop. (#8606) 2018-05-07 13:37:53 -07:00
Vlad Brezae 20530bdaa1 [interp] Fix stobj (#8574)
* [interp] Fix stobj

When writing to a stackval, we write at least 4 bytes. Because we were wrongly casting destination to stackval*, we could be clearing other fields for 1/2 byte stores.

* [interp] Use memmove also with stackval_to_data

As we do with stackval_from_data to prevent unaligned faults.
2018-05-07 08:48:44 +02:00
Jay Krell 6f590e214e [Tailcall] Fix CoreCLR tests to return success:0 instead of success:100 and run some. (#8533)
* [Tailcall] Change CoreCLR tests to return success:0 instead of success:100
* [Tailcall] Cleanup redundant test disabling.
* [Tailcall] Remove loop tests incorrectly classified as tailcall tests.
* [Tailcall] Enable CoreCLR tests, having changed success return value from 100 to 0.
* [Tailcall] Clarify why some tests fail.
2018-05-06 20:33:33 -07:00
Zoltan Varga 771353bf1e [sdks] Use cmake to build llvm. (#8260)
* [sdks] Use cmake to build llvm.

* [sdks] Build all targets for llvm32 as well, since android might not build llvm64.

* [sdks] Build the llvm windows builds using cmake as well.

* Address review comments.

* Switch to the release60 branch of LLVM as an experiment.

* [sdks] Bump LLVM.

* Bump LLVM.

* [sdks] Fix the build.

* [llvm] Emit default debugging info for all llvm builders otherwise methods without debug info like iterators will fail to compile.

* Fix a crash if ctx->minfo is not set.

* [sdks] Add an LLVM_BRANCH variable.
2018-05-06 11:18:55 -07:00
Alexander Köplinger 397be364fb [wasm] Add .wasm mime mapping for python3 in server.py too (#8592)
It was only done in the python2 case.
2018-05-06 11:05:16 -07:00
Maxim Lipnin f265e64bf3 CoreFX: System.Xml.Linq (#8274)
These changes replace references sources with CoreFx System.Private.XML.Linq sources.

Fixes: https://github.com/mono/mono/issues/8122
2018-05-06 19:37:10 +02:00
Zoltan Varga cad251da62 [llvm] Emit default debugging info for all llvm builders otherwise methods without debug info like iterators will fail to compile. (#8584)
* [llvm] Emit default debugging info for all llvm builders otherwise methods without debug info like iterators will fail to compile.

* Fix a crash if ctx->minfo is not set.
2018-05-06 09:32:07 -04:00
Alexander Köplinger d686d6dd07 [bcl] Add xunit to STD_TARGETS and precompile tests (#8594)
Similar to how we do it for nunit.
2018-05-05 17:28:50 -07:00
Marek Safar ed15e75a94 [corlib] Use ArrayPool from coreclr (#8399) 2018-05-05 18:14:29 +02:00
monojenkins e350fa07b5 [msvc] Update csproj files (#8593) 2018-05-05 18:04:52 +02:00
Alexander Köplinger 1b2fb14d0a Bump api-snapshot 2018-05-05 17:30:28 +02:00
Alexander Köplinger 73f137b80d [mk] Add .gitignore 2018-05-05 15:51:13 +02:00
Jay Krell f5373adc8a [Tailcall] Allow RegularAOT and HybridAOT x86/arm64 tailcalls. (#8583)
This strongly motivates additional CI lanes.
2018-05-04 22:30:29 -07:00
j-p 56f8556df8 [Mono.Cairo] Add OpenGL texture Surface support (#2443)
* Add OpenGL texture Surface support

* reorganize with EGL,WGL,GLX Device classes, and a single GLSurface class
2018-05-04 18:43:53 -07:00
Jay Krell 89b6b4b286 Free and destroy, of any type, should do nothing, silently, give a null pointer. (#8458)
Remove excess null checks.
2018-05-04 17:10:15 -07:00
Zoltan Varga 37e9efc20b [llvm] Set debug info when breaking up large bblocks, recent llvm versions fail without it: (#8576)
inlinable function call in a function with debug info must have a !dbg location
2018-05-04 17:34:38 -04:00
Jay Krell 06ce5f3f02 [Tailcall] Allow tailcall when returning valuetypes. (#8550)
* [Tailcall] Add tailcall-return-valuetype.il test.
This can be fixed easily -- when F1 calls F2 tailcalls F3.
F2 can pass F3 the temporary it got from F1 instead of having another temporary.

* [Tailcall] Add a test for passing large valuetypes by value.
This has problems on some ABIs but not others -- arm64 and Windows/amd64 fail.
Presumably the temporary is either within the paramete area
or is a local. The first works, the second does not.

* [Tailcall ppc/s390x] Update ppc/s390x to be more like x86/amd64/arm/arm64
i.e. matching return storage, and s390x matching struct-ness/size.

* [Tailcall] Let valuetypes be returned through tailcalls.

Specifically there was already this handling them:

mono_emit_call_args:
{

   if (tailcall) {
	   if (mini_type_is_vtype (sig_ret)) {
		   call->vret_var = cfg->vret_addr;
		   //g_assert_not_reached ();
	   }

so when F1 calls F2 and F2 tailcalls F3, F3 will return the value
where F1 was expecting it. There is no extra code needed after F3
returns to copy it from F2's temporary.


* CallInst.tailcall field is read before written in amd64, and is also wrong for llvmonly.

Replace CallInst.tailcall with MONO_IS_TAILCALL_OPCODE when accuracy is desirable and works.
Add FIXME when inaccurate CallInst.tailcall is presently required.
Tailcall field should probably be replaced by FALSE, except CEE_JMP needs attention first.
(see https://github.com/mono/mono/pull/8571)

* [Tailcall arm64 amd64 s390x] Do not allow tailcall when passing large valuetypes.
For s390x this is being conservative and might not be needed.
For ppc it is already done. Needed?

arm32/x86 seem to pass struct inline so it works, nice.

Small structs are sometimes passed in registers as well.

* Disable tailcall/coreclr/JIT/opt/ETW/TailCallCases.exe.
It passes a struct by value and fails.
2018-05-04 13:54:59 -07:00
Rodrigo Kumpera f238209bc4 Merge pull request #8442 from kumpera/sample_bindings
[wasm] Add Sample binding engine.
2018-05-04 12:20:07 -04:00
monojenkins dbfbffb559 Bump API snapshot submodule 2018-05-04 10:35:30 +02:00
EgorBo 1c00af3197 temporarily ignore failed tests 2018-05-04 10:35:30 +02:00
EgorBo c79e38f870 Add System.ComponentModel.Composition xunit tests 2018-05-04 10:35:30 +02:00
Martin Baulig d17ad304b3 [tools]: Use the official 'SslStream' APIs in certmgr. 2018-05-04 10:34:10 +02:00
José Manuel Serrano Mármol 40d1ac3371 FormsAuthenticationTicket should expire with persistent cookies (#8522) 2018-05-03 17:50:25 -07:00
Jay Krell 294461fa49 ifdef reduction (#8309)
Typo: is_adressable_valuetype_load => is_addressable_valuetype_load
Don't mark large multi-called function inline.
Remove lines that are all whitespace (leave whitespace at ends of lines, there is a lot).
One case of spaces to tabs.
2018-05-03 17:43:04 -07:00
Vincent Povirk d1020ab5a1 [tests] Fix out-of-tree build. (#8476) 2018-05-03 17:39:56 -07:00
Rodrigo Kumpera 3eaa5c2f48 [System] When doing process redirect, use Console.OutputEncoding instead of Console.Out.Encoding. (#8438)
* [System] When doing process redirect, use Console.OutputEncoding instead of Console.Out.Encoding. Fixes #8417.

This change makes mono behave in the same way as dotnet, which uses Console.OutputEncoding instead of whatever Console.Out is.

* [System] Add regression test for #8417.
2018-05-03 17:35:51 -07:00
Jo Shields a81e5afce5 [build] Add a -march forcing crypto extensions on ARM64 (#8542)
We only care about CPUs with this extension, and it fixes https://github.com/mono/mono/issues/8488
2018-05-03 17:32:36 -07:00
Miguel de Icaza 52d977a316 [mono] Add support for response files, using --response=FILE (#8560) 2018-05-03 17:28:59 -07:00
Jay Krell e4bacdc82c [Microsoft.Build] Bump timeout for BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion. (#8556)
https://jenkins.mono-project.com/job/test-mono-pull-request-coop/3429/testReport/junit/(root)/BuildSubmissionTest/EndBuildWaitsForSubmissionCompletion/

```
BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion

Failing for the past 1 build (Since Unstable#3429 )
Took 36 sec.
add description
Stacktrace
                                                MESSAGE:
                                                  #5
  Expected: less than or equal to 00:00:02.5000000
  But was:  00:00:09.1408213

                                                +++++++++++++++++++
                                                STACK TRACE:
                                                  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in /mnt/jenkins/workspace/test-mono-pull-request-coop/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
```
2018-05-03 22:26:16 +02:00
Vincent Povirk 4949d7eaa0 Support native-to-managed thiscall wrappers (#3391)
* [x86] Add support for tracing native-to-managed thiscall wrappers.

* [x86] Add support for native-to-managed thiscall wrappers.

* Add test for managed thiscall methods.
2018-05-03 12:43:38 -07:00
Alexis Christoforides 5f7de5dd25 [process] Wait for exit for ShellExecute with 'xdg-open' (#8477)
Fixes https://github.com/mono/mono/issues/6466
2018-05-03 12:22:35 -07:00
Bernhard Urban 6f87ea1fa9 [native types] fix nfloat:NaN on arm64 JIT and interp (#8552)
interp: If one of the operands is NaN, we have a default result: It is false (0)
when doing a compare (`ceq_r8`), but must be true (1) on `cne_r8`.

JIT: match behaviour what C# compiler would generate for float/double.
2018-05-03 12:15:39 -07:00
Vlad Brezae f2d15bf067 [runtime] Fix runtime invoke with generic enums (#8554)
Fixes corefx generic list tests with interp.
2018-05-03 12:14:51 -07:00
Miguel de Icaza 588d6b20e4 Deambiguate TLS (#8561) 2018-05-03 12:11:18 -07:00
Miguel de Icaza 8a07116020 [ilasm] Add support for assembling vbbyrefstr, fixes https://github.com/mono/mono/issues/8447 (#8467) 2018-05-03 14:22:15 -04:00
Aleksey Kliger (λgeek) a920e7cdb6 [loader] If binding redirection redirects to the same version, ignore it (#8547)
If you load Foo.dll and it happens to be version 2.0.0.0 and an app.config says
to redirect all versions of Foo.dll to version 2.0.0.0, we're there already -
don't close the image and probe again, that's silly.
2018-05-03 13:10:34 -04:00
Marek Safar f71b208ca7 [mcs] Mimic csc behaviour when attribute value is a typedef and add also assembly reference for it 2018-05-03 08:56:11 +02:00
Ankit Jain 344c473cfa Bump msbuild to track xplat-master (#8501) 2018-05-03 02:45:35 +02:00
rbazinet-exago 6c465b42d5 Update HtmlForm.cs for issue #8526
When running with cookieless sessions, the file_path does not necessarily contain a leading '/' character which can lead to a Uri being constructed from something that looks like, "http://hostmyPage.aspx" which immediately fails and throw an exception stating that the hostname could not be parsed.
2018-05-02 23:25:52 +02:00
Jay Krell 672a15278d [Tailcall] Add a test for member functions in value types.
This is not trivial to fix -- either a range check
in the backend as to if the parameter is in the frame, or
value tracking in the frontend to see if it came from the frame.
2018-05-02 19:26:47 +02:00
Ankit Jain 34d79079d2 nuget-hash-extractor: Add all option to emit all 3 lists
This is faster than invoking the extractor thrice.
2018-05-02 18:06:32 +02:00
Ankit Jain de7a1ec01b nuget-hash-extractor: Improvements for better, deterministic output
- Ensure the various lists we emit have unique entries, are sorted to be
deterministic
- Ignore ref assemblies
2018-05-02 18:06:32 +02:00
Ankit Jain 7d68b33343 nuget-hash-extractor: Add msbuild extensions nuget version from
.. xplat-master msbuild branch.

	Microsoft.NET.Build.Extensions:         2.1.300-preview3-62804-06

Version from:
https://github.com/dotnet/cli/blob/8c937a0db08e56660aca456ac088f2d0e70735ab/build/DependencyVersions.props

None of the assemblies were newer, so none of the lists have any
changes.
2018-05-02 17:42:40 +02:00
Ankit Jain 376050c2bc nuget-hash-extractor: Sort the lists for easier reviews
mcs/tools/xbuild/data/deniedAssembliesList.txt:
	- sorted by name and assembly version
	- This file had one duplicate line
		System.Text.Encoding.CodePages.dll,FD178CD4-EF4F-44D5-9C3F-812B1E25126B,4,0,2,0

mono/metadata/image.c:
	- sorted by hashcode
	- This had one duplicate line
		IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES, "FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),
2018-05-02 17:42:40 +02:00
Alexander Köplinger ffc227a1fc [dist] Add new mk/ subfolder to SUBDIRS in Makefile.am
It was missed in fe21aad1df and breaks the tarball build.
2018-05-02 16:57:56 +02:00
Egor Bogatov 080e0b4874 [corlib] System.Text.Encoding.* from CoreFX (#7466)
Second part of https://github.com/mono/mono/issues/7247

All tests from corefx were already ported to mono.
2018-05-02 16:34:02 +02:00
Egor Bogatov 6ba593f21a [corlib] StringBuilder from corefx (#7949) 2018-05-02 08:17:16 +02:00
Jay Krell 5eafab5dab Update monollvm to: (#8536)
commit 0b3cb8ac12cd839f8110775d4085e822e8af4d7b (HEAD -> master, origin/master, origin/HEAD)
	Author: Zoltan Varga <[email protected]>
	Date:   Tue May 1 14:52:22 2018 -0400

	Emit an LSDA for methods without landing pads too since we need the information about the 'this' register.

to fix generic-stack-traces2.2 -- so it gets a generic type definition
instead of a generid type instance, consistent with other execution modes.
2018-05-01 18:13:03 -07:00
Aleksey Kliger (λgeek) 50444ec1bc [threads] Don't call backtrace on BLOCKING->RUNNING transitions (#8530)
See https://github.com/mono/mono/issues/8356

Backtrace can deadlock with threads that have been suspended while holding a
dynamic linker lock on Linux.

In checked build mode we collect backtraces on state machine transitions.

When we transition from BLOCKING->RUNNING under hybrid suspend the thread must
not block without polling.  So we must not collect a backtrace on this
transition.
2018-05-01 14:26:13 -04:00
Jay Krell 31fa26ea9d Have automake copy instead of symlink, for more git checkout sharability (#8534)
* Make autogen.sh output accurate -- print actual commands run.

* Have automake copy instead of symlink.
 - This sounds analogous to libtool --copy that we do.
 - It enables sharing a source tree more broadly.
   For real example, Cygwin symlinks are not portable to Windows Subsystem For Linux, and probably vice versa.
   For real example, Homebrew symlinks are not portable to Linux in Docker.

Downside I notice is that ls -l is less informative as to what is from git vs. a symlink to outside.
git clean -xxddff works just as well either way.
Hypothetical downside is that updating automake/autoconf doesn't upgrade the copies.
This has never mattered to me, but it might matter. It might be viewed as an advantage.
2018-05-01 11:46:02 -04:00
Vlad Brezae 73326cbb85 [interp] Fix Assertion at threads.c:326, condition `new_val >= 0' not met (#8527)
* [interp] Don't throw exceptions if we are in the middle of EH

Fixes delegate2.exe failures

* [interp] Don't set parent for invoke frame

This leads to unwinding same frame twice (once when going through the parent frame and, after we have no more parent frames, again through the pushed LMF). We should unwind past invoke only through LMF structures.

Fixes https://github.com/mono/mono/issues/8372
2018-05-01 11:27:31 -04:00
Zoltan Varga 73866f6b16 [jit] Add a MONO_ARCH_LLVM_JIT_SUPPORTED define to enable llvm jit support. (#8525) 2018-04-30 22:50:44 -04:00
Ankit Jain 0b8f0d2f83 [msbuild] Zip test results and log files for surfacing in jenkins (#8523) 2018-04-30 22:30:06 -04:00
Jay Krell becde2feb6 [Coop] Convert Mono.Interop.ComInteropProxy to coop. (#8509)
* [Coop] Introduce mono_gchandle_new_weakref_from_handle.

* Convert some old code to `mono_gchandle_new_weakref_from_handle`.

* [Coop] Convert ves_icall_Mono_Interop_ComInteropProxy_AddProxy to coop.

* [Coop] Convert ves_icall_Mono_Interop_ComInteropProxy_FindProxy to coop.

* Remove whitespace from whitespace-only line.
2018-04-30 18:41:23 -07:00
Jay Krell 5cd54b9641 [Coop] Remove around 140 uncooperative pointers due to calls to mono_set_pending_exception (). (#8483)
* [Coop] Remove 140+ uncooperative pointers due to calls to mono_set_pending_exception ().
Instead typically use:
  ERROR_DECL (error); // sometimes already present
  mono_error_set_xxx (error, ...);
  mono_error_set_exception_pending ();

* Improve error in not supported.

* Allow null in set_error_messagev.

* () and (void) are not the same in C, use (void)

When/if these functions are revisited for further coop conversion, the first and last line might be deleted but the second is likely to survive asis.
2018-04-30 17:00:50 -07:00
Jay Krell 3376ff2d67 [Tailcall PowerPC] OP_TAILCALL_PARAMETER support. (#8500) 2018-04-30 14:25:27 -07:00
Jo Shields 266edc1044 Merge pull request #8524 from directhex/ins_opcode
[ppc] Fix build
2018-04-30 16:35:22 -04:00
Jay Krell 069aa55acf [Coop] Convert Mono.Net.Security.MonoTlsProviderFactory to coop. (#8510) 2018-04-30 12:49:59 -07:00
Jo Shields cf8936fd02 [ppc] Fix build 2018-04-30 14:42:49 -04:00
Jonathan Peppers cf1c51944a [sdks] fix $(mktemp) usage on older versions of macOS (#8498)
Context: https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x

When making the bumps to use the `mono-sdks` upstream in Xamarin.Android,
we were getting build errors such as:

    usage: mktemp [-d] [-q] [-t prefix] [-u] template ... (TaskId:404)

The build bot is running Mavericks (10.9), so it must be an issue with older
versions of macOS.

When reading the Unix StackExchange post, it appears that the `-t` option
without a template should work more reliably on older macOS versions.

Then I tested it locally via `make -C sdks/builds provision-android`.

The command:

    mktemp -d unzip_android_archive_XXXXXXXX

Resulted in paths such as:

    creating: unzip_android_archive_Nt1XzgS5/android-P/

And sure enough, looking into `sdks/builds` it had created a directory in
the working directory, so it isn't using a path inside of `$TMPDIR`.

Changing the command to:

    mktemp -d -t unzip_android_archive_XXXXXXXX

Resulted in paths such as:

    creating: /var/folders/nx/rzr6lcqj6j3_vp7vtp28v2cw0000gn/T/unzip_android_archive_W247QkyW/android-P/

The StackExchange post mentions `-t` is a "prefix" that gets expanded to
`$TMPDIR/{prefix}.XXXXXXXX`, so I think it is better to use this option as
long as it works on all platforms.
2018-04-30 12:47:23 -04:00
Rodrigo Kumpera fe21aad1df [build] Disable make builtin rules for the runtime build. This speeds up a no-changes build by ~25%. (#2280) 2018-04-30 11:39:34 -04:00
Jo Shields 43b1ec5bfa Add @directhex to CODEOWNERS for packaging-related stuff (#8517)
At the very least, this way I get pinged when we bump Gtk# or MSBuild or something, so I can work on the Linux equivalent
2018-04-30 10:54:06 -04:00
Jay Krell 5d7ce8cc0d [Coop] Convert Microsoft.Win32.NativeMethod to coop. (#8508)
[Coop] Convert Microsoft.Win32.NativeMethod to coop.

These are all pretty trivial. There are no pointers or handles.
The only small wrinkle is internal calls -- split the function into w/ and w/o MonoError*.
2018-04-30 16:25:16 +02:00
Jo Shields 31074b1958 Merge pull request #8489 from directhex/mminimal-toc
Doesn't compile with Clang on ppc64el
2018-04-30 10:03:42 -04:00
Vlad Brezae 4a5a668c51 [interp] Fix vtype ldfld from another vtype (#8496)
CEE_LDFLD replaces at the top of the stack the object/valuetype one of its fields. MINT_LDFLD_VT loads a valuetype field from the object/valuetype at the top of the stack. When loading a field from a valuetype, at the end we also did a MINT_VTRESULT to pop the vtspace. If previously we were loading also a valuetype, then, when popping the original valuetype, we discard memory from the loaded field. With this change, we use 2 MINT_VTRESULT, one to pop the loaded field and second to copy it in place of the original valuetype.
2018-04-30 08:44:18 -04:00
Aleksey Kliger (λgeek) 632a929962 [profiler] Do GC state transitions in profiler helper threads. (#8497)
* [threads] (windows,mach) If a thread self-suspended, initiator shouldn't wait

Under hybrid suspend if the suspend initiator raced with
done_blocking/abort_blocking, then the thread self-suspended and is already
waiting for the resume semaphor - there's nothing else for the suspend initiator
to do, so don't add victim to the pending operation set.

* [profiler] Do GC state transitions in profiler helper threads

After the calls to `profiler_thread_check_detach`, the GC doesn't skip
the profiler helper threads anymore (because of the call to
`mono_thread_info_set_flags (MONO_THREAD_INFO_FLAGS_NONE)`.

Under hybrid or full cooperative GC, the helper threads in GC Unsafe
mode should not block without periodically polling.  Otherwise we get
into a deadlock on shutdown when finalizing the root domain:  The profiler
threads have been told to detach and we run a GC in preparation for
running the finalizers.  The GC STW ends up waiting for the dumper and
writer threads which never self-suspend.
2018-04-30 08:24:05 -04:00
Bernhard Urban 89ecd02722 [interp] enable more corlib tests (#8367)
* DecimalTest
* DecimalTestMicrosoft
* ExceptionTest
* PartitionerTests
* TypeBuilderTest
* DynamicMethodTest
* MethodBuilderTest
* ContextTest
* SynchronizationAttributeTest
* RealProxyTest
* DriveInfoTest
* TimeZoneTest
* ConvertTest (except 1)
* DelegateTest (except 3)
* TypedReferenceTest
* TypedReferenceCas
* RegistryKeyTest
* ExceptionDispatchInfoTest
* MarshalTest

https://github.com/mono/mono/issues/7053
2018-04-28 09:13:11 +02:00
Jay Krell 730a50a06d [Coop] Convert thread interrupt, resume, join, cleanup raising ThreadState exceptions. (#8479)
* style - (void) vs. (), favor (void) in C; function names at start of line for grep ^foo

* [Coop] Convert ves_icall_System_Threading_Thread_Resume to coop.
Cleanup three instances of "Thread has not been started, or is dead.".
Move raising exception (on current thread) outside of locking of resuming thread.
  Keep lock hold times shorter.

* [Coop] Convert ves_icall_System_Threading_Thread_Interrupt_internal.
Cleanup uses of ThreadStateException.
2018-04-27 21:02:34 -07:00
Mikhail Filippov 862336c663 Add option to MONO_DEBUG to store thread dumps by SIGQUIT on disk (#8358)
I added an option to allow storing a "thread dump" of the running program into a file in the specified directory. It is useful when you need to understand what is going on in your application and you cannot capture stdout or attach a debugger.
2018-04-28 01:29:19 +02:00
Aleksey Kliger (λgeek) 7c4f7c0684 [metadata] Add mono_assembly_get_assemblyref_checked (#8468)
Replace bounds check assertions of mono_assembly_get_assemblyref (and
everything that it calls) by Bad Image MonoErrors.

Call from System.Reflection.Assembly.InternalGetReferencedAssemblies to cope
with malformed images
2018-04-27 18:18:17 -04:00
Bernhard Urban cee577b36a [interp] clear exception fields only if it is a real exception object (#8491)
Storytime: With https://github.com/mono/mono/pull/8367 we tried to enable more tests to be run on CI regarding our corlib tests. However, this test crashed:

https://github.com/mono/mono/blob/9b702e8052f6d888febe4e74dfea4d8388c1706e/mcs/class/corlib/Test/System/StringTest.cs#L4473-L4477

which was _weird_ because the test was enabled before and worked.

So what is the test doing? It compares `String.Empty` and `""` to be the same object. Empty string is special in two ways:
* It's an interned string. Per domain we have a hash table that manages interned strings: https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mono/metadata/domain.c#L429
* We create an empty string instance per domain on domain creation: https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mono/metadata/appdomain.c#L197-L202

Therefore, I claim this must be true at every point in time after domain creation:
```c
  domain->empty_string == mono_g_hash_table_lookup (domain->ldstr_table, domain->empty_string)
```

I put this condition at a few points in the interpreter main loop, and indeed, at a certain point this condition isn't true anymore. With further debugging I noticed that this violation happens after a rehash of `ldstr_table`. So it means we have suddenly two empty string objects in the table, how can this be? An insertion of a second empty string object wouldn't work.

My initial guess was that some corlib test is doing some dirty unsafe business on interned strings, but it wasn't that obvious unfortunately.  What happened was the following: In this test a string gets loaded and is then thrown as an exception:
https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs#L626-L629

When this IL is executed we hit this code:
https://github.com/mono/mono/blob/8d1c93e563b98f83f8b7e3596eef7afd01422ead/mono/mini/interp/interp.c#L694-L697

but wait! `ex` is a `MonoString` not a `MonoException`, really. Urgh. In this specific situation the offset of `->trace_ips` points beyond `ex`, that is, into the next object in the heap. Which, "by accident", is a interned string too and exactly nulls out the first few characters of the string. So there we have our second empty string in our hash table.

That is obviously wrong. And we have a test case for this:
https://github.com/mono/mono/blob/f024bb5f595c85388b1495c7a5247486327ecede/mono/mini/iltests.il#L2607-L2620

Alas it's disabled 😁 (as a matter of fact, it's one of the two disabled tests for the interpreter in the mini regression test suite). The reason why this test wasn't enabled is because with the old exception handling we didn't wrap such objects into an exception object. The exception handling implementation has changed and now shares it with the JIT which does the wrapping. We still missed a check which is added by this commit.
2018-04-28 00:10:48 +02:00
Rodrigo Kumpera 5136a60cf4 Improve --compile-all error message and a round of verifier cleanups. (#7048)
* [runtime] If a MonoError was set, display its message.

* [verifier] Cleanup the metadata verifier interface to use MonoError instead of the old GSList hack.
2018-04-27 15:42:40 -04:00
Jay Krell f024bb5f59 Fix Windows STDOUT_FILENO, STDERR_FILENO, that are probably not used. (#8482) 2018-04-27 11:53:01 -04:00
Jay Krell 6e72f54663 Fix Win32 G_GSIZE_FORMAT to be %u consistent with other 32bit platforms instead of %d. (#8481)
Fix Win64 G_GSIZE_FORMAT, assuming Microsoft C runtime, old or new, or
 others compatible with it, i.e. last century I64 instead of newfangled ll.
2018-04-27 11:52:07 -04:00
Jo Shields bec38ae243 Fix building with clang on PowerPC
Clang on PPC doesn't support `-mminimal-toc` and fails with an unknown flag due to our default CFLAGS. Try to detect Clang, and avoid that flag.
2018-04-27 11:03:32 -04:00
Jay Krell 8d1c93e563 Fix ThreadPoolTests.PerformanceCounter_WorkItems fails occasionally. (#8475)
Fix ThreadPoolTests.PerformanceCounter_WorkItems fails occasionally.
https://github.com/mono/mono/issues/8473
At least N work items, not exactly.
2018-04-27 00:33:59 -07:00
Jay Krell 20c06cc0f4 Cleanup instruction sizing and code reallocation. (#8436)
Runs of bumping `code` should be followed by calling set_code_cursor, every so often, or least when done.

Checks for enough room and realloc should be instead realloc_code.

Reads and esp. write of code_len, code_size, native_code should be relatively rare.
2018-04-26 20:05:17 -07:00
Joshua Peterson e11c793663 Expose two public types (#8470)
* Expose two public types

These types are public in the .NET 4.7.1 profile, so they should be
public in Mono as well.

* Bump API snapshot submodule
2018-04-27 03:10:30 +02:00
Alexander Köplinger bb7a6f2b1b [csproj] Fix mixed line endings 2018-04-27 03:01:28 +02:00
Jay Krell 72989f655c [Coop] Convert thread sleep, wait, interrupt. (#6639)
Coop ves_icall_System_Threading_Thread_Sleep_internal
Cleanup mono_join_uninterrupted.
Partial coop mono_thread_execute_interruption
Cleanup ves_icall_System_Threading_WaitHandle_Wait_internal.
2018-04-26 16:24:27 -07:00
Rodrigo Kumpera d4143269f2 [mini] Don't verify types if you store to a pointer byref. (#8411)
* [mini] Don't verify types if you store to a pointer byref. Workarounds #8403.

* [mini] Add regression test for punting a type system check.

* Fix variable names in test to match comments
2018-04-26 18:02:24 -04:00
Bernhard Urban 8479949bd0 [interp] enable mcs tests on armv7 (#8455)
there was a technical limitiation to run it reliably (aka. "the r8
problem"), which was resolved by https://github.com/mono/mono/pull/8056
2018-04-26 20:56:20 +02:00
Egor Bogatov bce083b1dc CoreFX: System.Json, System.ServiceModel.Syndication, System.Threading.Tasks.Dataflow (#8246)
Use corefx sources and tests for:
- System.Json
- System.ServiceModel.Syndication
- System.Threading.Tasks.Dataflow
2018-04-26 19:38:03 +02:00
Jo Shields 1320d75123 Fix typo causing make destdir to fail (#8465) 2018-04-26 16:44:00 +02:00
Daniel Becker 5e6e8682ad [System] Use Interrupt instead of Abort to shut down handler thread for kevent watcher (#2876)
The only place where the handler thread should block is in the
kqueue_notimeout() call; interrupting the thread should cause
that call to exit with EINTR, and allow the thread to exit.
2018-04-26 15:17:17 +02:00
Alexander Köplinger ebbe052ee5 [acceptance-tests] Fix missing file in EXTRA_DIST 2018-04-26 14:03:24 +02:00
Ankit Jain bfff07babc [msbuild] Bump to latest xplat-master (#8426)
.. which is now on the netcore2.x based build. Update build and test
scripts accordingly.
2018-04-26 13:28:22 +02:00
Jay Krell d0acdff625 [Tailcall] Fix patching of generic GOT under FullAOT. (#8445)
* [Tailcall] Fix the patching of GOT sites under FullAOT.
This fixes bug https://github.com/mono/mono/issues/8273 where FullAOT generic-shared (valuetype?) runs hundreds of times slower than regular AOT due to hitting the trampoline for every call.

[Coop] Fork test 8273.il from 3.il and increase iteration count
so it takes a long time previously.

Also possibly fix a JIT path where gshared but not gsharedvt handled.
2018-04-26 03:24:49 -07:00
Marek Safar 90d511c1bd Bump corefx (#8396) 2018-04-26 11:32:30 +02:00
Alexander Köplinger a70c4c25fa [ci] Check CI_TAGS instead of ghprbPullId 2018-04-26 11:12:37 +02:00
Vlad Brezae 3f352e22c4 [arm64] Set correct frame type for trampoline frames 2018-04-26 09:19:39 +02:00
Vlad Brezae 372b562df1 [arm64] Add unwind info for native to interp trampoline 2018-04-26 09:19:39 +02:00
Vlad Brezae 1207d58e3f [interp] Include lmf wrapper in aot image 2018-04-26 09:19:39 +02:00
Vlad Brezae bc225aca72 [interp] Interp entry trampoline for arm64 2018-04-26 09:19:39 +02:00
Jay Krell cc59ca89b6 [Tailcall] Better sizing of tailcalls, allow arm64 r4, copy arm64 stacked parameters (#8437)
Tailcall:
Remove arm32 limit of 64 bytes of stack usage. Limit it to 4K instead (12bit immediate displacement).
Remove arm64 limit of 0 bytes of stack usage. Limit it to 1G instead (32bit limit).
	i.e. copy arm64 stacked parameters
Limit x86 and amd64 stack usage to 1G (32bit limit).
Even as small as 100 is reasonable.

Add OP_TAILCALL_PARAMETER for more accurate earlier tailcall sizing,
	including of unbounded parameter lists.
	i.e. a certain number of bytes per parameter (including enregistered,
	which makes it an overestimate)

Allow arm64 to return r4 -- caller and callee must agree, which means
	caller's caller gets what it expects.

Add test coverage for large parameter list (256+).

Cleanup:
Introduce ins_get_size in place of ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
Use it in a few places. Replace PowerPC's ins_native_length with it.

Cleanup usage of EXTRA_CODE_SPACE vs. 16 -- EXTRA_CODE_SPACE everywhere.
This will get further cleaned up shortly.

Replace if (need to realloc code) with while (need to realloc code.
It is almost the same, but protects against degenerate very small code
where doubling is not enough (except for zero).

Use fsig we already have instead of another call to sig = mono_method_signature.
(for OP_TAILCALL and nearby existing code)
2018-04-25 22:47:26 -07:00
Jay Krell 3414da6f93 Fix warning about unused static table_sizes -- move it near ifdef'ed use. (#8452)
Fix warning about unused static table_sizes -- move it near ifdef'ed use.
2018-04-26 01:25:07 +02:00
Aleksey Kliger (λgeek) 40c13f7b0f [loader] Add loader contexts (#8326)
There are 4 different ways that an assembly can be loaded in .NET:
1. default context - `Assembly.Load(string)` does this.
2. reflection only context - `Assembly.ReflectionOnlyLoad` and `Assembly.ReflectionOnlyLoadFrom` do this.
2. load from context - `Assembly.LoadFrom(string)` does this. The interesting bit is that the assembly at the specified path is probed for its assembly name, and then binding redirects are applied to figure out if we need to load a different version of the assembly (from elsewhere in the search path, presumably).
3. "no context" (.NET Core's [AssemblyLoadContext](https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md) design doc calls it "custom context", and internally they implement it as `IndividualAssemblyLoadContext`) - in Mono I'm going to call it the "individual context".  This is what `Assembly.LoadFile(string)` and `Assembly.Load(byte[])` do: you get exactly the thing you asked for even if something with the same assembly name is already loaded and you get to have problems with type resolution.

So this PR adds:
1. `MonoAssemblyLoadContextKind` enum - default, refonly, loadfrom and individual.
2. Store the `MonoAssemblyLoadContext` in every `MonoAssembly` instead of a boolean `refonly` flag.
3. When loading references from assemblies, consider the load context of the requesting assembly.
4. Do the wacky `LoadFrom` probe and rebind dance.
5. Don't check for duplicated for the individual assembly context.

Not in this PR:

The managed assembly load context stuff in .NET Core.  If we eventually want to add it, it will likely build on this work, but it's not here now.

Details:

* [loader] Replace 'refonly' by an assembly load context (NFC)

   Replace MonoAssembly:ref_only field by a new context field of type MonoAssemblyContext (which right now just contains a single 'ref_only' boolean).

   The .NET Framework documentation describes for contexts for assembly loading:
   1. default context - Load(string) and referened assembly loading use this context.
   2. LoadFrom context - LoadFrom(string) and references from LoadFrom assemblies.
   3. reflection only context - ReflectionOnlyLoad and ReflectionOnlyLoadFrom use this.
   4. individual assembly context[footnote:1] - Used by Load(byte[]) and LoadFile(string)

   This commit only implements default context and reflection only context.  As such, there should be no functional change.

   [footnote:1]: Individual assembly context is called "no context" in the .NET
   Framework docs, but "individual" is what the .NET Core assembly load context
   implementation calls it.
   https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/assemblyloadcontext.md

* [loader] propagate MonoAssemblyContextKind instead of refonly, loader_from_context flags

   Instead of passing a pair of booleans around, pass a MonoAssemblyContextKind value.

   In System.Reflection.Assembly.LoadFrom, pass MONO_ASMCTX_LOADFROM, instead of default.

   In System.Reflection.Assembly.Load(byte[]), pass MONO_ASMCTX_INDIVIDUAL instead of default.

   In SRE, create new assemblies with MONO_ASMCTX_INDIVIDUAL or refonly

   Finally in mono_assembly_load_reference:

   For a LOADFROM context always include the requesting assembly's basedir when probing for references.

   For INDIVIDUAL context, don't probe for their references - they must be already loaded or else resolved by an AssemblyResolve event.

In a REFONLY context, only look at loaded assemblies or fire the
ReferenceOnlyAssemblyResolve event.

In a DEFAULT context, follow Mono's existing strategy: first probe without
including the basedir (and let the managed AssemblyResolve event fire), then
probe again with the basedir set (potentially firing the event again).

* [reflection] Implement System.Reflection.Assembly.LoadFile as a separate icall

   The difference between LoadFrom and LoadFile is that LoadFile should not look in the loaded assembly's basedir when resolving references.  (It is also not be subject to remapping).

   Also, for LoadFile never return a previously loaded assembly even if one with the same name is already cached by a domain.

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

   The changes to mono_assembly_load_from_predicate (in conjunction with using MONO_ASMCTX_INDIVIDUAL) for the LoadAssemblyRaw icall also fix https://bugzilla.xamarin.com/show_bug.cgi?id=11199 and https://bugzilla.xamarin.com/show_bug.cgi?id=33728

* [loader] Apply binding redirects to LoadFrom assemblies

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

* [loader] Include class failure cause in find_method_in_class TypeLoadException

* [loader] apply binding redirects to LoadFile() and Load(byte[])

   Same as LoadFrom: If the identity of the assembly matches a binding redirection, drop the currently opened image and go probing by name instead.

* [loader] Print assembly load context in debug traces

* [loader] Split up mono_assembly_load_full_nosearch

   There are two phases: first try the preload hook, second look in the gac, the given base directory, and in the default_path.

   Split out the second phase into its own function.

* [loader] Apply remapping and binding when looking for INDIVIDUAL asmctx references

* [loader] Probe the GAC and assemblies path for INDIVIDUAL asmctx

   Checked on .NET Framework 4.7.1

   Despite the documentation insisting that `LoadFile` does not do any probing for referenced assemblies, it seems that actually, assemblies from the GAC (or at least the framework Facade assemblies such as `System.Runtime`) are nonetheless loaded if no context assembly depends on it.

   This commit does the same thing for Mono (except we will additionally look in MONO_PATH).

   This makes the xunit console runner work:

   At startup they call LoadFile() on all the assemblies in the main executable's dir without doing anything to resolve the references.  Those LoadFile assemblies then have broken references to things like System.Runtime that should be in the GAC but that haven't been loaded yet.

* [tests] Add tests for Assembly.Load(byte[]), LoadFile and LoadFrom

   Test that loading two assemblies from two different paths (or byte arrays) with the same AssemblyName will produce different results if using Load(byte[]) or LoadFile() but will reuse the first assembly if using LoadFrom().

   Regression tests for:
   - https://bugzilla.xamarin.com/show_bug.cgi?id=11199
   - https://bugzilla.xamarin.com/show_bug.cgi?id=33728
   - https://github.com/mono/mono/issues/8149

* [tests] Check that binding redirects work for Assembly.Load(byte[]), LoadFile and LoadFrom

   In old version of .NET it was only supposed to work for LoadFrom, but now it should work for all three.

   Regression test for https://github.com/mono/mono/issues/8152

* [tests] Don't run Assembly.Load(byte[]) tests with AOT

* [aot] Make load_image return the aot module assembly for LoadFile

   LoadFile allows loading more than one assembly with the same name. That means that just calling mono_assembly_load is unlikely to find the correct assembly (it'll just return the first one loaded).  But we shouldn't hardcode the full assembly filepath into the AOT image, so it's not obvious that we can call mono_assembly_open_predicate.

   Fortunately, an assembly opened with LoadFile is supposed to only refer to already-loaded assemblies (or to GAC & MONO_PATH) assemblies - so nothing new should be loading.  And for the LoadFile'd assembly itself, we can check if the name and guid of the current AOT module matches the wanted name and guid and just return the AOT module's assembly.

* [mini] Fixup one MonoClass member access to use getter
2018-04-25 17:30:25 -04:00
Jay Krell c50808d259 check_call_signature return gboolean and run second time if break, to step through in debugger (#8434)
* If check_call_signature fails and we break on it, run it again, i.e. so you can
step in a debugger.

* Change check_call_signature to returning a boolean, albeit in the same perhaps backwards way.
2018-04-25 15:19:48 -04:00
Zoltan Varga dd652eee5a Fixed the --with-runtime-preset=bitcode build if no --enable-minimal option is given. (#8444)
Fixes https://github.com/mono/mono/issues/8439.
2018-04-25 14:20:53 -04:00
Alexander Köplinger c993f55dab [System.ServiceMode] Disable test on mobile
The other BugXXX.cs tests are disabled there too.
2018-04-25 19:24:46 +02:00
Alexis Christoforides a16dfeeb75 Disable a flaky test
https://github.com/mono/mono/issues/8450
2018-04-25 13:00:56 -04:00
Egor Bogatov 965f7aef2a [corlib] ConcurrentExclusiveSchedulerPair from corefx (#8040)
These types were not replaced with corefx in #6672
2018-04-25 15:51:00 +02:00
Alexander Kyte 2e94082332 [runtime] Add llvm aot mode with graceful fallback (#8348) 2018-04-25 08:55:41 -04:00
Vlad Brezae 31202f5a38 [interp] Enter in the interp through a single generic trampoline (#8056)
* [arm] Create trampoline for passing fixed arguments

It is the same as static rgctx trampoline, but it clobbers ARMREG_IP

* [arm] Create trampoline for native to interp transition

* [arm] Add interp entry from trampoline

Tweak CallContext methods to work in opposite direction

* [interp] Create wrapper that saves lmf for m2i transitions

If we want to unwind from interpreter directly into managed code we need to have a wrapper whose purpose is to save the lmf, so we can start unwinding frame by frame.

* [arm] Add unwind info for interp entry trampoline

We need to unwind through this trampoline since it sits between jitted code and the interp lmf wrapper.

* [interp] Let the unwinder unwind through trampolines

These frames are still ignored (by EH and stack walking), they are only used for unwiding further to the caller.
2018-04-25 13:56:16 +03:00
Bernhard Urban b4aa69f728 [interp] initialize vtable of static fields 2018-04-25 01:26:23 +02:00
Rodrigo Kumpera 31d1b65092 [wasm] Add bidi binding for Promise/Task. 2018-04-24 16:18:32 -04:00
Ludovic Henry 863e1f13ee Update ISSUE_TEMPLATE.md (#8440) 2018-04-24 21:10:21 +02:00
Jay Krell 8b24f2e537 [Coop] Abort_internal and ResetAbortNative to coop/handle. (#8435)
[Coop] Abort_internal and ResetAbortNative to coop/handle.

* [Coop] Add some comments.

* [Coop] Convert thread abort and interruption to coop/handle.

* [Coop] Convert ves_icall_System_Threading_Thread_ResetAbort to coop/handle.

* Make mono_set_pending_exception_handle static.

* [Coop] mono_join_uninterrupted: Avoid creating handles in loops.
2018-04-24 11:22:54 -07:00
Ankit Jain 963f94474e [runtime] Setup stack trace for use in exception filters too (#8241)
If we have
	`catch (Exception e) when (SomeMethod (e))`

.. then the exception object received in `SomeMethod` has an empty
trace. This is because in `handle_exception_first_pass` we populate the
trace in `MonoException` object only at the "end":

	- filter returns TRUE
	- exception caught
	- unhandled exception

But if we have a filter then the trace at that point needs to be
accessible. And if the filter fails then as we unwind more frames, the
earlier frames (`trace_ips`) need to be retained to get the correct full
trace.

`dynamic_methods` needs to be handled similarly and in
`setup_stack_trace` we need to add to the existing `dynamic_methods` in
the MonoException object.

Fixes https://github.com/mono/mono/issues/7649 .
2018-04-24 14:20:03 -04:00
Alexander Köplinger baef8453a8 [Mono.Profiler.Log] Use AssertExtensions for comparison asserts (#8406)
`Assert.True (actual >= expected)` doesn't log useful information when
the condition is false, making it hard to see what went wrong:

https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/8525/testReport/junit/Test%20collection%20for%20MonoTests.Mono.Profiler.Log/ProfilerTests/MonoTests_Mono_Profiler_Log_ProfilerTests_MonitorEventsAreRecorded/

Unfortunately xUnit doesn't provide a built-in comparison assert but
CoreFX already built one so we can just use that one.
2018-04-24 14:13:16 -04:00
Bernhard Urban 1c4eb6142b [sgen] unbreak build when SGEN_HEAVY_BINARY_PROTOCOL is set (#8418)
ilgen changes messed up the defines.
2018-04-24 13:43:52 -04:00
Jay Krell b7e9c69402 Report more information in debugger for assertion failures etc. (#7932)
And cleanup a little.

32 times:
gdb:
 info registers
 info frame
 info locals
 up

lldb:
 reg red
 frame info
 frame variable
 up
2018-04-24 13:42:00 -04:00
Bernhard Urban 10becf2710 [interp] reduce amount of native frames in debug builds 2018-04-24 18:22:37 +02:00
Alexander Köplinger 3bb0e113fa [Mono.Profiler.Log] Fix log-profiler-test.exe compilation with mcs
mcs raises a warning which is turned into an error by `/warnaserror`.
Only set that option when we're building with csc.
2018-04-24 13:03:17 +02:00
Alexander Köplinger 30282554bd [acceptance-tests] Bump coreclr to fix #8422 (#8427)
Fixes https://github.com/mono/mono/issues/8422
2018-04-24 12:48:50 +02:00
Zoltan Varga 6457e4018f [arm] Fix a regression introduced by: (#8413)
[watch] Align cinfo->stack_usage to 16 on watchos. (#8354)

Fixes https://github.com/mono/mono/issues/8409.
2018-04-24 03:54:35 -04:00
Marek Safar 5edc0db0c6 [corlib] Clean up .sources files (#8389)
* [corlib] Clean up .sources files

* [csproj] Update project files
2018-04-24 00:09:09 +02:00
Marek Habersack e609d3c25e Use g_print to dump threads when SIGQUIT is sent to Mono (#8385)
printf, fprintf don't work on Android, using g_print will redirect the output to
mono-stdout so that it can appear in Android logcat output.
2018-04-23 18:03:04 -04:00
Bernhard Urban 0ccaa5acdd [interp] add System tests to CI (#8370)
https://github.com/mono/mono/issues/7053
2018-04-23 18:02:42 -04:00
Jay Krell 5a58157c51 [tailcall arm64] Add tailcall_reg support for arm64. (#8390)
* [Tailcall] Print more. Clarify printing. Dial back a fix by one line
until a test demonstrates it is required.
Move debug_tail up for easier editing.

* [Tailcall arm64] Add tailcall_reg support.

* Fix new warning about  maybe-used-uninitialized -- moving variables down is incompatible slightly with goto around them.
2018-04-23 20:59:12 +02:00
Jo Shields d4574fcf11 Turn off BTLS assembly optimizations on 32-bit ARM. (#8366)
See https://github.com/mono/mono/issues/8100
2018-04-23 12:57:39 -04:00
Bernhard Urban ffdb072fdf [interp] add System.Core tests to CI (#8371)
https://github.com/mono/mono/issues/7053
2018-04-23 12:52:07 -04:00
Bernhard Urban a5a355b4f0 [interp] box_not_clear_vt_sp must be checked for right element on the stack (#8365)
it was checking always top-of-stack before.

https://github.com/mono/mono/issues/7053
2018-04-23 16:33:54 +02:00
Alexander Köplinger 30c51f88a8 [System] Temporarily disable failing TypeDescriptorTests on FullAOT (#8408)
See https://github.com/mono/mono/issues/8407
2018-04-23 15:55:47 +02:00
Rodrigo Kumpera bf80d5ad2d Add delegate marshaling. 2018-04-21 22:19:02 -04:00
Alexis Christoforides 7ce681a7fe Merge pull request #8346 from mono/macsdk-update-llvm
[MacSDK] Update LLVM to head of mono/llvm's master
2018-04-21 15:23:43 -04:00
monojenkins 2f08c620b7 [msvc] Update csproj files (#8392) 2018-04-21 09:53:54 -07:00
Zoltan Varga 3783e078f9 [runtime] Handle failed classes in mono_type_get_checked (). (#8318)
* [runtime] Handle failed classes in mono_type_get_checked (). Fixes https://github.com/mono/mono/issues/8311.

* [runtime] Use m_class_has_failure ().

* [runtime] Set the error if the class has a failure.
2018-04-21 02:32:20 -04:00
Egor Bogatov 09de0b9e1b [System] ComponentModel and System.Net from corefx (#7948)
* ComponentModel from corefx

* System.Net.Mail from corefx

* update SR.cs

* fix build error

* fix tests

* undo run-test-default.sh change

* update corefx

* fix failing tests

* hide DesignerAttribute on mobile profiles

* Bump API snapshot submodule
2018-04-20 22:04:39 -07:00
Rodrigo Kumpera b8a19e5d02 [wasm] Add JSObject::Invoke. 2018-04-20 21:10:36 -04:00
Alexander Köplinger f93b967327 [corlib] Bump allowed diff time in FileTest.LastWriteTimeSubMs
I've seen it fail with this:

```
1) LastWriteTimeSubMs (MonoTests.System.IO.FileTest.LastWriteTimeSubMs)
     Iteration #22 failed, diff.TotalSeconds: 1.000023, untouched: 20:14:03:0000000, now: 20:14:04:0000230
  Expected: True
  But was:  False
```
2018-04-21 00:51:28 +02:00
Ludovic Henry f9a77468d1 [ci] Add jit_llvm configuration (#8317) 2018-04-20 17:49:13 -04:00
Alexander Kyte 24ef42576f [runtime] Add a signal handler for sigterm (#8240)
* [runtime] Add a signal handler for sigterm

* [runtime] Register sigtramp when merp handler enabled

* [runtime] Limit sigterm handler symbol definition to OSX
2018-04-20 16:14:09 -04:00
Ludovic Henry e78cae2f38 [sdks] Match more closely the pre-SDKs configure flags passed to LLVM (#8379) 2018-04-20 16:03:31 -04:00
Rodrigo Kumpera 41dae93cb6 [wasm] More tests. 2018-04-20 15:35:11 -04:00
Rodrigo Kumpera ac3d73c140 [wasm] Sample binding with bidi comms 2018-04-20 15:07:20 -04:00
Alexis Christoforides 3b700c8e2c [MacSDK] Update LLVM to head of mono/llvm's master 2018-04-20 14:12:46 -04:00
Zoltan Varga 3106c27291 [watch] Align cinfo->stack_usage to 16 on watchos. (#8354)
Fixes https://github.com/mono/mono/issues/7685.
2018-04-20 13:38:04 -04:00
Rodrigo Kumpera 57b2b6960d [wasm] Implement minimal bidirectional object binding. 2018-04-20 12:41:24 -04:00
Rodrigo Kumpera 976cd1b45d [wasm] binding improvements. 2018-04-20 12:41:17 -04:00
Rodrigo Kumpera 9763bd75b7 [wasm] Address reviewer feedback. 2018-04-20 12:40:32 -04:00
Bernhard Urban 8d30d41909 [interp] fix warning introduced with 8e0a12189a (#8359)
```
interp/transform.c:2870:44: warning: cast to 'gpointer' (aka 'void *') from smaller integer type 'guint32' (aka 'unsigned int') [-Wint-to-void-pointer-cast]
                                ADD_CODE (td, get_data_item_index (td, (gpointer) token));
                                                                       ^
```
2018-04-20 12:06:28 -04:00
Bernhard Urban 9b47d566ae [System.Net] do not use Thread for SocketTest.TestSelect1 (#8364)
it makes the test less reliable. Potentially helps with
https://github.com/mono/mono/issues/8360
2018-04-20 11:57:57 -04:00
jaykrell 736683e77d [Tailcall amd64] Use calli/tailcall_reg in method-to-ir for F# FullAOT. (#8265)
* [Tailcall] Use tailcall_reg to tailcall internal `calli` to improve F# FullAOT tests.

Rework printing a bit and add more.

Split mini_emit_calli into mini_emit_calli and mini_emit_calli_full.
mini_emit_calli_full takes an extra tailcall parameter.
This enables fixing some F# tests.

`check_sp` inhibits tailcall -- share logic and assert --  in order
	to only call `is_supported_tailcall` once.

mono_emit_call_args is big and probably shouldn't be inlined; let compiler decide
anyway, which it always does.

Significant reworking of is_supported_tailcall.

	Have it compute "regular" and "calli".

	Replace is_interface with imt_arg which should be a more accurate
	representation of the important part.

Capture complex conditionals `virtual_generic` and `virtual_generic_imt`
into local variables, so they can be evaluated a second time,
so that `is_supported_tailcall()` can be called just once with its
final inputs.

Move `tailcall` and `tailcall_calli` `tailcall` down
to initialization and make them const (with a temporary/internal non-const).

Note that tailcall still gets changed/reevaluated in multiple places,
and the new value is not returned. One such duplication is the form
of shared logic and an assert (check_sp), the other (calli + llvmonly) is not.

The correct value is needed, sometimes, for e.g. remove_ret.
There also remains a path that appears to change it to false but true in `ins`.
2018-04-20 08:18:22 -07:00
Bernhard Urban 384c4a4e2e [mini] fix some warnings with newer GCC (#8308)
* [interp] fix warning

```
interp/interp.c: In function ‘ves_real_abort’:
interp/interp.c:251:17: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=]
   printf ("\t[%ld] 0x%08x %0.5f\n", sp-stack, sp[-1].data.i, sp[-1].data.f);
               ~~^                   ~~~~~~~~
               %d
```

* [mini] ignore GCC warning in trace.c

```
trace.c: In function ‘mono_trace_enter_method’:
trace.c:145:3: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address]
   printf (") ip: %p\n", MONO_RETURN_ADDRESS_N (1));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

* [tramp-x86] remove unused function

```
tramp-x86.c:171:1: warning: ‘get_vcall_slot_addr’ defined but not used [-Wunused-function]
 get_vcall_slot_addr (guint8* code, mgreg_t *regs)
 ^~~~~~~~~~~~~~~~~~~
```

* [mini-x86] remove unused function

```
mini-x86.c:6327:1: warning: ‘emit_load_aotconst’ defined but not used [-Wunused-function]
 emit_load_aotconst (guint8 *start, guint8 *code, MonoCompile *cfg, MonoJumpInfo **ji, int dreg, int tramp_type, gconstpointer target)
 ^~~~~~~~~~~~~~~~~~
```

* [tramp-x86] remove unused function

```
tramp-x86.c:146:1: warning: ‘get_vcall_slot’ defined but not used [-Wunused-function]
 get_vcall_slot (guint8 *code, mgreg_t *regs, int *displacement)
  ^~~~~~~~~~~~~~
```

* [mini-x86] change previous_lmf to pointer type (same as amd64)

```
mini-runtime.c: In function ‘mono_push_lmf’:
mini-runtime.c:806:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  ext->lmf.previous_lmf = *lmf_addr;
                        ^
mini-runtime.c:808:24: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
  ext->lmf.previous_lmf = (gpointer)(((gssize)ext->lmf.previous_lmf) | 2);
                        ^
mini-exceptions.c: In function ‘arch_unwind_frame’:
mini-exceptions.c:420:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    *lmf = (MonoLMF *)(((guint64)(*lmf)->previous_lmf) & ~3);
           ^
mini-exceptions.c: In function ‘unwinder_unwind_frame’:
mini-exceptions.c:715:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      *lmf = (MonoLMF *)(((guint64)(*lmf)->previous_lmf) & ~7);
             ^
```

* [monolmf/x86] make int cast dependend one machine word size

```
In file included from debugger-agent.c:36:0:
debugger-agent.c: In function ‘get_top_method_ji’:
debugger-agent.c:2501:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   g_assert (((guint64)lmf->previous_lmf) & 2);
              ^
../../mono/eglib/glib.h:710:46: note: in definition of macro ‘G_UNLIKELY’
 #define G_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0))
                                              ^~~~
debugger-agent.c:2501:3: note: in expansion of macro ‘g_assert’
   g_assert (((guint64)lmf->previous_lmf) & 2);
   ^~~~~~~~
```

* [interp] remove unnecessary code

* [mini] fix ptr with int cmp

this was wrongly changed.

```
mini-exceptions.c: In function ‘unwinder_unwind_frame’:
mini-exceptions.c:702:33: warning: comparison between pointer and integer
   if (unwinder->last_frame_addr > (gsize)(*lmf)) {
                                 ^
```
2018-04-20 14:27:47 +02:00
Niklas Therning cc3666fa8d Remove unused signal.h include in interp.c (#8334)
This include breaks compiling the interpreter on platforms which don't have a
signal.h. The code in interp.c doesn't seem to need it to be included anyway.
2018-04-20 00:38:07 -04:00
Alexis Christoforides fb3f745e34 Merge pull request #8357 from akoeplinger/fsharp-fixes
[packaging] Apply F# patch that fixes #8310
2018-04-20 00:27:39 -04:00
Bernhard Urban 8127483e8a [interp] remove useless assert in mint_newobj
Fixes https://github.com/mono/mono/issues/8329. That is, make the
interpreter work on Windows.
2018-04-20 04:25:09 +02:00
Alexander Köplinger d0db2e0ab0 [packaging] Apply F# patch that fixes #8310
Upstream patch is at https://github.com/fsharp/fsharp/pull/844
2018-04-20 01:05:07 +02:00
Ludovic Henry a5fc6c9f0f [corlib] Disable failing test on XA (#8351)
This follows https://github.com/mono/mono/commit/64ec2dd3eb1309b84819b34c4279d946acacd082.
2018-04-19 21:34:21 +02:00
Rodrigo Kumpera 81aec9f693 [wasm] Fix CI target and npm install to be local. (#8339)
* [wasm] Fix CI target.

* [wasm] Switch to do a local install of npm packages.

* [wasm] Switch to fine-grained execution steps to avoid VM bugs.

* [wasm] Disable System.Core under Chakra as the JS engine crashes.
2018-04-19 20:51:16 +02:00
jaykrell 967b596735 [Tailcall] Add some tests derived from F# code to be used soon. (#8333)
Includes case for https://github.com/mono/mono/issues/8273 where
FullAOT is hundreds of time slower than AOT or JIT (under a second vs. 9 minutes).
2018-04-19 20:23:46 +02:00
jaykrell cb83034748 [Tailcall] Remove OP_JMP support. Require OP_TAILCALL. (#8327)
* [Tailcall] Remove OP_JMP support. Require OP_TAILCALL.
This only hurts mips and sparc -- it breaks them.
Remove front end support for OP_JMP and conditionalality of OP_TAILCALL.

* And remove MONO_ARCH_HAVE_OP_TAILCALL and require mono_arch_tailcall_supported.

* And tailcall_remove_ret becomes temporarily irrelevant.

* [Tailcall] Keep mips and sparc working, albeit never tailcalling.

* Remove jmp opcode too.
2018-04-19 11:05:45 -07:00
jaykrell 30f431a880 Shrink or eliminate small local arrays. (#8331) 2018-04-19 20:03:43 +02:00
jaykrell ba75323553 [jit] Add tailcall_reg common and amd64 support, to be used soon (#8332)
for F# FullAOT.

Add some FIXMEs about alignbment and possible
improvements (fixed size rep mov to move tailcall parameters).

Grow static unknown sizes to 255.
2018-04-19 12:13:18 -04:00
Rolf Bjarne Kvinge a9eac69ffc [sdks] Wrap configure to provide better output. (#8306)
* [sdks] Wrap configure to provide better output.

Wrap configure in a script that:

* Captures stdout/stderr and only shows it in case of errors.
* If configure fails, and a cache file was used, deletes the cache file and
  tries again.
* If configure really fails, then print config.log in addition to
  stdout/stderr, since a lot of valuable diagnostic output is in that file
  (and it's annoying to track down configure failures on bots when the file
  with the important output has already been deleted).

* Only show config.log when running on bots.
2018-04-19 11:20:25 -04:00
Zoltan Varga cd075b31b1 [aot] Avoid making the plt labels referenced by the llvm generated code temporary, since they need to be accessed from another object file. (#8330) 2018-04-19 11:08:11 -04:00
Alexander Köplinger 9c6d95d9eb [mini] Fix mini-ppc.c build, missing semicolon 2018-04-19 15:41:52 +02:00
Andoni Morales Alastruey 0450dc0785 * [System.ServiceModel.Discovery] Fix messages validation to fix bug #46917 (#3772)
* [System.ServiceMode] Create unit test for #46917

* [System.ServiceModel.Discovery] Fix messages validation

The current validations are not correct and throws an exception calling
GetVideoSources API in an ONVIF media client. This API
is a combination of a first message with an input parameter and
a second message with the reply that is not void.
Removing this checks makes the client work correctly.

Fixes #46917
2018-04-19 13:54:32 +02:00
Aleksey Kliger (λgeek) 006d6ce097 [threads] Check that thread is in a valid suspend state before notifying (#8281)
* [threads] Check that thread is in a valid suspend state before notifying the initiator.

* [threads] Suspend running threads cooperatively in coop or hybrid suspend

Reverts an inadvertant change from 282ee4bfd7

* [checked-build] Add a mutex in collect_backtrace

GNU libc backtrace() calls _Unwind_Backtrace in libgcc which internally may
take a lock.

That allows for a deadlock situation where two threads try to call collect_backtrace and
one of them takes the lock and is async suspended with the lock held, while the
other is supposed to cooperatively suspend but it is blocked waiting for the
backtrace mutex.

The suspend initiator ends up waiting indefinitely for the threads to suspend,
and the runtime hangs.

As a workaround we add a mutex around the call to backtrace() and only collect
a backtrace if we can immediately grab the lock without contention.

* [threads] Drop DoneBlockingNotifyAndWait & AbortBlockingNotifyAndWait

These two actions were causing a race in hybrid suspend.
Suppose thread T is in blocking and thread S (suspend initiator) wants it to
suspend:

S sets T to BLOCKING_SUSPEND_REQUESTED and sends a suspend signal and waits for
pending operations.

T continues running and comes to exit the GC Safe region.

T executes done_blocking and transitions to BLOCKING_SELF_SUSPENDED and returns
  DoneBlockingNotifyAndWait.

T notifies S; T waits for a resume.

S wakes up, does whatever it needs to do and resumes T - T goes from
BLOCKING_SELF_SUSPENDED to RUNNING.

T wakes up and finishes the done blocking transition.

Suspend signal finally arrives in T. T attempts finish_async_transition from
RUNNING.  Assertion. Crash.

What we do in this commit is change done blocking not to notify the initiator.
Instead done blocking immediately waits for a resume.

In that case T is waiting for a resume in BLOCKING_SELF_SUSPENDED, and S is
waiting for pending operations.  So when T's suspend signal handler runs, it
will return FALSE (raced with self suspend), send a notification to the
suspend initator, and then immediately return. T then will continue waiting for
the resume. S will wake up, do what it needs to do and switch T to RUNNING and
post the resume to wake it.
2018-04-19 07:28:14 -04:00
jaykrell d708487b3f [Tailcall] Remove outdated references to OP_JMP that only make the code harder to understand. (#8315) 2018-04-18 23:35:54 -04:00
Ludovic Henry 39c42f577c [sdks] Fix mktemp parameters (#8322) 2018-04-18 19:14:34 -04:00
hharyono 95e69bc032 [WindowsBase] Fix ZipPackage.WriteContentType when extension is empty. (#4943)
When a part without extension was added an empty Extension attribute was written, which is incorrect and didn't match the Windows/.NET implementation:

![xml result](https://cloud.githubusercontent.com/assets/28587808/26567052/52c49378-4522-11e7-8bfc-f3dfa966b9b5.png)
2018-04-19 01:04:54 +02:00
jaykrell e721a73479 Fix warning: function declaration isn’t a prototype () vs. (void). (#8301)
class-inlines.h:13:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
  mono_get_void_type ()

In C: () means accept any parameters -- K&R unprototyped
      (void) is new-standardized-in-1989 form meaning accept no parameters

In C++ this is fixed and they mean the same thing -- accept no parameters.

To accept any parameters in C++, use (...), which is not valid in C, C requires
  at least one fixed-type parameter when you use "...".

() is very rarely what you want in C, or in C++ headers consumable from C.

If you do need () for highly unusual code, for a function that accepts anything,
and has no fixed parameters, then use ifdef __cplusplus and ... for C++.

printf for example does not fit in this bucket because it always has the const char *format.

In fact, it is so rare because a variable-argument ("varargs") function would need *some* way to decide what is in "...".
2018-04-19 00:58:50 +02:00
Rodrigo Kumpera 848d59880e [wasm] Build bcl bits serially to avoid parallel hazzards. (#8313) 2018-04-19 00:33:28 +02:00
Hugh Bellamy 4bd60ea895 Fix Gdi+ WrongState exception type and remove incorrect test for GdiPlus status code (#8276)
* Fix Status.WrongState exception

* Remove invalid test for GdipLockBits

* Fix LinearGradientBrush behaviour to match netfx/netcore
2018-04-18 17:43:14 -04:00
Bernhard Urban 42d425cb62 [corlib] add sanity check to filetest for last access modification time 2018-04-18 20:37:31 +02:00
jaykrell 3815cde68c Fix mono_perfcounter_instance_exists to match prototype when #ifndef DISABLE_PERFCOUNTERS. (#8302) 2018-04-18 09:34:50 -07:00
Alexander Köplinger bd3d33e39f [mini] Fix build for ENABLE_LLVM, missing semicolon 2018-04-18 13:49:54 +02:00
jaykrell e97721555e Teach sn.exe about PE32+, and while there ROM images and MS-DOS-less images. (#8232)
* Teach sn.exe about PE32+, and while there ROM images and MS-DOS-less.
See https://github.com/mono/mono/issues/8218.

* Make Error static.

* Remove .Close () redundant with using.

* Use helper function ReadMore and System.Array.Resize.

* Fix typos in comment.

* Move hash.Hash to fix 'Hash must be finalized before the hash value is retrieved.'.

* Cleanup.
2018-04-18 05:47:38 +02:00
iamphi 96a089ae5e Fix Automatic Proxy Configuration protocol for OSX 10.13 (#8227)
* Fix Automatic Proxy Configuration protocol for OSX 10.13

Reference comparison of kCFProxyTypeAutoConfigurationURL doesn't work in 10.13. Added fallback to do value/string comparison to get proxy type

* Change string comparison from C# string to CFString for possible memory safety and efficiency

* Code style changes
2018-04-17 22:34:00 -04:00
Sebastien Pouliot b8fa6a1519 [mono-api-html] Fix markdown diff which was reversed (#8285)
The previous code would produce

```diff
-public const string Version = "11.11.0";
+public const string Version = "11.9.1";
```

instead of

```diff
-public const string Version = "11.9.1";
+public const string Version = "11.11.0";
```

when diff are inlined. The addition and removal sections are fine.
2018-04-17 22:30:27 -04:00
Alexander Köplinger b6d2fb13cf [corlib] Fix TimeZoneInfo.Local when /usr/share/zoneinfo is a symlink (#8283)
We'd be using the path verbatim to compare with the resolved value of
/etc/localtime but if it's a symlink (like on OSX 10.13+) the comparison failed.

The fix is to resolve any symlinks for /usr/share/zoneinfo too.

Fixes https://github.com/mono/mono/issues/8267 and https://github.com/xamarin/maccore/issues/628
2018-04-17 22:29:51 -04:00
Rodrigo Kumpera 6d4220767d [WASM] Fix OSX & linux build plus a new test failure in mini. (#8289)
* [wasm] Fix build scripts to work on linux.

* [wasm] Force emscripten version to 1.37.36 to fix OSX breakage.

* [wasm] Fix failure in new FloatF test.

* [wasm] Fix detection of test failure.
2018-04-17 22:28:52 -04:00
Jo Shields ed30706c31 Fix building of LOADED_LLVM on Linux, from duplicate eglib linking (#8287) 2018-04-17 22:27:44 -04:00
Bernhard Urban a56d0f87c0 [w32file-unix] fix mistake in 8430155946 (#8293)
commit message said
> [w32file-unix] convert nano seconds to microseconds properly, by using
> TICKS_PER_MILLISECOND (which has L suffix in its definition)

first it talks about microseconds, but then uses constant for _milli_
seconds
2018-04-17 22:27:17 -04:00
Zoltan Varga 356dd453e8 [sdks] Use the same directories for the downloaded and built llvm. (#8295) 2018-04-17 22:25:26 -04:00
Ludovic Henry d6072d7554 [corlib] SynchronizationContext does not work on non-root AppDomain on Android (#8291)
AndroidEnvironment.GetDefaultSyncContext just crashes when called on an AppDomain which is not the root AppDomain. This started appearing with the mono:2018-02 integration during which https://github.com/mono/mono/commit/252d61d0558b0bfa3461f3339ce617e2e4c285bb was introduced.

Fixes https://github.com/xamarin/xamarin-android/issues/1561\#issuecomment-381736716
2018-04-17 22:23:57 -04:00
Zoltan Varga 78f5f3cd3f [runtime] Add a 'generated file' warning to mini/Makefile.am. (#8286) 2018-04-17 19:01:15 -04:00
Rodrigo Kumpera cb08c5d1ac Merge pull request #8270 from kumpera/move_to_jsvu
[wasm] JS engine testing improvements.
2018-04-17 13:28:19 -04:00
jaykrell e8b7eeffe9 [Tailcall] Generally remove underscores and spaces in "tail_call", "TAIL_CALL", "tail call", etc. (#8271)
Also standalone "tail" to "tailcall".
For consistency and ease of search -- "longer words are better".
Leave profiler alone generally.
2018-04-17 08:21:32 -07:00
Rolf Bjarne Kvinge 09bcdbc5a6 [runtime] Add public API to set the pending exception. (#7759)
* [runtime] Add public API to set the pending exception.

Xamarin.iOS and Xamarin.Mac need a public API to set the pending exception
when converting Objective-C exceptions to managed exceptions.

This adds a public API to support this scenario.

Partially fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60065.

* [runtime] Document that pending exceptions should not be overwritten when the runtime is handling a thread abort request.
2018-04-17 16:06:59 +02:00
Rodrigo Kumpera 1e32e5cee3 Fix typo. 2018-04-17 09:43:28 -04:00
Aleksey Kliger (λgeek) 1a525f1193 Hybrid suspend and checked build fixes (async signal safety) (#8269)
* [threads] Have Hybrid Suspend not depend on Coop Suspend

* [threads] Enable CI

* [hybrid suspend] Wait for pending operations when suspending a blocking thread

In hybrid suspend we should wait for the pending suspend to finish when we're
suspending a blocking thread.

In full cooperative suspend, we treat blocking threads as already suspended, so
in that case there is nothing to wait for.

* [checked-build] don't use malloc for thread state history

Use a ring buffer, so we're signal safe.

* [checked-build] checked_build_thread_transition - async signal safe variant

Can't call backtrace on Linux from a signal handler.

Change mono_threads_transition_finish_async_suspend not to collect a
backtrace.
2018-04-17 07:26:08 -04:00
Alexis Christoforides f41f8f2020 Merge pull request #8264 from jaykrell/monotrace
Refactor 3 copies of mono_trace_is_traced into 1.
2018-04-16 21:28:33 -04:00
Ludovic Henry 282ee4bfd7 [threads] Remove configuration dependency of Hybrid Suspend on Coop Suspend (#8261)
* [threads] Have Hybrid Suspend not depend on Coop Suspend

* [threads] Enable CI
2018-04-16 17:54:57 -04:00
Bernhard Urban 8fec8eeeae [ppc] disable aot-tests on CI 2018-04-16 23:10:42 +02:00
Bernhard Urban 89e69bbb62 [ppc] disable failing tests 2018-04-16 23:10:42 +02:00
Bernhard Urban 155a561531 [mono/tests] disable some tests if csharp compiler is not roslyn 2018-04-16 23:10:42 +02:00
Rodrigo Kumpera 0d754e28a1 [wasm] Update our CI/test scripts to use the newer targets and include Mono.Security as System.Core now needs it. 2018-04-16 17:02:45 -04:00
Rodrigo Kumpera 37bd17ec68 [wasm] Switch JS VM provisioning to use jsvu. Add support for testing with all 4 major engines. 2018-04-16 17:02:20 -04:00
Aleksey Kliger (λgeek) 83281c91b9 Rename MonoClass field byval_arg to _byval_arg (#8219)
* [class] Rename MonoClass byval_arg field to _byval_arg

Update all use sites to use the getter method m_class_get_byval_arg instead
when possible.

* [runtime] add mono_get_*_type accessors for common MonoTypes

Just do void, object, int32 and int (aka IntPtr) for now
2018-04-16 14:46:21 -04:00
Katelyn Gadd 7eff6686fd Default platform to net_4_x if none is specified, to fix tools that build without setting a platform (#8223)
* Default platform to net_4_x if none is specified, to fix tools that build without setting a platform

* [csproj] Update project files
2018-04-16 09:54:53 -04:00
Jay Krell e229e049f0 Refactor 3 copies of mono_trace_is_traced into 1.
Refactor g_print on top of new g_printv. g_log / g_logv provided precedent.

The intent is like:
void foo_print (const char *format, ...)
{
 if (debug_foo || MONO_IS_TRACED (foo, log)) {
   va_list args;
   va_args (format, args);
   g_printv (format args)
 }
}

so I can either set the environment variable, or edit the global,
besides removing the two parameters from every mono_trace call.
2018-04-16 02:07:19 -07:00
Zoltan Varga a948ed91e7 [llvm] Fix support for LLVM_API_VERSION==391 which is used by the release_39 branch in mono's llvm fork. (#8259) 2018-04-15 23:35:59 -04:00
jaykrell 8c3555d315 x86/amd64 require a control transfer to notice writes to code (citation needed). (#8257)
Therefore, while mono_arch_flush_icache does not need to do anything,
it cannot be inlined.
2018-04-15 16:30:23 -04:00
Zoltan Varga 006c825990 [jit] Enable float32 by default. (#4731)
* [jit] Enable float32 by default.

* [arm64] Fix some 32 bit float compares so they handle unordered operands correctly.

* [runtime] Disable a coreclr test which fails with float32.
2018-04-15 13:28:59 -04:00
Rodrigo Kumpera 85181dc808 [iolayer] Handle ENEEDAUTH on OSX, map it to ERROR_ACCESS_DENIED as it's the closest error possible. (#8239) 2018-04-15 13:25:47 -04:00
Zoltan Varga a5b0e4203a [arm64] Fix some 32 bit float compares so they handle unordered operands correctly. (#8255) 2018-04-15 13:25:04 -04:00
Zoltan Varga 719a27d2a0 [runtime] Disable a coreclr test which fails with float32. (#8256) 2018-04-15 13:23:45 -04:00
Zoltan Varga c3d574a5a4 [llvm] Update the llvm backend to work with the 2017-12-01-31d7f39423874d52922c06484f2c2af216844b4d branch in the mono llvm repo. The pavg.b/w sse intrinsic were removed since they can now be implemented in llvm IR. (#8253) 2018-04-14 16:40:37 -04:00
jaykrell f958cc5d97 [Tailcall] Enable more tailcall tests on x86/amd64/arm64. (#8103)
* [Tailcall] Enable more tailcall tests on x86/amd64/arm64.

* [Tailcall] Disable tailcall-interface-conservestack.exe for now on x86 and AOT.
2018-04-14 11:21:11 -04:00
Ben Adams a810d53e41 Make stack traces readable (#6675)
* Make stack traces readable

* Updates the logic to work on Mono

* [symbolicate] Add support for prettified async stack traces

* Tests update
2018-04-14 14:38:18 +02:00
Bernhard Urban 8430155946 Fix timestamp for file copy (#8231)
* [FileTest] regression for https://github.com/xamarin/xamarin-macios/issues/3929

* [w32file-unix] fix File.Copy timestamps

4a8d840d6f introduced that the destination
file of a copy operation has the same modification and access timestamps
as the source file.

With e0e185d70a this behaviour regresses,
since getting timestamps provides more precise information. Fixing this
by being more accurate when applying timestamps to destination file.

* [w32file-unix] convert nano seconds to microseconds properly, by using TICKS_PER_MILLISECOND (which has L suffix in its definition)

* [w32file-unix] introduce constant for ns->qs conversion with proper suffix

fixes problem on 32bit.
2018-04-14 10:25:23 +02:00
jaykrell 90a6203996 Teach metadata-verify.c about PE32+. Remove extra string copies. (#8224)
* Remove extra string copies.

* Teach metadata-verify.c about PE32+.
2018-04-13 23:34:09 -04:00
Zoltan Varga 2963f5698f [jit] More float32 fixes. (#8234)
* [jit] Add a r8->r4 conversion in stind.r4 when the item on the stack is a r8 because of stack merging.

* [jit] Disable a SIMD test which can fail with -O=float32 due to precision problems.

* [jit] Use m_class_get_byval_arg ().

* [jit] Fix OP_RCONV_TO_I on amd64.

* [jit] Revert '[jit] Use r8 for r4 stack vars to avoid problems with stack merges when one side is an r4 and the other an r8. Add conversions for compares. (#8196)'. It causes r4-r4 merges to produce an r8 stack value, leading to invalid il errors.
2018-04-13 22:17:24 -04:00
Ludovic Henry 9bb635db6c [sdks] Fix typo + Fix verbosity of unzip-android-archive.sh (#8242) 2018-04-13 19:34:44 -04:00
Jonathan Chambers ec32e2aafa Check for successful return value rather than an incomplete set of non-successful codes (#3974) 2018-04-13 18:16:59 -04:00
Jonathan Pryor 76fd5b6b02 [Mono.Options] Allow CommandSet nesting, spaces in command names. (#7406)
* [Mono.Options] Allow CommandSet nesting, spaces in command names.

`git` (largely) only provides a single level of sub-commands, and
this is the use case that `Mono.Options.CommandSet` originally
supported.

However, this isn't the case for all command-line applications.
Take for example the Azure [`azure`][azure] command, which allows near
arbitrary command name depths:

[azure]: https://docs.microsoft.com/en-us/azure/virtual-machines/azure-cli-arm-commands

	$ azure config mode arm
	$ azure vm create
	$ azure vm list
	$ azure vm disk attach

Try to integrate "arbitrary" command nesting through two new
mechanisms:

 1. `Command` names may now contain spaces, and
 2. `CommandSet`s may be nested within `CommandSet`s.

`Command` names containing spaces allows for the same *style* of
"nested" sub-commands, but means that C# nesting isn't as deep:

	var azure = new CommandSet ("azure") {
	  new Command ("config mode") {...},
	  new Command ("vm create") {...},
	  new Command ("vm list") {...},
	  new Command ("vm disk attach") {...},
	};

When `CommandSet.Run()` is invoked, separate string indexes will be
"merged" while attempting to find a matching command-name, allowing
the "natural" command-line invocation to be used:

	mono example.exe vm disk attach
	# Invokes `vm disk attach` command

Alternatively, a `CommandSet` may be added to a `CommandSet`:

	// C#
	var azure = new CommandSet ("azure") {
	  new CommandSet ("vm") {
	    new Command ("create") {...},
	    new Command ("list") {...},
	  },
	};

When this is done, `CommandSet.Suite` is required on the command-line:

	mono example.exe vm list

If a "`Command` with spaces" has the same command-name as a nested
`CommandSet`, the `Command` "wins" and is invoked.

* [Mono.Options] Fix unsupported MCS compiler feature

* Bump API snapshot submodule
2018-04-13 18:16:01 -04:00
Vlad Brezae 8401610bb0 [interp] Exit from finally abort protected block when EH (#8207)
Fixes https://github.com/mono/mono/issues/7402
2018-04-13 18:14:27 -04:00
Jo Shields 6d4263a3a5 Add PowerPC configure flags for LLVM, and clean up failover linker flags (#8233) 2018-04-13 18:11:37 -04:00
Bernhard Urban 79c33e27eb [ppc] poll interruption checkpoint in generic trampoline (#7431)
* [ppc] poll interruption checkpoint in generic trampoline

* [ppc] remove throw var, it is a keyword in C++
2018-04-13 18:10:09 -04:00
jaykrell ec0406ba13 Remove redundant null checks before g_free(). (#8228) 2018-04-13 10:49:03 -04:00
Miguel de Icaza 52157b625a [PATCH] SemaphoreSlim, fail faster for timeout 0
This brings the patch: https://github.com/dotnet/coreclr/pull/6898

Fail faster for `Wait(0)` when no counts available.

Don't allocate in the `Wait(0)` and `WaitAsync(0)` fail paths.

1M iters Server GC

method | pre (ms) | post (ms) | improvement
-------- |------- |------- |------ |
Wait(0) | 33,788.25 | 12.28 | x 2751.5
WaitAsync(0) | 360.79 | 24.38 | x 14.8

Memory allocations, saves 360MB over the 1M ops
2018-04-13 10:20:47 +02:00
Jay Krell 95dc93543d Verify all 4 bytes of PE signature. 2018-04-13 09:02:55 +02:00
Zoltan Varga 7cc93270a1 [jit] Use r8 for r4 stack vars to avoid problems with stack merges when one side is an r4 and the other an r8. Add conversions for compares. (#8196)
* [jit] Use r8 for r4 stack vars to avoid problems with stack merges when one side is an r4 and the other an r8. Add conversions for compares.

* [jit] Use m_class_get_byval_arg in one place.

* Add a FIXME.
2018-04-13 01:57:11 -04:00
Zoltan Varga 5e9af502c0 [runtime] Get rid of the GLIB_LIBS autoconf define, it prevents automake from detecting the dependency on libeglib.la. (#8184)
* [runtime] Get rid of the GLIB_LIBS autoconf define, it prevents automake from detecting the dependency on libeglib.la. Fixes #8175.

* [runtime] Link eglib against -lm to avoid duplication.

* [runtime] Remove a few extra -lm options.

* [runtime] More GLIB_LIBS fixes.
2018-04-13 00:29:31 -04:00
Zoltan Varga fbd4054609 [jit] Use m_class_get_byval_arg () in more places. (#8211) 2018-04-13 00:26:44 -04:00
Alexis Christoforides f6cc1d0605 Merge pull request #8208 from svick/patch-1
Improved wasm sdk README formatting
2018-04-12 16:40:35 -04:00
Alexis Christoforides 1a8142c7db Merge pull request #8202 from lewurm/system-net-disable-tests
[system.net] disable some tests to unblock XI integration
2018-04-12 15:58:00 -04:00
Petr Onderka 97d8d31c4d Improved README formatting 2018-04-12 19:20:42 +02:00
Vlad Brezae 2fd38a2f4b [interp] Fix resuming from finally block (#8195)
In interp we implement the leave statement by enqueuing finally ips (and the destination ip that we are leaving to) that we call as we exit finally blocks. When throwing an exception from a finally block we need to flush these ips, so we don't jump back into clauses that were already skipped by EH.
2018-04-12 12:54:26 -04:00
Rodrigo Kumpera a14f41ca26 [wasm] Fix the disable sdb check. Fixes #8177. (#8182)
[wasm] Fix the disable sdb check.

Fixes https://github.com/mono/mono/issues/8177
2018-04-12 17:55:08 +02:00
Bernhard Urban e1518f94d0 [system.net] disable some tests to unblock XI integration
regression tracked here: https://github.com/xamarin/xamarin-macios/issues/3827
2018-04-12 17:37:31 +02:00
Alexander Kyte 46b089bd6c [runtime] Make GetFrames consider nested exceptions (#8166)
* [runtime] Make GetFrames consider nested exceptions

Fixes #7260

* [runtime] Add test from repro for #7260

* [runtime] FIx test using absolute line numbers
2018-04-12 17:05:54 +02:00
Rolf Bjarne Kvinge f3890bdb8d [System.Net.Http] Use '*' as the host instead of '+' in the tests. Fixes xamarin/maccore#673.
Use '*' as the host instead of '+' in the tests.

The behavior should be the same, just faster, because '+' will fail to resolve
("Could not resolve host '+'"), and we'll fall back to the same behavior as
'*': https://github.com/mono/mono/blob/5128cce2dcd097aa4e7b86dd3b56e833c15a9ff0/mcs/class/System/System.Net/EndPointManager.cs#L83-L96

The problem arises when failing to resolve '+' takes a long time: on some of
our bots it takes 5-10 seconds. This adds up quickly since the tests try many
times, effectively increasing a test run from 1-2 seconds to 30+ minutes.

Fixes https://github.com/xamarin/maccore/issues/673.
2018-04-12 14:23:57 +02:00
EgorBo d3f6bdef87 remove header 2018-04-12 12:11:58 +02:00
EgorBo f248a4b43a Fix 6306 Disposing RSA objects obtained with GetRSAPublicKey/GetRSAPrivateKey makes keys unusable. 2018-04-12 12:11:58 +02:00
Marek Safar b5ad18926f [System] Fixes build 2018-04-12 11:47:48 +02:00
monojenkins 093df52396 [csproj] Update project files 2018-04-12 11:39:27 +02:00
monojenkins bafb1d21b8 Bump API snapshot submodule 2018-04-12 11:39:27 +02:00
Marek Safar d98db19805 [build] Bumps bootstrap mcs requirement 2018-04-12 11:39:27 +02:00
Marek Safar ce3cd1f03e [WindowsBase] Make tests less verbose 2018-04-12 11:39:27 +02:00
Marek Safar a801621255 [System] Fixes desktop FSW wildcard pattern to match others implementations 2018-04-12 11:39:27 +02:00
Marek Safar bd1a63e4f4 Moves vector to mscorlib 2018-04-12 11:39:27 +02:00
Marek Safar b3881a418f CoreFX update 2018-04-12 11:39:27 +02:00
Marek Safar 0248399b2a Submodule bump 2018-04-12 11:39:27 +02:00
Aleksey Kliger 5a61970597 [eglib] GMarkup: allow all ASCII NameStartChar and NameChar except ':'
Follow https://www.w3.org/TR/xml/#sec-common-syn except don't allow ':' and
non-ASCII.

Element and attribute names must start with a letter or '_'.
Element and attribute names may contain letters, numbers, '.', '-', '_'.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=19436
2018-04-12 09:00:48 +02:00
Ludovic Henry 1fff043868 [sdks] Add ANDROID_BUILD_TOOLS_DIR to differentiate it from ANDROID_BUILD_TOOLS_VERSION (#8191) 2018-04-11 19:04:29 -04:00
Ludovic Henry 42a62db169 [sdks] Fix typo (#8186) 2018-04-11 18:10:40 -04:00
Ludovic Henry 4f2522e6f4 [ci] Add {,hybrid,full}aot_llvm presets to make sure we compile with LLVM (#8053)
* [ci] Add {,hybrid,full}aot_llvm presets to make sure we compile with LLVM

* [configure] Rename runtime_preset to runtime-preset

* [bcl] Make sure we build the testing_aot_{hybrid,full} profiles when building all profiles

* [test-runner] Factor test-runner parameters for picking up and passing arguments to the runtime

* [hybridaot] Fix testing_aot_hybrid build

* [mini-llvm-aot] Fix common race condition in parallel builds due to common defaults.
2018-04-11 17:27:15 -04:00
Zoltan Varga aa729d19cb [jit] Add some implicit r4<->r8 conversions in float32 mode to the JIT front end, the CLR allows them. (#8156)
* [jit] Add some implicit r4<->r8 conversions in float32 mode to the JIT front end, the CLR allows them.

* [jit] Use m_class_get_byval_arg ().
2018-04-11 16:03:38 -04:00
Joshua Peterson 5f66c75557 Report the proper socket error (#8041)
When a connection fails, the socket error was being incorrectly reported
as an address family not supported error, instead of connection refused.

Why did this happen? The order of addresses returned from
`Dns.GetHostAddresses` changed. The newer code returns the IPv6 address
first, and the IPv4 address second. While `GetCheckedIPs` mentioned in a
comment that it skips addresses that don't match the address family, it
did not. The code using the addresses returned by `GetCheckedIPs` will
use the first address in the array. If this address happens to match the
address family of the socket, things will work "properly" (the correct
socket error will occur).

If, however the first entry has the wrong address family, then the
socket error will be an address family not supported error, since the
socket was created with different address family.

This change modifies `GetCheckedIPs` to filter the addresses, removing
those which do not match the address family.
2018-04-11 15:56:34 -04:00
monojenkins 529e486e78 Merge pull request #8068 from lambdageek/coop-hybrid-suspend
[coop] Hybrid suspend

## Summary

This is a new suspend mode where threads that are running managed or native runtime code (what we call "GC Unsafe") are suspended cooperatively using safepoints, but threads running either embedder code or P/Invoke code or blocking syscalls (what we call "GC Safe") are suspended preemptively using signals.

The motivation is to make an embedder-friendly coop suspend mechanism where the runtime will do GC Safe -> GC Unsafe transitions on calls to `MONO_API` functions, but the embedders themselves don't have to have any special knowledge of coop safepoints or state transitions.

To try this out, set **both** `MONO_ENABLE_COOP` and `MONO_ENABLE_HYBRID_COOP` environment variables.

## Implementation

Here's a picture of the new state machine.  There's two new states `Blocking_Suspend_Requested` and `Blocking_Async_Suspended` and one updated transition `req_s` (request suspension).

![coop-state-machine](https://user-images.githubusercontent.com/480437/38572948-9fe879e2-3cc2-11e8-8f27-9493f05f03bf.png)

### State machine states and transitions

The hybrid cooperative suspend mechanism works like this:
 - when a thread is executing in GC Unsafe mode, we use cooperative suspend and expect
   the thread to periodically checkpoint its execution (as in the ordinary full
   coop mode).
 - when a thread is executing in GC Safe mode, we use a preemptive signal-based
   suspend.  This is new - previously in full coop we would allow `BLOCKING`
   threads to continue executing and only suspend them when they wanted to go
   from GC Safe to GC Unsafe (via the `BLOCKING_SELF_SUSPENDED` state).

There are two new states and one updated transition - the transition will
service both running and blocking threads: The idea is that suspend mechanism
is determined by the suspend initiator, and is not embodied in the the state
machine.  The state machine just has to return distinctive enough values from
the transitions for the initiator to select a policy.

Resume mechanism is determined by the state that a thread finds itself in when
it is resumed, and the original suspend policy.

The primary differences between suspend mechanisms are: the preemptive
suspend is two phase - the `finish_async_suspension` does not
apply for cooperative suspend; the cooperative policy uses the `poll` transition when the thread is running.

We renamed `mono_threads_transition_request_async_suspension` to `mono_threads_transition_request_suspension`.

 - It must be called by a suspend initiator on a victim thread that is not
   itself.

 - There can only be one suspend initiator for a victim at a time - if the
   suspend initiator initiates a suspension it must follow through with the
   whole protocol.

 - If a victim is `RUNNING` we transition it to `ASYNC_SUSPEND_REQUSTED` and return
   `ReqSuspendInitSuspendRunning` which signals that the caller must initiate
   suspension for a running thread.  (Same as the old `AsyncSuspendInitSuspend`).

 - If a victim is `BLOCKING` we transition it to `BLOCKING_SUSPEND_REQUESTED`.
   Note that this is different from the old `request_async_suspension` which just
   incremented the suspend count and returned `AsyncSuspendBlocking`.  Now we
   return `ReqSuspendInitSuspendBlocking`.  The return of
   `ReqSuspendInitSuspendBlocking` means the initiator may signal the victim and
   must wait to be notified of the suspension (in preemptive suspend it will be
   notified by the signal handler, in cooperative when the blocking thread
   attempts to exit from blocking mode).

 - In `BLOCKING_SUSPEND_REQUESTED` we
   may increment the suspend count.  This is slightly too lax if we're going to
   be using preemptive suspend on blocking threads: in that case we're in the
   middle of a two-phase suspend and since there is only one suspend initiator,
   we wouldn't expect another suspend to be initiated until we have a chance to
   finish suspending.  We leave it to the suspend initiator to rule out by returning
  `ReqSuspendAlreadySuspendedBlocking` from this state.

 - In all the not executing states (`SELF_SUSPENDED`, `ASYNC_SUSPENDED`,
  `BLOCKING_SELF_SUSPENDED`, `BLOCKING_ASYNC_SUSPENDED`) we just
   increment the suspend count.

 - All other transitions are illegal.

- Note that `BLOCKING` must always have a suspend count of 0 and
   `BLOCKING_SUSPEND_REQUESTED` must have suspend_count > 0.

We add two new states:

 - `STATE_BLOCKING_SUSPEND_REQUESTED` - this is a new state that indicates that a
   suspend initiator wants to suspend this victim thread.
   - The thread is still executing in this state.
   - We only transition into this state with
     `mono_threads_transition_request_suspension`.
   - The only legal transitions out from this state are:
     - `resume` - decrements the `suspend_count`. If the `suspend_count` becomes 0 we
       go back to `BLOCKING`, otherwise we stay in `BLOCKING_SUSPEND_REQUESTED`.
     - `finish_async_suspension` (executed by the suspend signal handler to
       finish the two phase preemptive suspend request and notify the suspend initiator),
     - `done_blocking` and `abort_blocking`.  It means that the a
       suspend initiator requested a suspend but we got to done (or abort)
       blocking before the signal was delivered. We return `NotifyAndWait` and the
       caller is supposed to send a notification to the suspend initiator and
       wait for a resume(with suspend count == 0) which will return to
       `RUNNING` (the victim thread goes to `STATE_BLOCKING_SELF_SUSPENDED`).
 - `STATE_BLOCKING_ASYNC_SUSPENDED`
   - The thread is not executing in this state (it is waiting for a `resume`).
   - a thread transitions into this state from `STATE_BLOCKING_SUSPEND_REQUESTED`
     on a `finish_async_suspension` transition (see above).
   - on a `resume` transition we decrement the suspend count. if it's still
     positive we stay in this state. if it's 0 the thread transitions out of
     this state.  Unlike other resume transitions, in this case the thread goes
     back to `BLOCKING` and resumes executing in GC Safe mode.  The resume caller
     must notify the resume initiator (ie this is a `ResumeInitAsyncResume`).
   - on a `request_suspension` we stay in this state and just increment the
     suspend count.
   - all other transitions from this state are illegal.

We add two new return values for `abort_blocking` and `done_blocking`:
  - `DoneBlockingNotifyAndWait` and `AbortBlockingNotifyAndWait`. Similar to
    `SelfSuspendNotifyAndWait` - there was a race between the second phase of a
    preemptive suspend and another operation (in that case a poll, in this case a
    done or abort blocking) and the other operation won, so its caller should
    notify the suspend initiator. Since the thread is now suspended, the caller
    should wait for the resume signal.

We add new results for `request_initiate_suspension` `MonoRequestSuspendResult`
(formerly `MonoRequestAsyncSuspendResult`):
  - `ReqSuspendAlreadySuspended` means the thread is not executing and we just
    incremented its suspend count and there's nothing else for the suspend
    initiator to do. (The old `AsyncSuspendAlreadySuspended`)
  - `ReqSuspendAlreadySuspendedBlocking` means the thread is in
    `BLOCKING_SUSPEND_REQUESTED` and we initiated another suspend request.  This
    should only happen with full cooperative suspend - with hybrid suspend we
    will use a two phase preemptive suspend on a blocking thread and since only
    a single suspend initiator is active, this state should not be visible to
    another suspend initiator.
  - `ReqSuspendInitSuspendRunning` - Thread is executing in GC Unsafe mode and the
    caller should suspend it.  This is the old `AsyncSuspendInitSuspend`.  In
    full preemptive suspend this is the only suspend initiation action and the caller
    should begin the preemptive suspend procedure.  In full coop we expect the
    victim thread to reach a safepoint and poll to finish suspending.
  - `ReqSuspendInitSuspendBlocking` - Thread is executing in GC Safe mode and
    the caller should initiate a suspend.  In full coop the caller has nothing
    to do - a thread executing in blocking mode is assumed to be suspended.  In
    hybrid suspend, the caller has to initiate a preemptive suspend.

### Suspend initiator, signal handler, self suspender

Basically we call `mono_threads_transition_request_suspension` instead of `mono_threads_transition_request_async_suspension`.
Then if it says to suspend a running thread we call `begin_suspend_for_running_thread`, if it says initiate a suspension of a blocking thread, we call `begin_suspend_for_blocking_thread`, and if it says do nothing we do nothing.

**Questions**
1. We have an assumption in `safe_interrupt_thread` that we can return from a self interrupt if we're using coop suspend.  I'm not sure if that makes sense for hybrid suspend, and not clear what to do about it.
2. In `mono_thread_info_safe_suspend_and_run` we expect that the callback won't return `KeepSuspended` if coop is enabled.  I'm not sure what this means for hybrid.
3. A bunch of tests like `monitor-abort` and `appdomain-threadpool-unload` are failing if I enable hybrid suspend.  Don't know why yet.
2018-04-11 20:10:43 +02:00
Zoltan Varga 254a57f875 [runtime] Fix the build. (#8174) 2018-04-11 12:23:48 -04:00
Marek Safar 3b2dbf337e [corlib] Make more crypto oids work on mobile profiles when not linked out 2018-04-11 17:13:23 +02:00
Miguel de Icaza 920267df91 Allow the LLVM optimizer options to be passed on the command line. (#8025)
* Allow the LLVM opt flags to be provided in the command line

* Avoid leaking small string
2018-04-11 09:42:29 -04:00
Egor Bogatov ff0430bf3b [threadpool] ThreadPool.SetMinThreads fails if ThreadPool.GetMaxThreads was not called before (#8160)
* fix ThreadPool.SetMinThreads fails if ThreadPool.GetMaxThreads was not called before #7988

* check mono_lazy_initialize in ves_icall_System_Threading_ThreadPool_SetMaxThreadsNative first
2018-04-11 09:38:50 -04:00
Vlad Brezae af43001e89 [profiler] Fix heapshot frequency calculation (#8163)
Fixes https://github.com/mono/mono/issues/6173
2018-04-11 09:37:58 -04:00
Bernhard Urban 5128cce2dc [console-unix] retry tcsetattr if it was interrupted by signal (#8138)
[console-unix] retry `tcsetattr` if it was interrupted by signal

if configuring the terminal failed, we still try to continue (see
a3ce2f008b ) and therefore succedings
`read`s can fail.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=26983
2018-04-11 13:55:24 +02:00
Tom Dowdell 18d38900ff Updated Readme.md 2018-04-11 11:20:26 +02:00
Tom Dowdell abc4573beb Updated Readme.md for clarity, and added Windows instructions. 2018-04-11 11:20:26 +02:00
Marek Safar 0d2609c11c [mcs] Fixes parameter check for interface types used with default parameters 2018-04-11 11:03:49 +02:00
Zoltan Varga e3d8bdbf47 [llvm] Increase the inline limit when using llvm in jit mode. (#8141) 2018-04-10 22:06:49 -04:00
Alexis Christoforides 528b0d4b03 Merge pull request #8145 from lewurm/interp-stelem-r4
[interp] support r4 (single) in stelem instruction
2018-04-10 20:01:33 -04:00
Aleksey Kliger aaece70f79 [coop] Enter GC Safe around mono_os_event_ calls in threads.c 2018-04-10 19:18:00 -04:00
Aleksey Kliger d1895b67d4 [threads] Make mono_thread_info_get_suspend_state suspend policy aware
Move it from mono-threads-state-machine.c to mono-threads.c and make it
check how blocking threads are suspended before returning the saved state.
2018-04-10 17:38:11 -04:00
Alexander Köplinger 48eded43b9 [ci] Fix wrong label when csprojdiff is skipped 2018-04-10 23:23:52 +02:00
Aleksey Kliger 7e728dcdbd [threads] Return suspend sort from begin_suspend_for_running_thread
Change begin_cooperative_suspend and begin_preemptive_suspend to return one of
three results: suspend fail, suspend succeeded using cooperative suspend,
suspend succeeded using preemptive suspend.

This is used by check_async_suspend to decide whether to check the
MonoThreadInfo for the result of a suspend.  (If a thread is suspended
cooperatively, it doesn't make sense to check).

Fixes sporadic failures in mono/tests/monitor-abort.exe
2018-04-10 17:14:52 -04:00
Alexander Köplinger a8c96f026e [csproj] Another project file update 2018-04-10 20:36:49 +02:00
Aleksey Kliger f214256be3 [configure] Add --with-hybrid-suspend option
Defaults to 'no'.

To use `--with-hybrid-suspend=yes`, require `--with-cooperative-gc=yes`.
2018-04-10 13:23:40 -04:00
Aleksey Kliger b9be955509 [threads] Implement hybrid cooperative suspend
If a thread in blocking mode needs to be suspended, suspend it using preemptive suspend.
2018-04-10 13:23:35 -04:00
Aleksey Kliger 37613bce94 [coop] Add MONO_ENABLE_HYBRID_SUSPEND environment variable
When the environment variable is set, Mono will use cooperative safepoint
suspend for threads running in GC Unsafe mode (running managed code or native
runtime code), and preemptive suspend for threads running in GC Safe
mode (running native embedder or P/Invoke code, or blocking system calls)

The environment variable is visible through
mono_threads_is_hybrid_suspension_enabled ().

This commit just adds the env var, it doesn't turn on hybrid coop suspend.
2018-04-10 13:23:34 -04:00
Aleksey Kliger f2f6a7df51 [coop] Add new states and transitions for hybrid coop suspend
The hybrid cooperative suspend mechanism works like this:
 - when a thread is executing in GC Unsafe mode, we use cooperative suspend and expect
   the thread to periodically checkpoint its execution (as in the ordinary full
   coop mode).
 - when a thread is executing in GC Safe mode, we use a preemptive signal-based
   suspend.  This is new - previously in full coop we would allow BLOCKING
   threads to continue executing and only suspend them when they wanted to go
   from GC Safe to GC Unsafe (via the BLOCKING_SELF_SUSPENDED state).

There are two new states and one updated transition - the transition will
service both running and blocking threads: The idea is that suspend mechanism
is determined by the suspend initiator, and is not embodied in the the state
machine.  The state machine just has to return distinctive enough values from
the transitions for the initiator to select a policy.

Resume mechanism is determined by the state that a thread finds itself in when
it is resumed, and the original suspend policy.

The primary differences between suspend mechanisms are: the preemptive
suspend is two phase - the finish_async_suspension transition only does not
apply for cooperative suspend; the cooperative policy uses the poll transition
when the thread is running.

We renamed mono_threads_transition_request_async_suspension to mono_threads_transition_request_suspension.

 - It must be called by a suspend initiator on a victim thread that is not
   itself.

 - There can only be one suspend initiator for a victim at a time - if the
   suspend initiator initiates a suspension it must follow through with the
   whole protocol.

 - If a victim is RUNNING we transition it to ASYNC_SUSPEND_REQUSTED and return
   ReqSuspendInitSuspendRunning which signals that the caller must initiate
   suspension for a running thread.  (Same as the old AsyncSuspendInitSuspend).

 - If a victim is BLOCKING we transition it to BLOCKING_SUSPEND_REQUESTED.
   Note that this is different from the old request_async_suspension which just
   incremented the suspend count and returned AsyncSuspendBlocking.  Now we
   return ReqSuspendInitSuspendBlocking.  The return of
   ReqSuspendInitSuspendBlocking means the initiator may signal the victim and
   must wait to be notified of the suspension (in preemptive suspend it will be
   notified by the signal handler, in cooperative when the blocking thread
   attempts to exit from blocking mode).

 - In BLOCKING_SUSPEND_REQUESTED we may increment the suspend count.  This is
   slightly too lax if we're going to be using preemptive suspend on blocking
   threads: in that case we're in the middle of a two-phase suspend and since
   there is only one suspend initiator, we wouldn't expect another suspend to
   be initiated until we have a chance to finish suspending.  We leave it to
   the suspend initiator to rule out by returning
   ReqSuspendAlreadySuspendedBlocking from this state.

 - In all the not executing states (SELF_SUSPENDED, ASYNC_SUSPENDED,
   BLOCKING_SELF_SUSPENDED, BLOCKING_ASYNC_SUSPENDED) we just increment the
   suspend count.

 - All other transitions are illegal.

 - Note that BLOCKING must always have a suspend count of 0 and
   BLOCKING_SUSPEND_REQUESTED must have suspend_count > 0.

We add two new states:
 - STATE_BLOCKING_SUSPEND_REQUESTED - this is a new state that indicates that a
   suspend initiator wants to suspend this victim thread.
   - The thread is still executing in this state.
   - We only transition into this state with
     mono_threads_transition_request_suspension.
   - The only legal transitions out from this state are:
     - resume - decrements the suspend_count. If the suspend_count becomes 0 we
       go back to BLOCKING, otherwise we stay in BLOCKING_SUSPEND_REQUESTED.
     - finish_async_suspension (executed by the suspend signal handler to
       finish the two phase preemptive suspend request and notify the suspend initiator),
     - done_blocking and abort_blocking.  It means that the a
       suspend initiator requested a suspend but we got to done (or abort)
       blocking before the signal was delivered. We return NotifyAndWait and the
       caller is supposed to send a notification to the suspend initiator and
       wait for a resume(with suspend count == 0) which will return to
       RUNNING (the victim thread goes to STATE_BLOCKING_SELF_SUSPENDED).
 - STATE_BLOCKING_ASYNC_SUSPENDED
   - The thread is not executing in this state (it is waiting for a resume).
   - a thread transitions into this state from STATE_BLOCKING_SUSPEND_REQUESTED
     on a finish_async_suspension transition (see above).
   - on a resume transition we decrement the suspend count. if it's still
     positive we stay in this state. if it's 0 the thread transitions out of
     this state.  Unlike other resume transitions, in this case the thread goes
     back to BLOCKING and resumes executing in GC Safe mode.  The resume caller
     must notify the resume initiator (ie this is a ResumeInitAsyncResume).
   - on a request_suspension we stay in this state and just increment the
     suspend count.
   - all other transitions from this state are illegal.

We add two new return values for abort_blocking and done_blocking:
  - DoneBlockingNotifyAndWait and AbortBlockingNotifyAndWait. Similar to
    SelfSuspendNotifyAndWait - there was a race between the second phase of a
    preemptive suspend and another operation (in that case a poll, in this case a
    done or abort blocking) and the other operation won, so its caller should
    notify the suspend initiator. Since the thread is now suspended, the caller
    should wait for the resume signal.

We add new results for request_suspension MonoRequestSuspendResult
(formerly MonoRequestAsyncSuspendResult):
  - ReqSuspendAlreadySuspended means the thread is not executing and we just
    incremented its suspend count and there's nothing else for the suspend
    initiator to do. (The old AsyncSuspendAlreadySuspended)
  - ReqSuspendAlreadySuspendedBlocking means the thread is in
    BLOCKING_SUSPEND_REQUESTED and we initiated another suspend request.  This
    should only happen with full cooperative suspend - with hybrid suspend we
    will use a two phase preemptive suspend on a blocking thread and since only
    a single suspend initiator is active, this state should not be visible to
    another suspend initiator.
  - ReqSuspendInitSuspendRunning - Thread is executing in GC Unsafe mode and the
    caller should suspend it.  This is the old AsyncSuspendInitSuspend.  In
    full preemptive suspend this is the only suspend initiation action and the caller
    should begin the preemptive suspend procedure.  In full coop we expect the
    victim thread to reach a safepoint and poll to finish suspending.
  - ReqSuspendInitSuspendBlocking - Thread is executing in GC Safe mode and
    the caller should initiate a suspend.  In full coop the caller has nothing
    to do - a thread executing in blocking mode is assumed to be suspended.  In
    hybrid suspend, the caller has to initiate a preemptive suspend.
2018-04-10 13:23:01 -04:00
Mike Voorhees a56f9de9e2 Clean up mscorlib link xml (#8055)
Removes some duplication of preservations

Consolidations some preservations under a single <type> element
2018-04-10 18:56:00 +02:00
Alexander Köplinger 1546a1a7c2 [csproj] Update project files 2018-04-10 18:38:11 +02:00
Alexander Kyte 2a19106b94 [runtime] Enable mono_runtime_set_execution_mode to handle MONO_AOT_MODE_NORMAL (#8091) 2018-04-10 11:39:08 -04:00
Alexander Kyte 7b545988f2 [sdks] Add managed debugger tests to sdks (#6309)
* [sdks] New SDK target: soft debugger + non-nunit exe

This adds support for building an arbitrary .exe (dtest-app is hardcoded
now, but changing that and setting the arguments is another line or two,
to bu customized to the app being bound)

When an environment variable is set, the runtime will wait for the
managed debugger. This enables the desktop to debug the deployed .exe.

This will be used for the Mono.Debugger.Soft tests, but is useful for
isolated reproductions with android bugs.

An unmanaged debugger versions of the managed debugger is coming in
another PR.

* [runtime] Provide argument to dtest-app when running remotely

* [runtime] Fix case of VMDisconnectionException when getting Process of remote host that has disconnected

* [runtime] Script monodroid desktop debugger agent

* [runtime] Use g_warning in debugger agent

* [sdks] Ship PDBs on android

* [sdks] Add Android target to run debugger tests

* [sdks] Add desktop profile target for debugger tests

* [sdks] Disable debugger tests on mobile that use unsupported apis

* [sdks] Add monodroid test profile to android sdks

* [runtime] Allow dtest-app to be built on non-debugger-client profiles

* [runtime] Allow dtest-app building on mobile profiles
2018-04-10 11:36:08 -04:00
Zoltan Varga eda870e6d6 [llvm] Fix the name of the llvm.fabs intrinsic. (#8140) 2018-04-10 09:40:57 -04:00
Zoltan Varga 8b5d582855 [bcl] Mark some some code with DISABLE_COM which depends on icalls which are disabled in the runtime when --enable-minimal=com is used. (#8111)
* [bcl] Mark some some code with DISABLE_COM which depends on icalls which are disabled in the runtime when --enable-minimal=com is used.

* [bcl] Fix compilation of System.Runtime.InteropServices.WindowsRuntime.dll.

* .
2018-04-10 09:39:31 -04:00
Alexander Köplinger d30da4d588 Bump cecil and linker (#8137)
* Bump cecil and linker

* Bump API snapshot submodule
2018-04-10 15:20:12 +02:00
Alexander Köplinger a748bad303 [System] Don't use http://www.mono-project.com for test (#8147)
When we tried switching mono-project.com to enforce HTTPS these tests
started failing on systems without working SSL configuration.

Use a different domain which is guaranteed to be available over HTTP instead.
2018-04-10 14:48:52 +02:00
Marek Safar 5f8024c4b2 [corlib] Implements CryptoConfig::AddAlgorithm on all profiles 2018-04-10 11:16:40 +02:00
Bernhard Urban f8026125cd [interp] support r4 (single) in stelem instruction
Fixes https://github.com/mono/mono/issues/8143
2018-04-10 11:14:00 +02:00
Marek Safar 316bda7eb9 [build] Exclude platform specific xunit tests (#8120) 2018-04-10 09:44:54 +02:00
Alex Rønne Petersen e90dee3d0c [Mono.Profiler.Log] Add a new profiler test suite. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 756c85103c [mini] Add missing jit_code_buffer profiler events to all backends. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen eee1f0b0d4 [profiler] Mark some code buffer types that are no longer produced as deprecated.
Also remove them from the log format.
2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 197745501c [ci] Run the regular profiler tests on the stress test jobs as well. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 9a34740d94 [profiler] Flush log buffers of internal threads after attaching.
Otherwise some events would arrive too late, e.g. heap root register events
would arrive after heapshots that reference them.
2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 9acadffc2c [profiler] Fix the gc_finalized_object callback not being set. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 307e697b82 [profiler] Add separate counters for root (un)register events. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen dea7f4fe4a [mprof-report] Report stats about finalization events. 2018-04-10 02:34:56 +02:00
Alex Rønne Petersen 9ce9cafc29 Clean up some .gitignore files and add *.mlpd to the root file. 2018-04-10 02:34:56 +02:00
Aleksey Kliger 2891521ef7 [tests] Disable newobj-abstract.il in FullAOT
The MemberAccessException happens at AOT-time preventing the test from running.
2018-04-09 20:25:34 -04:00
Bernhard Urban f4cc8cccaa [interp] throw MemberAccessException when abstract class is used with newobj instruction 2018-04-09 20:25:34 -04:00
Jonathan Chambers c0b9c4151c Throw MemberAccessException when abstract class is used with newobj instruction 2018-04-09 20:25:34 -04:00
jaykrell 9d4f120dd3 [Tailcall] Grow static tailcall_membase len. (#8134)
Note that eventually, the length will depend on stack_usage
difference between caller and callee, though for arm64 it does not currently.
This should fix https://github.com/mono/mono/issues/8112.
2018-04-09 17:09:55 -07:00
Alexander Köplinger 63e72f29b2 [Facades] Add System.Drawing.Common on mobile only (#8126)
* [Facades] Add System.Drawing.Common on mobile only

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

* Bump API snapshot submodule
2018-04-10 02:08:50 +02:00
Marek Safar d460942cff [mono] Update documentation pages links (#8118)
Fixes #7785
2018-04-09 20:03:46 -04:00
Miguel de Icaza f003518cca [mkbundle] Probe for a .exe on the target runtime directory - fixes GitHub #7731 (#8105) 2018-04-09 20:02:28 -04:00
Zoltan Varga 6144c2bf1f [jit] Various float32 fixes. (#8133)
* [jit] Add a MONO_ARCH_FLOAT32_SUPPORTED arch-specific define, use it to disable float32 on platforms which don't support it.

* [amd64] Fix r4fp support for the ATOMIC_LOAD/STORE_R4 opcodes.

* [jit] Disable a unused test method with invalid IL.

* [jit] Handle r4->u conversion correctly in float32 mode.

* [amd64] Fix some OP_R<cmp> opcodes.
2018-04-09 19:11:01 -04:00
Zoltan Varga 41e928c9ae [runtime] Extract the debugger code into a separate library. (#7673)
If the runtime is configured using --enable-minimal=soft_debug, the debugger code will be compiled into a separate
libmono-dbg.a library which needs to be linked into the app. The debugger needs to be registered with the runtime by
calling mono_debugger_agent_init () before runtime initialization.
2018-04-09 18:48:51 -04:00
Zoltan Varga 8012cf9283 [llvm] Add intrinsics support for some of the new MathF icalls when using llvm+float32. (#8096)
* [llvm] Add intrinsics support for some of the new MathF icalls when using llvm+float32.

* [jit] Use m_class_get_name ().

* [llvm] Fix the signature of the llvm instrinsic used by OP_ABSF.

* [llvm] Use llvm.fabs only on amd64, it doesn't seem to be supported on some platforms.
2018-04-09 18:46:32 -04:00
Alexander Köplinger b5bcec428e [ci] Update csproj files during PRs (#8052)
* [ci] Update csproj files during PRs

Similar to how API diff is done.

Replace EXTERNAL_DRAWING_FACADE in csproj in genproj
It'd embed the absolute path in the csproj, but we want the variable instead.

* [csproj] Update project files
2018-04-10 00:32:08 +02:00
Alexander Kyte 8eb6dae513 [runtime] Add CustomModifiers support to sre 2018-04-09 16:46:55 -04:00
Alexander Kyte 1ce6156dc9 [runtime] Add sre-based modreq tests 2018-04-09 16:46:55 -04:00
Alexander Kyte 9dc6c344ac [runtime] Compare custom modifiers in type equality
Custom modifiers are an odd feature of .net which allow types to
be tagged. These tags are semantically relevant. A method with a
modifier should not override a method without a modifier, for
instance (github bug #6936).

We don't put enough information into the modifier to uniquely find the
Image associated with the token we have in the type. Modifiers from
different referring assemblies will have different tokens to refer to
the same modifier class, making it important to resolve the tokens to
MonoClass pointers at runtime. Pointer equality of these classes is the
way to determine two custom modifiers the same, or unique.

We cannot resolve the image just from the MonoType because it is
possible to put modifiers on primitive, builtin types. These builtin
types lack any filled-out pointers in the data block, meaning we have
zero metadata associated with our floating token.

Other places in the codebase fixed this by passing around MonoImages,
but adding a MonoImage argument to our type comparison function for
this single bug would be a very poor decision with much code churn all
throughout the runtime.

The bug above resolves to two I4 types, one of which has a modifier, one
of which does not.

In order to pass this MonoImage around, we need to put a reference to it
into something reachable from the MonoType. We can't put it in the
custom module type because that is exported. It is part of the public
API.

MonoTypes do not adhere to pointer equality, and custom modules are structs
baked directly into the MonoType. We need therefore to make MonoType
point to a MonoCustomModInternal, a new type. This type embeds the
public type as a struct and carries around the image as another element
in the struct.

All public interfaces still see the same metadata endpoints for parsing the
modules, including the icalls. It is only our type comparison code that
accesses our new field.
2018-04-09 16:46:55 -04:00
Bernhard Urban c78ae5d6fd [interp] fix regression for virtual delegates
Regression introduced in 77b4cd11d1. We
need to distinguish this case.

Fixes #7944
2018-04-09 22:09:33 +02:00
Marek Safar 07ae1445b8 [mcs] Adds private protected modifier to the parser only 2018-04-09 19:37:23 +02:00
jaykrell 2f3de80410 Fix generic-stack-traces2.2.cs under FullAOT+LLVM. (#8102)
It relies on poorly defined behavior that mono cannot likely well define.

https://msdn.microsoft.com/en-us/library/system.diagnostics.stacktrace(v=vs.110).aspx

"StackTrace might not report as many method calls as expected, due to code transformations
that occur during optimization."
2018-04-09 09:18:18 -04:00
Ludovic Henry 6ce881f081 [sdks] Fix arguments passed to llvm on Linux (#8107) 2018-04-09 08:46:27 -04:00
Jay Krell 48424f0d92 Symlink the 4.5 machine.config unconditionally.
This fixes https://github.com/mono/mono/issues/8074.

I see this 100%. Why others do not? I usually skip aot so usually I don't see it. Linux Ubuntu 1604 and
1710 tested. mono-devel package is installed, which is probably not relevant.

git clean -xddf (or new git clone)
./configure --with-runtime_preset=fullaot   likely also with others (hybridaot)
make

Many errors like:

MONO_PATH="./../../class/lib/build:$MONO_PATH" /s/mono/runtime/mono-wrapper ./../../class/lib/build/sn.exe
-q -R ../../class/lib/testing_aot_full/mscorlib.dll ./../../class/mono.snk Couldn't sign the assembly
../../class/lib/testing_aot_full/mscorlib.dll with this key pair. Public key of assembly did not match
signing public key. ../../build/library.make:342: recipe for target
'../../class/lib/testing_aot_full/mscorlib.dll' failed

If you run make V=1 you see the sn command.
 You can see the installed sn works ok. Remove the -Q for quiet and you see a warning about missing
machine.config. Run with ptrace and you see it looking for 4.5/machine.config. Look in the tree and you
see 1.1 and 2.0. Copy the 2.0 to 4.5 and problem goes away. And can be edited down a bunch. Actual fix is
to move symlink of the file to outside a conditional.

Maybe people aren't using fullaot or git clean? Repro is 100% for me.
I was going to bisect, but it was occuring as far back as September 2017 so I did not.
.
2018-04-09 10:36:37 +02:00
jaykrell 71cb807e0d Fix mono/tests/test-inline-call-stack.cs under FullAOT+LLVM (#8097)
by not inlining callers to GetCallingAssembly.

Attempts to do this only for cross-assembly failed.
Other codegen models might need more work here.
2018-04-08 00:56:51 -07:00
Zoltan Varga 28e216fe43 [sdks] Add support for building llvm unless the USE_PREBUILT_LLVM Make.config var is set. (#8017)
* [sdks] Add support for building llvm unless the USE_PREBUILT_LLVM Make.config var is set.

* [sdks] Use prebuilt llvm binaries on ios CI.

* [sdks] Use the IGNORE_PACKAGE_LLVM variable to enable the building of llvm.
2018-04-08 01:35:59 -04:00
Alex Rønne Petersen d16ca8d037 [profiler] Fix exception clause reporting. (#7940)
* [runtime] Handle interpreter-related frames in async stack walks.

* [profiler] Fix exception clause reporting.

This fixes three separate issues:

* Finally clauses in the non-exceptional case were not reported because we
  implement these by simply calling them from managed code, as opposed to the
  exceptional case where we call them from runtime C code.
* The catch portion of a try-filter-catch clause was being incorrectly reported
  as a filter.
* Actual exception filters were not being reported at all.

Because we have to instrument JIT'd code to report non-exceptional finally
clauses, a new mono_profiler_enable_clauses () function has been introduced
which profiler API users must call in order to get exception clause events, in
a similar fashion to mono_profiler_enable_allocations (). Since this is a
breaking change, the profiler API version has been bumped.

Fixes #7525.

* [profiler] Remove the iomap_report event and associated code.

The IOMap profiler no longer exists, so we no longer need to expose this
somewhat hacky event.

* [profiler] Replace the old gc_event with gc_event2.
2018-04-08 00:05:42 -04:00
jaykrell f8c8724f74 Fix new warnings. (#8066) 2018-04-07 23:59:41 -04:00
Aleksey Kliger (λgeek) 2495e5800d [coop] Thread state machine state cleanups (#8069)
* [coop] Squash the thread state machine state numbering

In
https://github.com/mono/mono/commit/9767b8a55ec8be3fc46055d7a1e21b6894fd0fc5
we removed STATE_SELF_SUSPEND_REQUESTED
but left a hole in the state numbering, as a result, `state_name()` was off by
one (and falling off the end of the array).

* [coop] Renamed STATE_BLOCKING_AND_SUSPENDED -> STATE_BLOCKING_SELF_SUSPENDED
2018-04-07 22:20:08 -04:00
Zoltan Varga ed8a1a4acc [arm64] Fix llvm jit support. (#8092) 2018-04-07 22:16:51 -04:00
Zoltan Varga 0b182760f3 [jit] Make mini-ops.h a dependency of the cpu-<ARCH>.h files. (#8094) 2018-04-07 22:15:44 -04:00
Zoltan Varga 717e4c1280 [jit] Don't emulate conv.r8.un when running with llvm. (#8095) 2018-04-07 22:15:18 -04:00
Ludovic Henry 078d514783 [w32file] Fix memory leak (#8090)
Fixes https://github.com/mono/mono/issues/7655
2018-04-07 16:23:41 -04:00
jaykrell 6898cd20a6 [mini-llvm] Remove unused struct field. (#8093) 2018-04-07 13:13:37 -07:00
monojenkins 889b54d240 [msvc] Update csproj files 2018-04-07 19:06:33 +02:00
Marek Safar 124b6765d6 [mcs] Implements C# 7 digits separators 2018-04-07 13:34:37 +02:00
Neale Ferguson 986f1fe7bd [s390x] Float32 (#8084)
* Enable float32 support and correct FP register saving

* Fix float register saving; Complete float32 support; Add tailcall_membase
2018-04-07 00:13:48 -04:00
Alexander Köplinger d59246bb7e [metadata] Fix wrong icall signature for ModF (#8080)
Noticed this while looking at Jenkins logs today:

```
15:00:56 /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/lib/net_4_x/mscorlib.dll
15:00:56 cant resolve internal call to "System.MathF::ModF(single,single*)" (tested without signature also)
```

We need to use `single` in the icall def instead of `float`.

It was introduced by https://github.com/mono/mono/pull/7941
2018-04-07 01:59:20 +02:00
Bernhard Urban ba9208be0a [interp] use same domain as transform phase to register debug data for a method 2018-04-06 19:58:40 -04:00
Marek Safar 544297ed7e [System] Disables compiled regex
Fixes #7828
2018-04-06 21:02:13 +02:00
Martin Baulig 762af4e5b0 [System]: Fix memory leak in the web stack related to Task.Delay (partial fix of #7356).
Using `Task.Delay (timeout)` has the potential of possibly allocating and holding large
chunks of memory throughout the timeout period.  While this is not strictly speaking a
memory leak because those objects will eventually be disposed and garbage collected, it
can cause memory usage of apps to grow quite significantly in the short run.

The default timeout values are as follows:

* `HttpWebRequest.ReadWriteTimeout`: 5 minutes.

* `HttpWebRequest.Timeout`: 100 seconds.

* `ServicePointManager.MaxServicePointIdleTime`: 100 seconds.

And these values can be increased by the user.  This means that we're potentially holding
hundreds, maybe even thousands of timeout objects in memory for 5+ minutes.

This has now been fixed by using the `Task.Delay(int,CancellationToken)` constructor.

Note that disposing a `CancellationTokenSource` will not cancel it, so the following code
will still leak:

	using (var cts = new CancellationTokenSource ()) {
		Task.Delay (TimeSpan.FromDays (3), cts.Token);
		// Work
	}

To actually make the `Task.Delay` instance go away when we're done with it, we need to
use this pattern:

	var cts = new CancellationTokenSource ();
	try {
		Task.Delay (TimeSpan.FromDays (3), cts.Token);
		// Work
	} finally {
		cts.Cancel ();
		cts.Dispose ();
	}

We also cannot use `CancellationToken.CancelAfter()` for timeouts because unfortunately
some of the underlying framework code that we're using does not honor cancellation
requests - like for instance `NetworkStream`.

This is a partial fix for #7356.  While this commit significantly improves the problem,
there may be other unrelated issues left that needs to be investigated.
2018-04-06 20:46:24 +02:00
Marek Safar 0bc4732b72 [mcs] Fixes codegen when probing reference type expression is known to pass and pattern variable has to be created 2018-04-06 20:03:11 +02:00
Sebastien Pouliot ca9cbdc889 [mono-api-html] Update tool to optionally output markdown
Output formatting is now delegate to a `Formatter` subclass. The default
one remains HTML with `HtmlFormatter` so any script should not see any
difference.

The output file is largely identical, except a few whitespace changes
that could not easily be avoided and how modified base types were
reported, since that was different from the rest.

The big change is the `--md` option which can output markdown, which
is the format to use from docs.microsoft.com. There are less options
available, e.g. colors, so additions are rendered using the `csharp`
blocks, while modification are rendered as a `diff` block.

Each assembly output is made to be easy to re-assemble into a single
document if needed, e.g. https://github.com/xamarin/xamarin-macios/pull/3814
2018-04-06 20:02:52 +02:00
Aleksey Kliger a49aa771c1 [coop] We never return AsyncSuspendWait 2018-04-06 07:15:16 -04:00
Aleksey Kliger e1638e555a [coop] We never return SelfSuspendWait 2018-04-06 07:15:16 -04:00
Marek Safar d7bb7151a8 [mcs] Implements C# 7.2 stackalloc span conversion in conditional expression 2018-04-06 08:28:31 +02:00
jaykrell 774f43c0f9 [coop] Include function names in coop state change assertions (#7923)
* [coop] Include function names in coop state change assertions

i.e. better reporting here:

https://jenkins.mono-project.com/job/test-mono-pull-request-coop/2298/parsed_console/log.html

***** MonoTests.System.Runtime.Remoting.RemotingServicesTest
***** MonoTests.System.Runtime.Remoting.RemotingServicesTest.Bug46473
Assertion failure in thread 0x7f21a504b740 due to: Cannot transition thread 0x7f21a504b740 from STATE_BLOCKING with DO_BLOCKING
Last 3 state transitions: (most recent first)
[DO_BLOCKING] RUNNING -> STATE_BLOCKING (0) 0 at:
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2ef31a) [0x560336a6f31a]
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2eb477) [0x560336a6b477]
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2ec7a2) [0x560336a6c7a2]
	at /mnt/jenkins/workspace/test-mono-pull-request-coop/mono/mini/mono(+0x2ec7e6) [0x560336a6c7e6]

This will provide one function instead of 0 or n, and could be expanded to include more.

This bloats shipping binary some (under condfigure only) which can be addressed with
an #if that conditionally turns the strings to null or empty. And slight code bloat.

Note that JIT and products and test use all this stuff and are left compatible and unchanged.

Previously:
foo(gpointer *stackdata)
{ ...
}

stackdata pointing to uninitialized, and not even size-specified

is now:

foo_internal(MonoStackData *stackdata)
{
...
}

foo(gpointer* stackpointer)
{
 MonoStackData stackData = { &stackdata, __func__ }; // define MONO_STACKDATA
 stackdata.stackpointer = stackpointer; // replacing &stackdata
 foo_internal(&stackdata);
}

with __func__ being a known-inaccurate standin for the caller.

If products/JIT/test evolve, flags to indicate which fields are present are likely in order.

Currently only the top function is printed, but we can likely store them longer.

As well running the debugger will help.

backtrace library could also be expanded. Currently it finds symbols on Mac but not Linux.
2018-04-05 21:18:53 -07:00
monojenkins 585954cbb9 [msvc] Update csproj files (#8067) 2018-04-06 02:17:12 +02:00
Alexander Köplinger e1eaedb6e8 [genproj] Sort embedded resources by name 2018-04-05 23:01:47 +02:00
Ludovic Henry babf07532b [sdks] Use wget in place of curl, it's installed by default on Linux (#8047) 2018-04-05 16:29:44 -04:00
jaykrell a1436838bf [Tailcall] virtual call support for arm64, x86; more return types supported for arm64 (#7966)
* [Tailcall] Disable tailcall-virt.exe tailcall/fsharp.exe per-arch instead of !AMD64
so we can whittle away at it.

* [Tailcall, arm64, jit] Make mono_arm_emit_destroy_frame flexible
as to if ip0 or ip1 (or both) is temporary. This isn't strictly necessary as caller
can carefully chose the correct one, i.e. ip0.

* [Tailcall jit arm64] Add virtual tailcall support to ARM64 (OP_TAILCALL_MEMBASE).
It could be either "interleaved" with regular tailcall support as done here,
or split up into a separate case. The level of code sharing with interleaving
is not huge.

* [Tailcall] Spell out 'membase' as 'tailcall_membase' for clarity.

Remove extra "shadowed local" MonoCallInst *call and use
 the other one. It achieves the same thing in this case
 and helps debugging experience. Alternative would be
 to rename the second one to "tailcall".

* [Tailcall] x86 tailcall_membase support (i.e. for virtual now, interface later)

* [Tailcall] Be sure not to tailcall interface calls on ARM.

* [Tailcall] More debugprinting.

* [Tailcall] arm64: allow floating point through (but only full registers)
arm, x86, amd64: require caller and callee return storage to match (arm64 already did)
Cleanup and debugprint.

* [Tailcall test] Always get hugeint (recursion depth) via function call,
so we can edit it one place.)

* [Tailcall] Add a FIXME for returning structs that can be made to work.

* [Tailcall test] Turn the F# test into three variations:
 deeptail same as original -- failure mode is stack overflow
 shallowtail which tailcalls but not to great depth -- it won't stack overflow
   and so it should have no other failure, but make sure -- for example
   this might still struggle on arm and we might split it up further
 shallownotail which is really should be nothing special

In this commit, all three are the same -- copy w/o edit.

* [Tailcall test] Make shallow in two tests and remove tail in one.

* [Tailcall test] Disable deeptail TailCallLoopGenericClass<DateTime> for all architectures.
It fails on x86 and arm64. It passes on amd64. arm tbd.

* [Tailcall test] Enable F# tests for x86 and arm64 (three internally are disabled for all architectures, one of which passes for amd64).

* [Tailcall test] Every configuration should be able to run the shallow/notail F#/tailcall tests.
They don't depend on tailcall, but either correctness w/ or w/o tailcall,
and if they do fail, it is not due to stack overflow.

* [Tailcall test] Fix .assembly directive to make some tailcall tests AOT compatible.

* [Tailcall] Dial back debugprint bloat after merge.
2018-04-05 11:50:21 -07:00
Alexander Köplinger 53de047335 [ci] Simplify run-jenkins.sh 2018-04-05 19:44:42 +02:00
Alexander Köplinger df33c092de [apidiff] Ignore CompilerGeneratedAttribute (#8042)
This attribute just adds noise to the apidiff.

Fixes https://github.com/mono/mono/issues/8036
2018-04-05 19:35:53 +02:00
Marek Safar c583d4e1fa [build] Rename VS managed solution (#8050) 2018-04-05 18:58:06 +02:00
monojenkins 59e7d12462 [msvc] Update csproj files (#8049) 2018-04-05 18:38:24 +02:00
Marek Safar 190e32ee8c [mcs] Implements C# 7.2 conditional ref expression 2018-04-05 17:56:02 +02:00
Bernhard Urban 8e0a12189a [interp] do not bake object reference into code stream (#8021)
it won't be scanned by the GC, defer string allocation to execution-time instead.


this fixes a GC crash when running mini regression suite on iOS/arm64.
2018-04-05 17:36:29 +02:00
Marek Habersack 92b741fa09 [SDKS] fix Linux (and possibly other OSes) build for Android (#8038)
OS: Ubuntu 18.03
CMake: 3.10

For some reason cmake fails to detect any make program (be it ninja or make)
when cross-compiling for Android in XA. It happens despite the programs being in
$PATH and working correctly. The effect is that CMAKE_MAKE_PROGRAM is set to
"not found" in CMakeCache.txt and configuration fails as follows:

 Call Stack (most recent call first):
   external/mono/external/boringssl/util/android-cmake/android.toolchain.cmake:1140 (CMAKE_FORCE_CXX_COMPILER)
   external/mono/sdks/builds/android-armeabi-v7a-debug/mono/btls/build-shared/CMakeFiles/3.10.2/CMakeSystem.cmake:6 (include)
      CMakeLists.txt:3 (project)
   CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      -- Configuring incomplete, errors occurred!

This commit does not fix the issue, per se, but it works around it by finding
the first ninja/make (as configured) executable in $PATH and setting the
CMAKE_MAKE_PROGRAM to full path of the executable. I haven't spent too much time
investigating *why* cmake fails to find the executable (I merely ran it with
--trace-expand --debug-output which revealed nothing of consequence) but this
workaround should be safe for any version of CMake and any OS we use makefiles
on.
2018-04-05 11:19:05 -04:00
jaykrell 9f499db187 Silently ignore mono_gchandle_free(0) so callers do not have to check. (#8020)
* [gc] Silently ignore mono_gchandle_free(0) so callers do not have to check.

* [threads] Take advantage of mono_gchandle_free(0) being nop (a few extra instructions
in dynamic path for when it is 0, same path length if it is not 0).

* [threads] Restore one if, it isn't clearly correct otherwise.
2018-04-05 07:27:40 -07:00
Alexander Köplinger a5d0ab59ed Fix tarball build
It got broken by https://github.com/mono/mono/pull/8026
2018-04-05 15:10:15 +02:00
Zoltan Varga c52cbd017f [sdks] Run device tests with the llvm builds as well. (#8027) 2018-04-05 15:03:38 +02:00
Miguel de Icaza 52df0f2b00 [System.MathF] Bring support for the single-precission Math operations to Mono (#7941)
This pull request brings support to Mono's class libraries for the new `System.MathF` type which includes operations for single-floating point.   

This is needed to run some new applications like:

https://github.com/aras-p/ToyPathTracer

With this change, it is possible to run this unmodified.  With this support, and the `-O=float32` option, it is possible to improve the performance from 6.3Mrays/sec to 7.8Mrays/sec on a Mac.

Oddly, this seems to be faster than .NET Core 2.1.4, which is at 4.2Mrays/sec.

* Bump API snapshot submodule
2018-04-05 14:37:46 +02:00
Rodrigo Kumpera 0b0d5de9e1 [wasm] Fix the CI build and disable some corlib tests that require multiple threads (#8005)
* [wasm][corlib] Disable some tests that don't work with WASM.

* [wasm][corlib] Disable IO test that requires threading.

* [wasm] Disable parallelism when building the wasm runtimes. Fixes CI build.

* [wasm] The incremental test runner can now skip tests in bulk.

* [wasm] Address reviewer feedback.
2018-04-05 10:06:35 +02:00
miguel d33f357ac6 Move Makefile documentation to markdown, and document how to run xunit tests 2018-04-05 10:01:00 +02:00
Marek Habersack 5c8c18046c [SDKS] Fix Android SDK build on Linux (#8015)
Current build uses `tar` to extract ZIP archives. This works with BSD
tar but not with GNU tar, alas. Tar was used in order to strip the root
directory of Android archive while moving files into place. This commit
replaces `tar` with a call to a shell script (because doing what it does
using Make defines is an exercise in pain) which works both on macOS/BSD
and on Linux.
2018-04-04 22:38:35 -04:00
Zoltan Varga 61b984beab [sdks] Set MinimumOSVersion to 10.1 on ios. (#8019) 2018-04-04 21:35:50 -04:00
jaykrell 9984e16797 [Tailcall] Dial back single -v output, and enable under MONO_LOG_LEVEL=debug MONO_LOG_MASK=tailcall. (#7985)
* [Tailcall] Dial back single -v output, and enable under MONO_DEBUG=tailcall, and -v -v.

* [Tailcall] MONO_LOG_LEVEL=debug MONO_LOG_MASK=tailcall and mono_trace instead of mono -v -v and g_print
2018-04-04 17:36:21 -07:00
Bernhard Urban fb91fce5d3 [interp] workaround undefined behaviour in r8 to u1 cast
This fixes `test_0_simple_double_casts` on iOS/arm64.
According to the C standard (section [conv.fpint]), the behaviour of
such a cast is undefined if the truncated value doesn't fit into the
destination type.

```c
unsigned char __attribute__ ((noinline)) convr8u1 (double i)
{
        return (unsigned char) i;
}
```

for arm64, `clang -O0` produces:

```
_convr8u1:
100006848:  ff 43 00 d1     sub sp, sp, #16
10000684c:  e0 07 00 fd     str d0, [sp, #8]
100006850:  e0 07 40 fd     ldr d0, [sp, #8]
100006854:  08 00 78 1e     fcvtzs  w8, d0
100006858:  00 1d 00 53     uxtb    w0, w8
10000685c:  ff 43 00 91     add sp, sp, #16
100006860:  c0 03 5f d6     ret
```

while `clang -O2` produces:

```
_convr8u1:
100006ae8:  00 00 78 1e     fcvtzs  w0, d0
100006aec:  c0 03 5f d6     ret
```

which is fine according the standard: Any value < 256 gets casted just
fine, but for example `convr8u1 ((double) 0xffff)` would end up with
`0xffff` in `w0`.

We workaround this behaviour by casting to a 32bit int first, the
resulting code looks like this then:

```
_convr8u1:
100006ae4:  08 00 78 1e     fcvtzs  w8, d0
100006ae8:  00 1d 00 12     and w0, w8, #0xff
100006aec:  c0 03 5f d6     ret
```
2018-04-04 20:16:26 +02:00
jaykrell 0b52b173f5 [threads] mono_join_uninterrupted waits longer than intended. (#7996) 2018-04-04 11:13:26 -07:00
Ludovic Henry d28767279a [sdks] Fix MXE_PREFIX for XA (#8006)
It should take 7 characters from the hash, not 6.
2018-04-04 13:37:34 -04:00
Zoltan Varga 04a446eb07 [sdks] More fixes for running device tests (#7994)
* [sdks] Update Info.plist.in so it works with older ios versions and tvos.

* [sdks] Add support for embedding a provisioning profile inside the app.
2018-04-04 09:10:54 -04:00
Zoltan Varga dd4613bc42 [runtime] Fix --disable-btls. (#7999) 2018-04-04 09:08:22 -04:00
jaykrell 1e2e6989ee [Coop] Remove bug-producing double evaluation in checked builds. (#7993) 2018-04-04 14:00:11 +02:00
Marek Safar 15f768fd04 [mcs] Clean up mcs project files 2018-04-04 11:23:37 +02:00
Rodrigo Kumpera cd219a91d1 [interp] Introduce MonoEEFeatures::force_use_interpreter as a way to make the wasm interp work. (#7989)
This flag tells the EE to skip searching compiled code and use the interp exclusively.
2018-04-03 22:39:12 -04:00
jaykrell d90a65a21c [jit] Add some missing bounds checks when reading ahead IL. (#7970) 2018-04-03 19:38:03 -07:00
monojenkins 6dd8df6845 [msvc] Update csproj files (#7998) 2018-04-04 02:25:32 +02:00
monojenkins 0b67219e6d [msvc] Update csproj files (#7995) 2018-04-04 00:55:54 +02:00
Marek Safar e938efc757 [corlib] Enable machine.config dependant version of CryptoConfig for net_4_x profile only (#7871)
Fixes #7716

* [corlib] Update linker descriptor with missing types
2018-04-04 00:26:07 +02:00
Alexis Christoforides e525533942 Disable a flaky test
https://github.com/mono/mono/issues/7992
2018-04-03 18:06:11 -04:00
Alexander Köplinger f9475164d9 [genproj] Add Mono.CSharp.pre and fix genproj postbuild bug (#7991)
We weren't emitting the postbuild script.
2018-04-03 23:52:43 +02:00
Alexis Christoforides 7a22783f25 Merge pull request #7958 from vargaz/ios-sdk-device-tests
[sdks] Add support for running device tests on ios.
2018-04-03 15:54:16 -04:00
Alexander Köplinger 7df16a0d31 [ci] Bump corlib-xunit test timeout
It takes close to the current timeout in a passing run already.
2018-04-03 20:51:34 +02:00
jaykrell 5c8fac189f [jit] Clarify assert, remove copy/pasted extra instruction, remove unused local. (#7965) 2018-04-03 09:22:59 -07:00
monojenkins ae82674b78 [msvc] Update csproj files (#7984) 2018-04-03 18:12:10 +02:00
Alexis Christoforides 04ec7abe31 Merge pull request #7953 from lewurm/interp-fix-native-types
[interp] fix i4<>i8 conversion for builtin types, it was inverted
2018-04-03 11:47:37 -04:00
jaykrell aad6fbaec5 [Tailcall] require exact matching return type (#7962)
* [Tailcall] Require an exact match on return type. Sometimes this makes sense (float<=>double), sometimes
it is a little overly restrictive (integer truncation, I <=> I[48])

* [Tailcall] Disable CoreCLR tests that have mismatched return types.
2018-04-03 08:15:22 -07:00
Rodrigo Kumpera 2f23688af2 [mini] Introduce MonoEEFeatures with a single feature use_aot_trampolines. (#7887)
[mini] Introduce MonoEEFeatures with a single feature use_aot_trampolines.

MonoEEFeatures is meant to replace the mode flag soup with have.
Each feature is supposed to be checked alone and descriptive enough of the underlying behavior.

use_aot_trampolines is a good example because the inter_aot_llvmonly mode could set it to false and
skip all the trampoline engine nonsense as trampolines are C functions.

Contributes to #7885

* [wasm] Switch wasm interp to not set use_aot_trampolines.

This allows the regular "JIT" tramp path be used instead of hacking our way around the AOT runtime.

* [mini] Introduce MonoEEMode to let us enumerate non-aot execution modes.

This lets us have all code setting up mono_ee_features in a single place.
2018-04-03 17:11:46 +02:00
jaykrell b2c02c81a3 [Coop] Remove a few raw pointers opportunistically. (#7964)
* [Coop] Opportunistically remove some raw pointers.
Replace some uses of mono_thread_interruption_checkpoint with
mono_thread_interruption_checkpoint_void or mono_thread_interruption_checkpoint_bool.

* [Coop] Remove some more raw pointers opportunistically -- mono_thread_execute_interruption to mono_thread_execute_interruption_void.

* Fix warnings from old bad merge.

* Add another static.

* [coop] Remove more raw pointers.
2018-04-03 10:11:43 -04:00
Tony Di Nucci 40df8e384f Fix for #7305 - stack overflow when ServiceHost is initialised with a ServiceContract which implements an interface 2018-04-03 15:02:05 +02:00
Ludovic Henry cf36124bb9 [sdks] Add provisioning for Android SDK and NDK (#7928)
* [sdks] Add provisioning for Android SDK and NDK

This will also be used by XA

* Add missing backslash to mxe.mk

* Only grab bin/autopoint

* [sdks] Use provisioning for MXE

We want to treat MXE the same way we do Android SDK and NDK because it only rarely changes, and it's very long to build it.
2018-04-03 08:52:00 -04:00
hgy59 abebff426a [WCF] fix ChannelDispatcher by accepting InstanceProvider (#7909)
* WCF: ChannelDispatcher/ListenerLoopManager.Setup validate InstanceProvider, not InstanceContextProvider
- the creation of endpoints requires an instance provider or a default constructor
- InstanceProvider vs InstanceContextProvider was obviously a typo

* include InstanceContextProvider for validation as before
- two unittests failed due InstanceProvider is null and ed.DispatchRuntime has not type set
- comment for the validation is not useful anyway (It is tested at Open(), but strangely it is not instantiated at this point.)
2018-04-03 14:31:14 +02:00
Alexander Köplinger ddcb792c01 [Facades] Add System.Memory facade to mobile profiles (#7939)
* [Facades] Add System.Memory facade to mobile profiles

Contains only the types we have right now.

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

* Bump API snapshot submodule
2018-04-03 13:34:42 +02:00
jaykrell f1dd2417ef [Tailcall] Fix .assembly directive to make some tailcall tests AOT compatible. (#7956) 2018-04-03 01:02:47 -07:00
Zoltan Varga e92c0da3f7 [ci] Run a subset of ios tests on device if the 'run-device-tests' ci tag is set. 2018-04-02 21:40:59 -04:00
Zoltan Varga f3e18ec093 [sdks] Add support for running device tests on ios. 2018-04-02 21:40:20 -04:00
Ludovic Henry ce6316e59d Bump version to 5.15 (#7955) 2018-04-02 21:29:07 -04:00
Zoltan Varga a7da5ba6aa [sdb] Add reference counting for single step requests, they can be accessed concurrently by the single step processing code and the event request clearing code. (#7876)
Fixes https://github.com/mono/mono/issues/7137
2018-04-02 21:10:47 -04:00
Alexis Christoforides 9767b8a55e Merge pull request #7951 from lambdageek/no-self-suspend-req-state
[coop] Remove STATE_SELF_SUSPEND_REQUESTED
2018-04-02 20:57:45 -04:00
Bernhard Urban 9cd9e3b0a1 [ppc] use ucontext_t
`struct ucontext` has been removed from glibc and `ucontext_t` has been
around for a while now.

Fixes a build failure on Ubuntu 18.04

Related glibc change
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=251287734e89a52da3db682a8241eb6bccc050c9;hp=c86ed71d633c22d6f638576f7660c52a5f783d66
2018-04-02 18:05:12 -04:00
Bernhard Urban 9b93d73699 [interp] fix i4<>i8 conversion for builtin types, it was inverted 2018-04-02 23:23:17 +02:00
Aleksey Kliger fd68b55687 [coop] Remove STATE_SELF_SUSPEND_REQUESTED
In 38a348c991 we got rid of
mono_threads_transition_reqest_self_suspension.  So there is now no way to
enter into STATE_SELF_SUSPEND_REQUESTED, so we no longer need to have cases for
transitioning out of it.
2018-04-02 16:54:50 -04:00
Rodrigo Kumpera 90b49aa3ae Merge pull request #7946 from kumpera/wasm_fix_a_few_issues
[wasm] Multiple fixes for the WASM target extracted for other PRs.
2018-04-02 15:26:39 -04:00
Zoltan Varga 21a9412a67 [sdb] Fix --enable-minimal=soft_debug build. Fixes #7920. (#7945) 2018-04-02 13:46:32 -04:00
Alexis Christoforides 95276e9ddb Merge pull request #7943 from filipnavara/corefx-sd-tests-1
[System.Drawing] Include CoreFX GraphicsPath and Region tests.
2018-04-02 12:01:12 -04:00
Rodrigo Kumpera cdea795c0e [wasm] Make RuntimeInformation properly detect WebAssembly.
It's done by ifdef'ing WASM because I don't see a way to change Environment.Platform / Environment.OSVersion without touching the public API.

Right now OSDescription is being used to return the execution environment. Once we properly support node and other non-web embeddings, it will be adjusted to do so.
2018-04-02 11:32:54 -04:00
Rodrigo Kumpera d8648776cc [wasm] Bump corert to pick fix for TaskCreationOptions.LongRunning. Fixes #7864.
Update the test runner to pick it up.
2018-04-02 11:31:28 -04:00
Rodrigo Kumpera 106ef365e3 [wasm] Disable the degraded alloc warning under wasm. Fixes #7661 2018-04-02 11:29:25 -04:00
Rodrigo Kumpera 2bf9a42fd3 [wasm] Fix the build. 2018-04-02 11:29:19 -04:00
Rodrigo Kumpera 5bdb87b6a6 [wasm] emcc has a broken clock_getime. Disable its usage. 2018-04-02 11:29:16 -04:00
Filip Navara a810739246 Include CoreFX GraphicsPath and Region tests. 2018-04-02 15:22:26 +02:00
Alexis Christoforides 4723e6603e Merge pull request #7915 from alexischr/fix-gh-7568
[System.IO] Don't throw exception when FileSystemWatcher is disposed while the backend is still trying to use it
2018-04-01 19:26:24 -04:00
Alexander Köplinger 2b4208feda [System.Windows.Forms] Set NotifyIcon.Icon in test to prevent warning 2018-04-01 18:12:15 +02:00
Alexander Köplinger a914dbf173 [System.Windows.Forms] Dispose forms opened during two tests 2018-04-01 15:13:33 +02:00
Hugh Bellamy fcd52894d9 [System.Drawing] Remove failing jpeg flags tests (#7931) 2018-04-01 00:41:17 +02:00
Rodrigo Kumpera 254013b0fd [runtime] Fix class visibility check for protected nested classes. (#7907)
* [runtime] Fix class visibility check for protected nested classes. Fixes #7657.

A nested class that has protected access must be checked using the same inheritance based rules as members.
The existing code ignores that and does a plain visibility check that is only amendable for public/internal nested types.

* [runtime] Add regression test for nested famility visibility.
2018-03-31 11:04:00 -04:00
monojenkins ebef3ec4b1 [msvc] Update csproj files (#7929) 2018-03-31 02:15:25 +02:00
Alexander Köplinger 2cbd1706dc [System.Drawing] Enable corefx xunit tests (#7924) 2018-03-31 01:13:03 +02:00
Katelyn Gadd 4d78aaf7b4 [genproj] When using fallback profile selection don't build the projects that were missing a profile (#7926)
Fixes #7903.
2018-03-31 01:06:07 +02:00
jaykrell 1931cb1dcb [Tests] Disable hijacking.exe and Jittailcall2.exe tailcall tests. (#7922) 2018-03-30 19:54:39 +02:00
Alexander Köplinger 938415c6d3 [test-runner] Don't output test result xml when no tests are run
A result xml that contains 0 tests confuses some tools.
2018-03-30 18:18:23 +02:00
Zoltan Varga a5a496695a Disable building btls/ and support/ on the bcl build, they are not needed. (#7921)
* [runtime] Add a --disable-btl-lib configure option to disable the building of the btls lib, but compile the managed code with btls support.

* Disable building btls/ and support/ on the bcl build, they are not needed.
2018-03-30 10:05:44 -04:00
Katelyn Gadd 2e0182b5c0 Implement Field SetValueDirect on non-struct targets. Add test case from roslyn issue 19038. (#7866)
* Implement Field SetValueDirect on non-struct targets. This allows the test case for roslyn bug 19038 to pass. Add roslyn bug 19038 test case.
2018-03-30 10:04:46 -04:00
Bernhard Urban 88cab36c20 [sdks] add Make.config to ignore file (#7901) 2018-03-30 09:27:16 -04:00
Ankit Jain 5c839fc109 Bump msbuild to track xplat-master (#7900) 2018-03-30 14:53:40 +02:00
Ludovic Henry f83fbbd9b8 [sdks] Fix LLVM build for XA (#7917) 2018-03-29 20:45:30 -04:00
Bernhard Urban a36d08a55a [perfcounters] fix alignment issue on 32bit
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related https://github.com/xamarin/xamarin-macios/issues/3826
2018-03-30 01:03:06 +02:00
Alexis Christoforides 1e1893d683 [System.IO] Don't throw exception when FileSystemWatcher is disposed while the backend is still trying to use it 2018-03-29 18:25:45 -04:00
Alexis Christoforides a1751d91c8 Revert "Disable some flaky tests."
This reverts commit bc25029b58.
2018-03-29 18:23:24 -04:00
Alexis Christoforides 2c14b1f82c Revert "Disable a flaky test."
This reverts commit 6822a57663.
2018-03-29 18:23:22 -04:00
Alexis Christoforides 86df754848 Revert "Disable bug-80307.exe"
This reverts commit 3015caeffad089e654116027c51b6746d0f43d37.
2018-03-29 18:23:20 -04:00
Zoltan Varga 60707875d5 Revert "[sdks] Disable btls and support/ on the bcl build, they are not needed. (#7892)" (#7904)
This reverts commit 792196320f.
2018-03-29 17:46:29 -04:00
jaykrell 6f0fba8961 [Tailcall] Bring coreclr tests for tail calls to Mono source tree (#7204)
* [Tailcall] Copy some tests from CoreCLR.

* [Tailcall] Copy and build some tests from CoreCLR.

* [Tailcall] Add mono --test-tailcall-require switch
 that asserts that every tail. is honored.
 Add some tailcall output under -v.

* [Tailcall] Switch tests/coreclr/tailcall to tests/tailcall/coreclr
on the theory that this is where additioanl tailcall tests will go,
not that is the coreclr test area.
Also remove leading "./" which did afford easier search/replace
but will likely be seen as noise, and might break out of tree builds.

* [Tailcall] update readme

* [Tailcall] Tweak logging and first working Makefile, w/o disabled tests.
Next step is try to restore parallelism.

* [Tailcall] Add indent and fix check-tailcall to be parallel and incremental.

* [Tailcall] Out of tree builds just need mkdir.

* [Tailcall] Remove accidental content.

* [Tailcall] Undo fix for out of tree builds.

* [Tailcall] Use environment variable MONO_DEBUG in place of command line parameter despite
environment variables having problems and being banned in other contexts.

Accept and ignore empty MONO_DEBUG option so that ",foo" can be appended without
first checking for empty -- without having to learn how in another language.

Use g_print instead of printf in new code, i.e. for Android debugger.

Remove newlines to restore unreadability/unmergability.

Make running tailcall tests not incremental by default but leave I= to make it incremental.

Add comments indicating "tailcalllog" is a public interface, not to be changed
without changing its users.

* [Tailcall] Resolve a recent "FIXME".

* [Tailcall] Compile but do not run the C# tests.

* [Tailcall] Split disabled compile from disabled run, and compile the last of the tests.
Disable compile remains, because one of the tests contains 3 files, and putting
the three sources in the sources variable (for distribution) implies building them each separately.
Disable compile is used to remove two of them from compiling independently
and then another dependency rule makes them compile together.

* [Tailcall] Follow convention without incrementality and less verification.

* [Tailcall] Disable new failing tests on x86/arm/arm64 and Linux/amd64.

* [Tailcall] Disable more tests for x86 and sort the lists.

* [Tailcall] Move from .NET Standard to mscorlib see if that works better.

* [Tailcall] Add missing build dependency.

* [Tailcall] Do not compile tailcall/coreclr/JIT/opt/Tailcall/TailcallVerifyWithPrefix.exe for
FullAOT. Compiling it fails an assert where it is supposed to raise an exception. Fix later.

* [Tailcall] For now, do not run any CoreCLR tailcall tests with FullAOT.
--compile-all fails an assert there. Instead we have to find what can run, and don't use --compile-all.

* [Tailcall] Disable all CoreCLR tests under FullAOT. Some fail to tailcall.
Many work, w/o assertion failure and printing success, but none exit with 0 exit code.

* [Tailcall] Add clarifying comment.

* [Tailcall] Add two opportunistic tail. prefixes.
2018-03-29 10:54:10 -07:00
Ludovic Henry 765ea25772 [sdks] Fix LLVM build on Linux for XA + Fix MXE usage on non-Darwin platforms (#7910)
* [sdks] Fix LLVM build on Linux for XA

* [sdks] Fix MXE usage on non-Darwin platforms
2018-03-29 13:03:39 -04:00
monojenkins 1d36e15392 [msvc] Update csproj files 2018-03-29 18:51:36 +02:00
thfrwn 81a781bb02 add some OpenBSD patches (#7699)
add some OpenBSD patches

Hi,

A few trivial additions of OpenBSD to ifdefs, plus the change of the abort signal to SIGUSR1 which fixes the SIGABRT problem (other compilation problems remain). SIGTTIN is broadcast to the process group which leads to the SIGABRT (at least on OpenBSD).
2018-03-29 11:25:23 -04:00
Zoltan Varga 792196320f [sdks] Disable btls and support/ on the bcl build, they are not needed. (#7892)
* [sdks] Disable btls and support/ on the bcl build, they are not needed.

* fix indent
2018-03-29 10:09:08 -04:00
Alexander Köplinger 573e460e97 Fix tarball build
iconv.m4 was deleted in https://github.com/mono/mono/commit/ff40ceff387e1b4a726a00a4e4d0e654afe1cd99
2018-03-29 15:29:10 +02:00
Alexander Köplinger 7ec2423535 [packaging] Bundle the msvc compiled monograph.exe on Windows 2018-03-29 15:26:05 +02:00
Alexander Köplinger 3dad276e2d Bump api-snapshot 2018-03-29 14:19:00 +02:00
Austin Wise 77b2db73aa Add BindingFlags.DoNotWrapExceptions (#7863)
The original design review is here: dotnet/corefx#22866 . To summarize, this adds a new flag to `BindingFlags` called `DoNotWrapExceptions`. When this flag is used to invoke a method using reflection, any exceptions thrown are not wrapped with a `TargetInvocationException`.

It has already been implemented in some other version of .NET:
- dotnet/corert#4437
- dotnet/coreclr#13767

I would be delighted if this handy feature was also available in Mono.

I have in part based my changes on the CoreCLR implementation. There all already tests for this feature in corefx, so I have added those to the corlib_xtest.dll.sources file.

I have a couple of concerns about my implementation:
- I notice that `DynamicMethod.Invoke` was ignoring the BindingFlags and other arguments. I changed this method to pass along all the arguments. For what it's worth, it appears that [CoreCLR respects](https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs#L488) these arguments.
2018-03-29 14:18:27 +02:00
Zoltan Varga 9ff460b004 [sdks] Disable wasm on the ios sdk lane. (#7894) 2018-03-29 01:24:30 -04:00
Ludovic Henry e70a872c53 [sdks] Fix usage of MXE for XA (#7897) 2018-03-28 22:03:15 -04:00
PiotrCW 5841ffff03 [System.Windows.Forms] Ignore non-visible controls when computing ScrollableControl canvas size (#4247) 2018-03-29 03:56:44 +02:00
Ludovic Henry 407e254643 [sdks] Pass LLVM_SRC from XA to use xamarin-android/external/llvm + Pass IGNORE_PACKAGE_MXE from XA + Only checkout specific MXE and LLVM commit when cloning (#7893)
* [sdks] Pass LLVM_SRC from XA to use `xamarin-android/external/llvm`

We do not clone to `$(LLVM_SRC)` because this is up to XA.

* [sdks] Pass IGNORE_PACKAGE_MXE from XA

This is to avoid rebuilding MXE while XA already took care of it.

* [sdks] Only checkout specific MXE and LLVM commit when cloning
2018-03-28 21:41:58 -04:00
Ludovic Henry 6c901dbfc5 [sdks] Pass MXE_SRC from XA to use xamarin-android/external/mxe (#7888)
We do not clone to or remove `$(MXE_SRC)` because this is up to XA.
2018-03-28 18:23:34 -04:00
Ludovic Henry ff40ceff38 check for iconv only once (#7873)
It is enough to check for iconv
dependencies once in the eglib/configure
- just use the generated libtool
library file to automatically
add additional dependencies (if any).

While here, make sue libeglib.a
has libraries returned by LTLIBTOOL
as a libtool dependency.
2018-03-28 17:05:55 -04:00
Marek Safar e3e1fe1c16 [corlib] Moves DynamicMethod to mscorlib to work better with wasm (#7875)
* [corlib] Moves DynamicMethod to mscorlib to work better with wasm

* Bump API snapshot submodule
2018-03-28 20:15:27 +02:00
Zoltan Varga ada6edbad8 [bcl] Fix the compilation of System tests in the mobile profile. (#7882) 2018-03-28 19:57:41 +02:00
monojenkins 2f66873ab2 [msvc] Update csproj files (#7811)
* [msvc] Update csproj files

* [msvc] Delete old net_4_x.csproj and xbuild_12.csproj files
2018-03-28 19:29:28 +02:00
Zoltan Varga 753cc874f6 [jit] Add signature checking for CALLI. (#7832)
Fixes #7792.
2018-03-28 13:17:30 -04:00
Alexander Köplinger ab62d30edb [genproj] Move obj to common folder and remove unnecessary properties (#7870)
* [genproj] Move obj to common folder and remove unnecessary properties

We now default to mcs/class/obj instead of writing to the assembly folder.

* [genproj] Fix jay path on Unix

* [genproj] Fix IntermediateOutputPath for Facades
2018-03-28 17:51:47 +02:00
Marek Safar 8c86a805ff [mcs] Updates common array bounds unification to use universal type comparer 2018-03-28 17:25:37 +02:00
Calvin b42086d450 Use __PASE__ for things i needs that AIX doesn't (#7858)
IBM's new toolchain for i defines __PASE__, and if cross-compiling
from AIX, we can pass `CPPFLAGS="-D__PASE__"` to `./configure` as
needed.
2018-03-28 11:01:05 -04:00
Alexander Köplinger f00eba8a7c Whitelist illinkanalyzer in macOS package (#7861)
Fixes #7860
2018-03-28 15:09:26 +02:00
Alexis Christoforides 4a247e7ed9 Merge pull request #7740 from alexischr/corefx-unknownunix-fsw
[System.IO] Use CoreFX FileSystemWatcher stub for mobile profile
2018-03-28 08:40:07 -04:00
monojenkins 03a153c7b3 Bump API snapshot submodule 2018-03-28 12:39:33 +00:00
Martin Baulig e6f90edfcd [System]: Disable the System.Net.ServicePoint tests from corefx.
These tests never passed and are only spewing error message output,
making it much harder to see actual failures.
2018-03-28 12:06:48 +02:00
jaykrell 0f9b7f730f mono_perfcounter_counter_names returns incorrect names, and restructure slightly for clarity (#6355)
* Add some PerformanceCounter test code from reference source and MSDN,
combined and lightly edited per local conventions.

* Restructure PerformanceCounter code for type safety and fix incorrect typing.
2018-03-28 11:52:11 +02:00
hgy59 9b36f1452f wcf: fix index of message body parts. Do not use MessageBodyMemberAttribute.Order as index. 2018-03-28 10:46:43 +02:00
Alexis Christoforides 3c8bf90a40 [System.IO] Use CoreFX FileSystemWatcher stub for mobile profile 2018-03-27 18:05:07 -04:00
Alexis Christoforides 6caa9bd881 Disable a flaky FileSystemWatcher test 2018-03-27 17:01:52 -04:00
Alexis Christoforides 7e31c5d11f Merge pull request #7849 from marek-safar/corefx-fixes
[corlib] Restores ConcurrentDictionary serialization support.
2018-03-27 16:58:46 -04:00
Marek Safar 294707cf88 [build] Fixes bootstrap invocation of cil-stringreplacer 2018-03-27 18:07:22 +02:00
Aleksey Kliger (λgeek) dc1ef2ea3a [runtime] One more MonoClass getter fixup (#7836)
* [monograph] Don't link duplicate copies of metadata and utils

Monograph builds against mono/mini/($LIBMONO_LA) (aka libmonosgen-2.0.la), so
the only pieces it would pick up from staticlly linking the extra libs are
non-API functions (such as the MonoClass getters), but at the cost of linking
errors due to duplicate symbols.

Also replace calls to MonoClass getters by mono API functions.

* [ilgen] Fixup MonoClass getter usage

Followup for e610e443cd

* [boehm] Fix a few direct MonoClass accesses

* [monograph] Statically link against the mono runtime

Dynamically linking but using some symbols (such as mono_read32) on some
platforms that are hidden in the library means that we had to statically link
against the runtime anyway, which then caused build issues.

* [monograph] Fix runtime crash on startup

```
mono_os_mutex_lock: pthread_mutex_lock failed with "Invalid argument" (22)
```

* [msvc] Fix monograph build
2018-03-27 10:57:23 -04:00
Marek Safar dc6700a799 [corlib] Restores ConcurrentDictionary serialization support.
Fixes #7822
2018-03-27 14:38:10 +02:00
Marek Safar 32e6bccc2d [System] Makes TLS providers linker friendly 2018-03-27 14:34:34 +02:00
Marek Safar 554690a64c [build] Update monolite package to support cil-stringreplacer (#7847) 2018-03-27 14:31:05 +02:00
Alexander Köplinger 96e8fa67e2 [bcl] Fix Cscompmgd/I18N.Rare not having any tests (#7842)
This caused a warning in some tools that process the NUnit result xml.
The fix is to make them execute at least one test.
2018-03-27 13:36:31 +02:00
Katelyn Gadd 3157302581 Pull in bug 53272 fix 2018-03-27 10:01:38 +02:00
Alexander Köplinger 16d5c31409 [ci] Bundle nunit xml results in a .tar file (#7843) 2018-03-27 03:15:43 +02:00
Alexander Köplinger 5e1acb47f5 [genproj] Deduplication of project references (#7844) 2018-03-27 02:47:19 +02:00
Zoltan Varga b20d5ce1e5 [runtime] Rework how the native-to-managed eh callback is called. (#5837)
* [runtime] Rework how the native-to-managed eh callback is called.

Instead of catching all exceptions in the native-to-managed wrapper and calling the callback from the catch clause, call it directly from the EH code. The
previous approach caught all exceptions, which messed up debugging, since the debugger wouldn't break on uncaught exceptions raised from native-to-managed
callbacks.

* [coop] Enable tests bug-58782-plain-throw and bug-58782-capture-and-throw for PRs

* [mini] Installed native-to-managed exception handling callback from second pass.

The constraints are:
1. We must allow managed exceptions to be caught and finally blocks must run
2. We must not call the unmanaged exception handler if the first unwinding pass
   detects that there is a native-to-managed wrapper and a callback is
   installed that will handle managed exceptions (by unwinding the native code
   and either re-raising the managed exception or otherwise dealing with it).

So we change the return value of handle_exception_first_pass to be:
- MONO_FIRST_PASS_HANDLED - caught by a managed frame (with a matching filter if one was present).
- MONO_FIRST_PASS_CALLBACK_TO_NATIVE - there's a native-to-managed wrapper and a ftnptr_eh_callback is installed.
- MONO_FIRST_PASS_UNHANDLED - first pass unwound all the way and there was no wrapper or there was no callback installed.

In mono_handle_exception_internal, we treat MONO_FIRST_PASS_CALLBACK_TO_NATIVE
as handled and unwind the managed stack, invoking finally clauses as we go,
until we reach the managed-to-native frame, at which point we invoke the callback.

* [test] Test for mono_install_ftnptr_eh_callback

* [test] AOT-friendly test for mono_install_ftnptr_eh_callback
2018-03-26 15:37:34 -04:00
Ludovic Henry 2b663424a0 [threads] Remove suspicious mono_gchandle_free
Fixes https://github.com/mono/mono/issues/7786
2018-03-26 17:58:29 +02:00
Jason Imison f66032b7c0 Fix F# build. (#7826)
We need to be specific about the type of `switchName` as
String.StartsWith got a new char overload.

Fixes #7805
2018-03-26 15:06:52 +02:00
Michael DeRoy e610e443cd Structure field that cannot be marshalled throws exception instead of aborts\n Alllow structure pointer conversion for blittable multi-dimentional arrays (#7794) 2018-03-25 23:11:44 -04:00
Aleksey Kliger (λgeek) febd5ac535 MonoClass getters mop-up PR (#7806)
* [sre-save] Remove type_token assignment in mono_image_fill_export_table

In 9725d50c87 we added the `g_error`, that should
fire if the MonoClass:type_token and the TypeBuilder token ever disagree. As a
result, this assignment is strictly redundant.

* [pedump] Use MonoClass getters

* [monograph] Use MonoClass getters

* [mini] Use MonoClass getters in a few more places

Catch up with recent commits.
2018-03-24 19:03:43 -04:00
Aleksey Kliger (λgeek) a5099ca2a4 [mini] Use MonoClass getters in method-to-ir.c (#7772) 2018-03-24 11:29:34 -04:00
Aleksey Kliger (λgeek) 2ce121ab7b [sre-save] Remove type_token assignment in mono_image_fill_export_table (#7803)
In 9725d50c87 we added the `g_error`, that should
fire if the MonoClass:type_token and the TypeBuilder token ever disagree. As a
result, this assignment is strictly redundant.
2018-03-24 11:28:44 -04:00
Zoltan Varga 2f5077a1fb [sdks] Fix the ios sdk build. (#7801) 2018-03-24 09:53:38 -04:00
Ludovic Henry dde9ee5e79 [w32handle] Lower minimum memory usage (2nd attempt) (#7508)
Adopts a linked list of MonoW32HandleSlot (based on feedback from Rolf Kvinge). This allows for an unlimited amount of handles to be allocated, as well as for a lower cost to allocate only 1 handle across the process.

Fixes https://github.com/mono/mono/issues/7460
2018-03-23 23:00:50 -04:00
Ludovic Henry 30903764c2 [sdks] Fix Android build for toolchain (#7817) 2018-03-23 21:17:43 -04:00
Aleksey Kliger (λgeek) 2709d2309e [mini] Use MonoClass getters on non-AMD64 platforms (#7799)
Best effort to replace direct MonoClass field access by getters.
2018-03-23 20:50:42 -04:00
Alexander Köplinger 506fc0b522 [genproj] Deduplication of sources (#7810)
This implements a simple deduplication of source files in the .csproj's.

A postprocessing step opens the files and grabs all ItemGroups with sources
and then does an intersection. It then moves files that are common
across all platforms into a separate ItemGroup.
2018-03-23 23:56:02 +01:00
jaykrell 331f3d9f27 Fix warnings and cleanup style. (#7800)
* Fix warning: Add static.

* Fix warning: Remove unused function from a recent incorrect merge/rebase.

* Fix warning(s): Cast away const.

* Add static to avoid global link-namespace pollution.

* Add const on input strings.

* (void) and () are not the same in C, overwhelmingly you want (void)
{0} does not portably zero unions, so favor memset
braces at start of function go on their own line
space before parens on function calls
spaces around binary operators
favor memset (x, 0, sizeof(x)) instead of memset (x, 0, sizeof(type))
favor TRUE/FALSE over true/false unless/until we switch to C++
2018-03-23 15:45:34 -07:00
Katelyn Gadd 954911d3f1 Genproj updates for BCL build in Windows Visual Studio (#7755)
This batch of commits makes further updates to our support for building the BCL using msbuild (Visual Studio, to be specific).

* Generates a single sln and set of csproj files with support for all of our build profiles (orbis, monodroid, net_4_x, etc)
* Project configuration selector (in VS or as parameter to msbuild) can be used to select which profile to build
* Includes partial dependency information so that culevel and jay are compiled before the rest of the sln (this keeps pre/post events from from failing on first build)

As of this rev things are working pretty good, but a lot of the measures I took here are temporary so I'd appreciate thoughts on how to go about them. The hard-coded System.Web -> Culevel dependency feels gross, for example - I kind of want to go through and build an automatic solution for it but I'm not sure it's necessary.

Implements #6858

---

* Checkpoint: Generate single .csproj file with conditional item/property groups

* Checkpoint: Updates to csproj and sln generation to support building specific profiles

* Move targets file in csproj template so that it isn't evaluated before all properties are set

* Checkpoint profile fallback (use net_4_x if project does not have appropriate profile)

* Use in-process cache for project guids to fix bug where many guids were being generated. Fix profile fallback.

* Clean up unnecessary debug writelines

* genproj error fixes

* Remove duplicate gacutil entry from makefile to fix order.xml corruption. Cleaner project names in msbuild sln. Compile genproj before generating inputs.

* Delete genproj.exe at beginning of update-solution-files because otherwise syntax errors will cause an old version to be used silently
Cleaner messages from genproj

* Hard-code the guid for culevel and add it as a dependency for system.web

* Bug fixes

* sln files are sensitive to whitespace format

* Don't generate pointless solution configurations if we have no information for them

* Updates based on PR feedback
2018-03-23 23:35:21 +01:00
Aleksey Kliger (λgeek) 431c67415c [mini] Use MonoClass getters in aot-compiler.c (#7773) 2018-03-23 18:33:39 -04:00
Aleksey Kliger (λgeek) 76f0193388 [ci] For checked builds, pass -k to make (#7802)
I'd like to see more compilations errors in checked build results - so run with `make -k`
2018-03-23 20:53:07 +01:00
Egor Bogatov 43d9c4737b Imports FtpWebRequest from CoreFX (#7644)
Contributes to #7682

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

FtpWebRequest used to work incorrectly with sub directories.
Let's say we have a following FTP structure

```
myserver
├── file1
└── subdir
    └── file2
    └── file3
```
Old behavior:

### 1) For `ftp://myserver/subdir/` printed:
```
file2
file3
```
Expected:
```
file2
file3
```

### 2) For `ftp://myserver/subdir` printed:
```
file1
subdir
```
Expected:
```
subdir/file2
subdir/file3
```
### 3) For `ftp://myserver/subdir/file2` printed:
```
file2
file3
```
Expected:
```
file2
```

With the fix in this PR it works as expected (matches netfx and netcore behaviors).
2018-03-23 20:50:52 +01:00
Alexis Christoforides bc25029b58 Disable some flaky tests.
https://github.com/mono/mono/issues/7568
2018-03-23 15:03:54 -04:00
Zoltan Varga 901ccebb0a [sdks] Disable the interpreter on ios device builds. (#7793) 2018-03-23 14:22:24 -04:00
Marek Safar e3c284c4e3 CodeOwners update (#7798) 2018-03-23 13:13:33 -04:00
Rodrigo Kumpera 74daf13fb2 Harden JIT job control against cctors deadlocking. (#7423)
* [mini] Don't wait for other threads to finish JITing if the current thread is running a cctor.

This eliminates a possible source of deadlocks found during AOT runs of Roslyn.

* [mini] Introduce a 1s timeout to JIT job control to ensure we don't simply deadlock in case of execution dependency bugs.

* [mini] fix spelling5DD
2018-03-23 17:43:30 +01:00
Aleksey Kliger (λgeek) 7bb6e59e38 [runtime] Fix lock tracer compilation error (#7767) 2018-03-23 11:58:38 -04:00
Egor Bogatov 1bdcf19169 [corlib] System.Collections from CoreFX (#7478) 2018-03-23 16:23:27 +01:00
Aleksey Kliger (λgeek) 3aeab61192 [mini] Use MonoClass getters in a few files (#7771)
* [metadata] Use getters in a few ilgen files

* [mini] Use MonoClass getters in several files

* [mini] Use MonoClass getters in mini-generic-sharing.c

* [debugger-agent] Use MonoClass getters

* [monodis] Use MonoClass getters in get.c
2018-03-23 11:01:10 -04:00
Aleksey Kliger (λgeek) 158bb416eb [interp] Use MonoClass getters (#7774)
* [interp] Use MonoClass getters in interp/interp.c

* [interp] Use MonoClass getters in interp/transform.c
2018-03-23 09:35:53 -04:00
Filip Navara b06de64bf8 Fallback to listing drives in My Computer using System.IO.DriveInfo. 2018-03-23 14:22:34 +01:00
jaykrell b8fdce6c05 [Tailcall] Fix virtual generic methods that F# tests uses. (#7524)
* [Tailcall] Add but do not use the F# tailcall test suite.

* [Tailcall] Compute inst_tailcall much earlier, it is cheap, and it will be used more and earlier.

* [Tailcall] Compute supported_tail_call and tail_call earlier.

* [Tailcall] Fix virtual generic methods that F# test TailCallLoopGenericClassAndMethodAbstractClass<byte>.Method3<byte> uses.
There is a general problem of customized code paths missing pieces.
This fixes just part of it.

* [Tailcall] Use common code for removing ret after tailcall, and not handling return value.

* [Tailcall] Cleanup.

* [Tailcall] Short circuit looking at parameters for has_vtargs.

* [Tailcall] Tailcalls presumably do not need sequence points, or anything, after them.

* [Tailcall] Fewer labels, more booleans, move existing label up, with additional booleans
 controlling its behavior -- intent is to tease one altered behavior (tailcall of
 virtual generic) and one existing and one new sharing of common code (remove_ret).
 Longer term might have more tailcall handling.

* [Tailcall] F# tests closer to original.

* [Tailcall] Add the F# tests in blob form.
comment out the two failing tests
fsharpc --standalone --optimize- fsharp.fs
monolinker fsharp.exe to trim a little
change resource-using code to use constant strings

* [Tailcall] CI fails roughly where local passes.

* [Tailcall] Merge fsharp.fs into fshar.il as a comment.

* [Tailcall] Cleanup, remove unused labels, etc.

* [Tailcall] Cleanup test code some.

* [Tailcall] Cleanup.

* [Tailcall] Try harder to disable fsharp for AOT due to CI failures.
2018-03-23 06:11:41 -07:00
Neale Ferguson 066ce33825 Add tailcall support & fix floating point ABI (#7695)
* Add tailcall support and fix floating point ABI

* Remove unneeded function

* Add terminal condition
2018-03-23 08:49:29 -04:00
Bernhard Urban d233bdbf99 [icall] remove DISABLE_PROCESS_HANDLING (#7779)
The only user was Xamarin.iOS in a weird way: The define is only set for
device builds where the icall table is excluded anyway. For the cross
compiler however, the define isn't set, and therefore those icalls can
be resolved by the AOT compiler.

With the interpreter now, this define actually had an effect: The
guarded icalls weren't inclueded in `libmono-icall-table.a`.
2018-03-23 07:51:32 -04:00
Bernhard Urban 7de72fbf3f [interp] support increment and decrement of nint/nuint
update definition to be in sync with XI
2018-03-23 11:27:50 +01:00
Bernhard Urban d424774751 [interp] improve error message and add another interp_in signature 2018-03-23 11:27:26 +01:00
Miguel de Icaza dfabaa5917 Remove incorrect docs (#7784)
* [mkbundle] Automatically bundle config files and machine.config files for the simple/cross compiler scenario, fixes one of the missing issues for #6230

* Remove debug writeline

* Remove outdated information

* Bump API snapshot submodule
2018-03-23 10:54:41 +01:00
Zoltan Varga 67e995c6e2 [interp] Improve mixed mode execution support, using full-aot+interp as the configuration. (#7764)
* [interp] Handle mono_handle_exception () returning a ctx which refers to JITted code by restoring the context.

* [aot] Clear the pinvoke flag from the interp_in wrapper signatures, so they get an lmf in mini_get_interp_in_wrapper (), this is needed for mixed-mode exception handling.

* [aot] Change the semantics of the 'interp' option, use it only to emit additional interp wrappers etc. instead of disabling code generation as well.

* [aot] Emit more interp-in/interp-out wrappers when using --aot=full,interp.

* Add a --interp=interp-only= command line option, used for testing.
In full-aot+interp mode, prefer full-aot code instead of interp code, except for methods in the classes listed
in the interp-only option.
Use normal runtime invokes in full-aot+interp mode.

* [interp] Prefer AOTed code when making calls out of interpreted code in full-aot mode.

* [aot] When running with --aot=interp, preserve the previous behavior of only emitting interp wrappers and trampolines.
2018-03-22 21:17:44 -04:00
Ludovic Henry 9c63d1bf9d [sdks] Fix Android build for mxe (#7781) 2018-03-22 20:42:46 -04:00
Ludovic Henry 8a3b4bf2af [sdks] Fix Android build on Linux (#7775) 2018-03-22 18:20:00 -04:00
Bernhard Urban 95d450660b [interp] move variable decl into ifdef to avoid unused warning (#7763) 2018-03-22 17:49:31 -04:00
jaykrell 392e1c368c [Tailcall] Proper fix for F# regression, at least some architectures. (#7658)
* Revert "[Tailcall] Quick fix for building F#. Do not tailcall any method with a vtable_arg. (#7609)"

This reverts commit 8ceead93e3.

* [Tailcall] Correct fix for regression from change b4ee86154f.
Regression test not yet available.

* extra brace

* [Tailcall] Add FIXME for tail. not followed by ret. Correct behavior is to raise an exception, not fail an assert.

* [Tailcall] Add disabled debug code to break when compile a tailcall and/or execute a tailcall.

* [Tailcall] Add disabled debug code to try to tailcall any call followed by a ret.
This might be reasonable in the future, as well as a little data flow
analysis skipping nops and branches, as csc w/o -optimize outputs.

* [Tailcall] Add more tailcall tests, i.e. that would
have caught recent regression.

* [Tailcall] Replace #if 0 with MONO_DEBUG=tailcall_break_compile,tailcall_break_run,tailcall_try_all,tailcall_log,
tailcall_all. Consider MONO_TAILCALL_DEBUG instead.

* Revert "[Tailcall] Replace #if 0 with MONO_DEBUG=tailcall_break_compile,tailcall_break_run,tailcall_try_all,tailcall_log,"

This reverts commit 796d9490f672625189dfac47ff24b05f3fb65cbe.

* [Tailcall] Replace #if 0 with ifdefs:
define DEBUG_TAILCALL_BREAK_COMPILE   breakpoint in method-to-ir
define DEBUG_TAILCALL_BREAK_RUN 1     codegen outputs breakpoint
define DEBUG_TAILCALL_TRY_ALL 1       consider any call followed by ret, can expand later
define DEBUG_TAILCALL 1               low volume logging under -v instead of -v -v

* [Tailcall] Dial back tailcalls on ARM32, where there is no
volatile non-parameter register in the ABI, in which to pass
an extra parameter. (Why not just pass as a regular first/last parameter?)

* [Tailcall] Dial back untested architectures MIPS S390x PowerPC SPARC.

* [Tailcall] Copy tailcall-generic-cast-il.il to tailcall-generic-cast-nocrash-il.il and tailcall-generic-cast-conservestack-il.il

All platforms should be able to run it without crash,
but only some can run it and conserve stack.

* [Tailcall] Finish splitting tailcall-generic-cast into nocrash and conservestack variations.
All platforms can run nocrash, only some conservestack.

* [Tailcall] Nested if and ifdef in certain order do not render well in some editors, so just use if.

* [Tailcall] Fix typo.

* [Tailcall] Disable tailcall-mrgctx.exe and tailcall-rgctxa.exe on ARM32 MIPS PowerPC due to MONO_ARCH_HAVE_VOLATILE_NON_PARAM_REGISTER=0 SPARC has no disabling.
ARM32 is very difficult to fix, maybe not possible.
The other architectures are not tested, so the progress is not enabled.
2018-03-22 14:10:52 -07:00
Ludovic Henry 45c94b22ab [sdks] Fix Android build (#7768) 2018-03-22 16:52:51 -04:00
Marek Safar d856789ccd Bump corefx to bring a fix for #7696 2018-03-22 19:49:07 +01:00
Zoltan Varga 9bc0a49bc7 [runtime] Fix the cross compiler build. (#7754) 2018-03-22 14:33:49 -04:00
Alexis Christoforides 3d2891097a Merge pull request #7748 from lambdageek/fix-gc-descr-object-c
[metadata] Move mono_class_compute_gc_descriptor back to object.c
2018-03-22 13:59:42 -04:00
monojenkins 3283af3449 [msvc] Update csproj files 2018-03-22 18:00:21 +01:00
jaykrell 3ec9fda371 [System.Core] Guard against embedded NUL in strings for MemoryMappedFiles (#7318) 2018-03-22 17:32:06 +01:00
Alexis Christoforides 6822a57663 Disable a flaky test.
https://github.com/mono/mono/issues/7568
2018-03-22 11:58:01 -04:00
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
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
3598 changed files with 251122 additions and 218293 deletions

No files matched your search

+10 -1
View File
@@ -42,17 +42,21 @@
/mcs/build @marek-safar @akoeplinger
/mcs/class @marek-safar @akoeplinger
/mcs/class/corlib/Mono @baulig
/mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
/mcs/class/corlib/System.Security.Cryptography.X509Certificates @baulig
/mcs/class/Mono.Btls.Interface @baulig
/mcs/class/Mono.Data.Tds @egorbo
/mcs/class/Mono.Debugger.Soft @vargaz
/mcs/class/Mono.Options @jonpryor
/mcs/class/Mono.Profiler.Log @alexrp
/mcs/class/Mono.Security/Mono.Security/Interface @baulig
/mcs/class/System/Mono @baulig
/mcs/class/System/Mono.AppleTls @baulig
/mcs/class/System/Mono.Btls @baulig
/mcs/class/System/Mono.Net.Security @baulig
/mcs/class/System/Mono.Security.Interface @baulig
/mcs/class/System/System.Security.Cryptography.X509Certificates @baulig
/mcs/class/System.Data* @egorbo
/mcs/errors @marek-safar
@@ -87,6 +91,8 @@
/mono/mini/*profiler* @alexrp
/mono/mini/debugger-agent.c @DavidKarlas
/mono/native @baulig
/mono/profiler @alexrp @kumpera
/mono/sgen @BrzVlad @kumpera
@@ -102,7 +108,7 @@
/msvc/*profiler* @alexrp
/msvc/scripts @akoeplinger @kg
/packaging/ @alexischr @akoeplinger @luhenry
/packaging/ @alexischr @akoeplinger @luhenry @directhex
/packaging/MacSDK/msbuild.py @radical @akoeplinger
/runtime @akoeplinger @marek-safar @luhenry
@@ -116,6 +122,9 @@
/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
+8 -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.
@@ -8,19 +12,19 @@
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,14 +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 stack trace here if available.
```
<!--
You can join us at https://gitter.im/mono/mono to discuss your reported issue
-->
+2 -1
View File
@@ -90,6 +90,7 @@ stamp-h.in
*.swp
*.o
.deps
.libs
# Libtool
libtool.m4
@@ -130,4 +131,4 @@ mono-*.tar.*
tmpinst-dir.stamp
msvc/scripts/inputs/
extensions-config.h
*.mlpd
+4
View File
@@ -58,3 +58,7 @@
[submodule "external/api-snapshot"]
path = external/api-snapshot
url = git://github.com/mono/api-snapshot.git
[submodule "external/llvm"]
path = external/llvm
url = git://github.com/mono/llvm.git
branch = release_60
+1 -1
View File
@@ -87,5 +87,5 @@
}
}
],
"version": 3
"version": 4
}
+5 -3
View File
@@ -11,9 +11,9 @@ else
tools_dir = tools
endif
SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
SUBDIRS = mk po $(libgc_dir) llvm mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests
# Keep in sync with SUBDIRS
DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
DIST_SUBDIRS = m4 mk po $(libgc_dir) llvm mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests
all: update_submodules
@@ -126,6 +126,7 @@ package-inputs:
(echo " <project dir=\"$$1\" library=\"$$2\">"; \
read boot; echo " <boot>$$boot</boot>"; \
read flags; echo " <flags>$$flags</flags>"; \
read sources;echo " <sources>$$sources</sources>"; \
read output; echo " <output>$$output</output>"; \
read built; echo " <built_sources>`echo $$built | sed 's/\\\/\\\\/g'`</built_sources>"; \
read libou; echo " <library_output>$$libou</library_output>"; \
@@ -144,9 +145,10 @@ update-llvm-version:
update-solution-files:
cd msvc/scripts && $(MAKE) genproj.exe || exit $$?;
$(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
+17 -14
View File
@@ -3,7 +3,7 @@ create cross platform applications. It is an open source
implementation of Microsoft's .NET Framework based on the ECMA
standards for C# and the Common Language Runtime.
The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.org/)
The Mono project is part of the [.NET Foundation](https://www.dotnetfoundation.org/)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mono/mono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
@@ -30,6 +30,7 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or
| Windows | i386 | [![windows-i386][17]][18] |
| CentOS | s390x (cs) | [![centos-s390x][19]][20] |
| Debian 9 | ppc64el (cs) | [![debian-9-ppc64el][21]][22]|
| AIX | ppc64 (cs) | [![aix-ppc64][23]][24] |
_(cs) = community supported architecture_
@@ -55,6 +56,8 @@ _(cs) = community supported architecture_
[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-9-ppc64el/badge/icon
[22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
[23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
[24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
Compilation and Installation
============================
@@ -63,15 +66,15 @@ Building the Software
---------------------
Please see our guides for building Mono on
[Mac OS X](http://www.mono-project.com/docs/compiling-mono/mac/),
[Linux](http://www.mono-project.com/docs/compiling-mono/linux/) and
[Windows](http://www.mono-project.com/docs/compiling-mono/windows/).
[Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
[Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and
[Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
Note that building from Git assumes that you already have Mono installed,
so please download and [install the latest Mono release](http://www.mono-project.com/download/)
so please download and [install the latest Mono release](https://www.mono-project.com/download/)
before trying to build from Git. This is required because the Mono build
relies on a working Mono C# compiler to compile itself
(also known as [bootstrapping](http://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
(also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
If you don't have a working Mono installation
---------------------------------------------
@@ -200,9 +203,9 @@ Contributing to Mono
====================
Before submitting changes to Mono, please review the [contribution
guidelines](http://www.mono-project.com/community/contributing/).
guidelines](https://www.mono-project.com/community/contributing/).
Please pay particular attention to the [Important
Rules](http://www.mono-project.com/community/contributing/#important-rules)
Rules](https://www.mono-project.com/community/contributing/#important-rules)
section.
Reporting bugs
@@ -212,7 +215,7 @@ To submit bug reports, please [open an issue on the mono GitHub repo](https://gi
Please use the search facility to ensure the same bug hasn't already
been submitted and follow our
[guidelines](http://www.mono-project.com/community/bugs/make-a-good-bug-report/)
[guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
on how to make a good bug report.
Configuration Options
@@ -241,12 +244,12 @@ Disables the inclusion of a Boehm garbage collector.
* This defaults to `included`.
* `--with-cooperative-gc`
* `--enable-cooperative-suspend`
* If you pass this flag the Mono runtime is configured to only use
the cooperative mode of the garbage collector. If you do not pass
this flag, then you can control at runtime the use of the
cooperative GC mode by setting the `MONO_ENABLE_COOP` flag.
cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
* `--with-tls=__thread,pthread`
@@ -432,7 +435,7 @@ for Mono. The LLVM code generator and optimizer will be
used instead of Mono's built-in code generator for both
Just in Time and Ahead of Time compilations.
* See http://www.mono-project.com/docs/advanced/mono-llvm/ for the
* See https://www.mono-project.com/docs/advanced/mono-llvm/ for the
full details and up-to-date information on this feature.
* You will need to have an LLVM built that Mono can link
@@ -501,7 +504,7 @@ also, see the man page.
* This configures the Mono compiler to generate code
suitable to be used by Google's Native Client:
http://code.google.com/p/nativeclient/
https://code.google.com/p/nativeclient/
* Currently this is used with Mono's AOT engine as
Native Client does not support JIT engines yet.
@@ -575,7 +578,7 @@ file for information about Microsoft's patent grant.
Mono Trademark Use Policy
=========================
The use of trademarks and logos for Mono can be found [here](http://www.dotnetfoundation.org/legal/mono-tm).
The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm).
Maintaining the Class Library Solution Files
============================================
@@ -1,14 +0,0 @@
using System;
using System.IO;
using System.Reflection;
namespace System.Runtime.Loader
{
public static class AssemblyExtensions
{
public static Type[] GetTypes(this Assembly assembly)
{
return assembly.GetTypes ();
}
}
}
+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": "7a840bd5697ef6ea41f554a09d837636fba9d88d",
"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": "f3d9c9f742f9dcb5faf40080db5e7f464dab7e7c",
"remote-branch": "origin/mono",
"branch": "mono",
"directory": "coreclr"
+8 -9
View File
@@ -2162,7 +2162,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleepsilon.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleequals1.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleequals2.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doublegethashcode.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletoboolean.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletobyte.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/double/doubleiconvertibletodatetime.cs \
@@ -3242,7 +3241,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/security/securityexception/securityexceptionctor3.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/security/securityexception/securityexceptiontostring.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleepsilon.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singlegethashcode.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisinfinity.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisnan.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/single/singleisnegativeinfinity.cs \
@@ -3691,9 +3689,8 @@ CORECLR_STRESSTEST_RUNNER_CS_SRC= \
$(CORECLR_PATH)/tests/src/GC/Stress/Framework/RFLogging.cs \
$(CORECLR_PATH)/tests/src/GC/Stress/Framework/DetourHelpers.cs \
$(CORECLR_PATH)/tests/src/GC/Stress/Framework/LoaderClass.cs \
GCStressTests/AssemblyLoadContext.cs \
GCStressTests/AssemblyExtensions.cs
GCStressTests/AssemblyLoadContext.cs
CORECLR_TESTLIBRARY_CS_SRC = \
$(CORECLR_PATH)/tests/src/Common/CoreCLRTestLibrary/TestFramework.cs \
$(CORECLR_PATH)/tests/src/Common/CoreCLRTestLibrary/Utilities.cs \
@@ -3715,7 +3712,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 \
@@ -3855,7 +3852,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 \
@@ -3963,7 +3960,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 \
@@ -4969,7 +4966,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 \
@@ -5061,6 +5057,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
+1 -1
View File
@@ -1,5 +1,5 @@
check-roslyn:
@$(MAKE) validate-roslyn RESET_VERSIONS=1
cd $(ROSLYN_PATH); \
./mono-testing.sh "$(XUNIT)" || exit; \
./build.sh --restore --build --test --mono || exit; \
echo "done"
+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; }
+11395
View File
File diff suppressed because it is too large. Load diff
+1298 -435
View File
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -11,6 +11,9 @@
<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/@MONO_NATIVE_LIBRARY_NAME@@libsuffix@" os="!windows" />
<dllmap dll="System.Net.Security.Native" target="$mono_libdir/@MONO_NATIVE_LIBRARY_NAME@@libsuffix@" os="!windows" />
<dllmap dll="System.Security.Cryptography.Native.Apple" target="$mono_libdir/@MONO_NATIVE_LIBRARY_NAME@@libsuffix@" os="osx" />
<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"/>
@@ -40,5 +43,4 @@
<dllmap dll="gdiplus.dll" target="@libgdiplus_install_loc@" os="!windows"/>
<dllmap dll="gdi32" target="@libgdiplus_install_loc@" os="!windows"/>
<dllmap dll="gdi32.dll" target="@libgdiplus_install_loc@" os="!windows"/>
<dllmap dll="System.Native" target="__Internal"/>
</configuration>
+12 -12
View File
@@ -53,7 +53,7 @@ def stringify_class_name(ns, name):
if ns == "":
return name
else:
return "{}.{}".format (ns, name)
return "{0}.{1}".format (ns, name)
class ArrayPrinter:
"Print a C# array"
@@ -66,7 +66,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
class ObjectPrinter:
"Print a C# object"
@@ -96,7 +96,7 @@ class ObjectPrinter:
return (field.name, self.obj [field.name])
except:
# Superclass
return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name))))
return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name))))
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
@@ -109,7 +109,7 @@ class ObjectPrinter:
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
if class_name [-2:len(class_name)] == "[]":
return {}.__iter__ ()
gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name))
gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name))
return self._iterator(obj.cast (gdb_type))
except:
print (sys.exc_info ()[0])
@@ -129,12 +129,12 @@ class ObjectPrinter:
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name))
gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name))
except:
# Maybe there is no debug info for that type
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
#return obj.cast (gdb_type)
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
return class_name
except:
print (sys.exc_info ()[0])
@@ -154,9 +154,9 @@ class MonoMethodPrinter:
val = self.val.dereference ()
klass = val ["klass"].dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
return "\"{}:{} ()\"".format (class_name, val ["name"].string ())
return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ())
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
class MonoClassPrinter:
"Print a MonoClass structure"
@@ -169,9 +169,9 @@ class MonoClassPrinter:
return "0x0"
klass = self.val.dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
return "\"{}\"".format (class_name)
return "\"{0}\"".format (class_name)
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
def lookup_pretty_printer(val):
t = str (val.type)
@@ -245,4 +245,4 @@ exec_file = gdb.current_objfile ().filename
if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
exec_file = os.readlink (exec_file)
exec_dir = os.path.dirname (exec_file)
gdb.execute ("source {}/{}-gdbinit".format (exec_dir, os.path.basename (exec_file)))
gdb.execute ("source {0}/{1}-gdbinit".format (exec_dir, os.path.basename (exec_file)))
+16 -16
View File
@@ -48,7 +48,7 @@ def stringify_class_name(ns, name):
if ns == "":
return name
else:
return "{}.{}".format (ns, name)
return "{0}.{1}".format (ns, name)
class ArrayPrinter:
"Print a C# array"
@@ -61,7 +61,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
return "{} [{}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
return "{0} [{1}]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
class ObjectPrinter:
"Print a C# object"
@@ -91,7 +91,7 @@ class ObjectPrinter:
return (field.name, self.obj [field.name])
except:
# Superclass
return (field.name, self.obj.cast (gdb.lookup_type ("{}".format (field.name))))
return (field.name, self.obj.cast (gdb.lookup_type ("{0}".format (field.name))))
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
@@ -105,7 +105,7 @@ class ObjectPrinter:
if class_name [-2:len(class_name)] == "[]":
return {}.__iter__ ()
try:
gdb_type = gdb.lookup_type ("struct {}_{}".format (class_ns.replace (".", "_"), class_name))
gdb_type = gdb.lookup_type ("struct {0}_{1}".format (class_ns.replace (".", "_"), class_name))
return self._iterator(obj.cast (gdb_type))
except:
return {}.__iter__ ()
@@ -127,12 +127,12 @@ class ObjectPrinter:
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
gdb_type = gdb.lookup_type ("struct {}.{}".format (class_ns, class_name))
gdb_type = gdb.lookup_type ("struct {0}.{1}".format (class_ns, class_name))
except:
# Maybe there is no debug info for that type
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
#return obj.cast (gdb_type)
return "{}.{}".format (class_ns, class_name)
return "{0}.{1}".format (class_ns, class_name)
return class_name
except:
print (sys.exc_info ()[0])
@@ -152,9 +152,9 @@ class MonoMethodPrinter:
val = self.val.dereference ()
klass = val ["klass"].dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
return "\"{}:{} ()\"".format (class_name, val ["name"].string ())
return "\"{0}:{1} ()\"".format (class_name, val ["name"].string ())
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_method_full_name ({}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_method_full_name ({0}, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
class MonoClassPrinter:
"Print a MonoClass structure"
@@ -168,11 +168,11 @@ class MonoClassPrinter:
klass = self.val.dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
if add_quotes:
return "\"{}\"".format (class_name)
return "\"{0}\"".format (class_name)
else:
return class_name
# This returns more info but requires calling into the inferior
#return "\"{}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
#return "\"{0}\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*){0})->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
def to_string(self):
try:
@@ -220,7 +220,7 @@ class MonoGenericClassPrinter:
method_inst_str = ""
if int(method_inst.cast (gdb.lookup_type ("guint64"))) != 0:
method_inst_str = str(method_inst)
return "{}, [{}], [{}]>".format (container_str, class_inst_str, method_inst_str)
return "{0}, [{1}], [{2}]>".format (container_str, class_inst_str, method_inst_str)
def to_string(self):
try:
@@ -250,9 +250,9 @@ class MonoTypePrinter:
info = str(t ["data"]["generic_class"])
if info != "":
return "{{{}, {}}}".format (kind, info)
return "{{{0}, {1}}}".format (kind, info)
else:
return "{{{}}}".format (kind)
return "{{{0}}}".format (kind)
except:
#print (sys.exc_info ()[0])
#print (sys.exc_info ()[1])
@@ -281,7 +281,7 @@ class MonoMethodRgctxPrinter:
if i > 0:
inst_str = inst_str + ", "
inst_str = inst_str + type_printer.to_string ()
return "MRGCTX[{}, [{}]]".format (klass_printer.to_string(), inst_str)
return "MRGCTX[{0}, [{1}]]".format (klass_printer.to_string(), inst_str)
class MonoVTablePrinter:
"Print a MonoVTable structure"
@@ -296,7 +296,7 @@ class MonoVTablePrinter:
klass = vtable ["klass"]
klass_printer = MonoClassPrinter (klass)
return "vtable({})".format (klass_printer.to_string ())
return "vtable({0})".format (klass_printer.to_string ())
def lookup_pretty_printer(val):
t = str (val.type)
+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>
+1 -1
+1 -1
+1 -1
+1 -1
+1 -1
Vendored Submodule
+1
Submodule external/llvm added at 8415fd85ce.
+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. */
+37 -9
View File
@@ -42,11 +42,6 @@
# define GC_CONST
# endif
# ifdef __cplusplus
extern "C" {
# endif
/* Define word and signed_word to be unsigned and signed types of the */
/* size as char * or void *. There seems to be no way to do this */
/* even semi-portably. The following is probably no better/worse */
@@ -66,6 +61,10 @@
typedef __int64 GC_signed_word;
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Public read-only variables */
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
@@ -501,7 +500,17 @@ GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
#endif
#if defined(__linux__) || defined(__GLIBC__)
#ifdef __cplusplus
} // extern "C"
#endif
# include <features.h>
#ifdef __cplusplus
extern "C" {
#endif
# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
&& !defined(__ia64__)
# ifndef GC_HAVE_BUILTIN_BACKTRACE
@@ -965,7 +974,17 @@ GC_API void (*GC_is_visible_print_proc)
#if !defined(GC_USE_LD_WRAP) && \
(defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS) || defined(GC_DARWIN_THREADS) || defined(GC_MACOSX_THREADS))
#ifdef __cplusplus
} // extern "C"
#endif
# include "gc_pthread_redirects.h"
#ifdef __cplusplus
extern "C" {
#endif
#endif
# if defined(PCR) || defined(GC_SOLARIS_THREADS) || \
@@ -985,8 +1004,17 @@ extern void GC_thr_init(void); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */
#if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
#ifdef __cplusplus
} // extern "C"
#endif
# include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
# ifdef GC_INSIDE_DLL
BOOL WINAPI GC_DllMain(HINSTANCE inst, ULONG reason, LPVOID reserved);
# endif
@@ -1081,6 +1109,10 @@ extern void GC_thr_init(void); /* Needed for Solaris/X86 */
GC_API void GC_win32_free_heap ();
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) )
/* Allocation really goes through GC_amiga_allocwrapper_do */
# include "gc_amiga_redirects.h"
@@ -1090,8 +1122,4 @@ extern void GC_thr_init(void); /* Needed for Solaris/X86 */
# include "gc_local_alloc.h"
#endif
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* _GC_H */
+8
View File
@@ -44,6 +44,10 @@
# include "gc.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* The following allocators signal an out of memory condition with */
/* return GC_oom_fn(bytes); */
@@ -110,4 +114,8 @@ extern int GC_gcj_debug_kind;
GC_gcj_malloc_ignore_off_page(s,d)
# endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* GC_GCJ_H */
+8
View File
@@ -49,6 +49,10 @@
#ifndef GC_LOCAL_ALLOC_H
#define GC_LOCAL_ALLOC_H
#ifdef __cplusplus
extern "C" {
#endif
/* We assume ANSI C for this interface. */
GC_PTR GC_local_malloc(size_t bytes);
@@ -62,6 +66,10 @@ GC_PTR GC_local_malloc_atomic(size_t bytes);
void * ptr_to_struct_containing_descr);
#endif
#ifdef __cplusplus
} // extern "C"
#endif
# ifdef GC_DEBUG
/* We don't really use local allocation in this case. */
# define GC_LOCAL_MALLOC(s) GC_debug_malloc(s,GC_EXTRAS)
+29
View File
@@ -15,6 +15,11 @@
/* facility in thr_keycreate. Alternatively, keep a redundant pointer */
/* to thread specific data on the thread stack. */
# include <thread.h>
#ifdef __cplusplus
extern "C" {
#endif
int GC_thr_create(void *stack_base, size_t stack_size,
void *(*start_routine)(void *), void *arg, long flags,
thread_t *new_thread);
@@ -26,11 +31,22 @@
# define thr_join GC_thr_join
# define thr_suspend GC_thr_suspend
# define thr_continue GC_thr_continue
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* GC_SOLARIS_THREADS */
#if defined(GC_SOLARIS_PTHREADS)
# include <pthread.h>
# include <signal.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void * (*thread_execp)(void *), void *arg);
@@ -39,6 +55,11 @@
# define pthread_join GC_pthread_join
# define pthread_create GC_pthread_create
# define pthread_detach GC_pthread_detach
#ifdef __cplusplus
} // extern "C"
#endif
#endif
#if defined(GC_SOLARIS_PTHREADS) || defined(GC_SOLARIS_THREADS)
@@ -51,6 +72,10 @@
# include <pthread.h>
# include <signal.h>
#ifdef __cplusplus
extern "C" {
#endif
int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
@@ -87,6 +112,10 @@
# define dlopen GC_dlopen
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* GC_xxxxx_THREADS */
#endif /* GC_PTHREAD_REDIRECTS_H */
+10
View File
@@ -43,7 +43,17 @@
*
*/
# ifdef THREADS
#ifdef __cplusplus
extern "C" {
#endif
void GC_noop1 GC_PROTO((word));
#ifdef __cplusplus
} // extern "C"
#endif
# ifdef PCR_OBSOLETE /* Faster, but broken with multiple lwp's */
# include "th/PCR_Th.h"
# include "th/PCR_ThCrSec.h"
+20 -1
View File
@@ -366,6 +366,10 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
# define BZERO(x,n) bzero((char *)(x),(int)(n))
# endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(DARWIN)
# if defined(POWERPC)
# define GC_MACH_THREAD_STATE_FLAVOR PPC_THREAD_STATE
@@ -413,7 +417,18 @@ void GC_print_callers GC_PROTO((struct callinfo info[NFRAMES]));
* Stop and restart mutator threads.
*/
# ifdef PCR
#ifdef __cplusplus
} // extern "C"
#endif
# include "th/PCR_ThCtl.h"
#ifdef __cplusplus
extern "C" {
#endif
# define STOP_WORLD() \
PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_stopNormal, \
PCR_allSigsBlocked, \
@@ -1315,7 +1330,7 @@ void GC_initiate_gc GC_PROTO((void));
/* If the mark state is invalid, this */
/* becomes full colleection. Otherwise */
/* it's partial. */
void GC_push_all GC_PROTO((ptr_t bottom, ptr_t top));
void GC_push_all (void* bottom, void* top);
/* Push everything in a range */
/* onto mark stack. */
void GC_push_selected GC_PROTO(( \
@@ -1960,6 +1975,10 @@ void GC_err_puts GC_PROTO((GC_CONST char *s));
/* some other reason. */
# endif /* PARALLEL_MARK */
#ifdef __cplusplus
} // extern "C"
#endif
# if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS)
/* We define the thread suspension signal here, so that we can refer */
/* to it in the dirty bit implementation, if necessary. Ideally we */
+6 -4
View File
@@ -1191,11 +1191,13 @@ void GC_mark_init()
* Should only be used if there is no possibility of mark stack
* overflow.
*/
void GC_push_all(bottom, top)
ptr_t bottom;
ptr_t top;
void GC_push_all(void_bottom, void_top)
void* void_bottom;
void* void_top;
{
register word length;
ptr_t bottom = (ptr_t)void_bottom;
ptr_t top = (ptr_t)void_top;
word length;
bottom = (ptr_t)(((word) bottom + ALIGNMENT-1) & ~(ALIGNMENT-1));
top = (ptr_t)(((word) top) & ~(ALIGNMENT-1));
+1
View File
@@ -1,2 +1,3 @@
/Makefile
/Makefile.in
/llvm_config.mk
+48 -22
View File
@@ -1,30 +1,56 @@
#
# Conditional submodule for llvm
#
# make reset-llvm will checkout a version of llvm which is suitable for this version of mono
# into $top_srcdir/llvm/llvm.
#
LLVM_PATH=llvm
EXTRA_DIST=build.mk build_llvm_config.sh
SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
include $(top_srcdir)/scripts/submodules/versions.mk
if ENABLE_LLVM
$(eval $(call ValidateVersionTemplate,llvm,LLVM))
if HOST_WIN32
llvm_config=llvm-config.exe
else
llvm_config=llvm-config
endif
# Bump the given submodule to the revision given by the REV make variable
# If COMMIT is 1, commit the change
bump-llvm: __bump-version-llvm
if HAVE_ZLIB
llvm_extra_libs=-lz
else
llvm_extra_libs=
endif
# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables
# If COMMIT is 1, commit the change
bump-branch-llvm: __bump-branch-llvm
if INTERNAL_LLVM
# Bump the given submodule to its current GIT version
# If COMMIT is 1, commit the change
bump-current-llvm: __bump-current-version-llvm
all-local: configure-llvm build-llvm install-llvm llvm_config.mk
clean-local:
$(RM) -r $(LLVM_PATH)
clean-local: clean-llvm clean-llvm-config
EXTRA_DIST=SUBMODULES.json
$(mono_build_root)/llvm/llvm_config.mk: install-llvm
$(top_srcdir)/llvm/build_llvm_config.sh "$(top_srcdir)/llvm/usr/bin/$(llvm_config)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@
else
all-local: llvm_config.mk
clean-local: clean-llvm-config
$(mono_build_root)/llvm/llvm_config.mk: $(top_srcdir)/llvm/Makefile.am
$(top_srcdir)/llvm/build_llvm_config.sh "$(EXTERNAL_LLVM_CONFIG)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@
endif
llvm_config.mk: $(mono_build_root)/llvm/llvm_config.mk
clean-llvm-config:
- rm -rf llvm_config.mk
else
all-local:
clean-local:
endif
# Override this so we don't try to re-copy llvm when we install mono
install:
if TARGET_WASM
LLVM_TARGET=wasm32
else
LLVM_TARGET=
endif
include build.mk
-10
View File
@@ -1,10 +0,0 @@
[
{
"name": "llvm",
"url": "git://github.com/mono/llvm.git",
"rev": "9f79399f87282524fee099b328bd8cbf07929daf",
"remote-branch": "origin/master",
"branch": "master",
"directory": "llvm"
}
]
+57
View File
@@ -0,0 +1,57 @@
abs_top_srcdir ?= $(abspath $(CURDIR)/..)
LLVM_BUILD ?= $(abspath $(abs_top_srcdir)/llvm/build)
LLVM_PREFIX ?= $(abspath $(abs_top_srcdir)/llvm/usr)
# LLVM_BRANCH := $(shell git -C "$(abs_top_srcdir)/external/llvm" rev-parse --abbrev-ref HEAD)
LLVM_VERSION := $(shell git -C "$(abs_top_srcdir)/external/llvm" rev-parse HEAD)
# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(LLVM_BRANCH)/llvm-osx64-$(LLVM_VERSION).tar.gz
LLVM_DOWNLOAD_LOCATION = "http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(LLVM_VERSION).tar.gz"
CMAKE := $(or $(CMAKE),$(shell which cmake))
NINJA := $(shell which ninja)
$(LLVM_BUILD) $(LLVM_PREFIX):
mkdir -p $@
EXTRA_LLVM_ARGS = $(if $(filter $(LLVM_TARGET),wasm32), -DLLVM_BUILD_32_BITS=On -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly",)
$(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(abs_top_srcdir)/external/llvm/CMakeLists.txt | $(LLVM_BUILD) $(LLVM_PREFIX)
cd $(LLVM_BUILD) && $(CMAKE) \
$(if $(NINJA),-G Ninja) \
-DCMAKE_INSTALL_PREFIX="$(LLVM_PREFIX)" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_BUILD_TESTS=Off \
-DLLVM_INCLUDE_TESTS=Off \
-DLLVM_BUILD_EXAMPLES=Off \
-DLLVM_INCLUDE_EXAMPLES=Off \
-DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
$(EXTRA_LLVM_ARGS) \
-DLLVM_ENABLE_ASSERTIONS=$(if $(INTERNAL_LLVM_ASSERTS),On,Off) \
-DHAVE_FUTIMENS=0 \
$(LLVM_CMAKE_ARGS) \
$(abs_top_srcdir)/external/llvm
.PHONY: configure-llvm
configure-llvm: $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile)
# The DESTDIR fix is to prevent the build from trying to install this out-of-build-tree
# as the DESTDIR hasn't been created when we're building mono
.PHONY: build-llvm
build-llvm: configure-llvm
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD)
.PHONY: install-llvm
install-llvm: build-llvm | $(LLVM_PREFIX)
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install
.PHONY: download-llvm
download-llvm:
(wget --no-verbose -O - $(LLVM_DOWNLOAD_LOCATION) || curl -L $(LLVM_DOWNLOAD_LOCATION)) | tar -xzf - -C $(dir $(LLVM_PREFIX))
.PHONY: clean-llvm
clean-llvm:
$(RM) -r $(LLVM_BUILD) $(LLVM_PREFIX)
+172
View File
@@ -0,0 +1,172 @@
#!/bin/bash
llvm_config=$1
llvm_codegen_libs="$2"
llvm_extra_libs="${@:3}"
use_llvm_config=1
llvm_host_win32=0
llvm_host_win32_wsl=0
llvm_host_win32_cygwin=0
function win32_format_path {
local formatted_path=$1
if [[ $llvm_host_win32_wsl = 1 ]] && [[ $1 != "/mnt/"* ]]; then
# if path is not starting with /mnt under WSL it could be a windows path, convert using wslpath.
formatted_path="$(wslpath -a "$1")"
elif [[ $llvm_host_win32_cygwin = 1 ]] && [[ $1 != "/cygdrive/"* ]]; then
# if path is not starting with /cygdrive under CygWin it could be a windows path, convert using cygpath.
formatted_path="$(cygpath -a "$1")"
fi
echo "$formatted_path"
}
if [[ $llvm_config = *".exe" ]]; then
llvm_host_win32=1
# llvm-config is a windows binary. Check if we are running CygWin or WSL since then we might still be able to run llvm-config.exe
host_uname="$(uname -a)"
case "$host_uname" in
*Microsoft*)
use_llvm_config=1
llvm_host_win32_wsl=1
;;
CYGWIN*)
use_llvm_config=1
llvm_host_win32_cygwin=1
;;
*)
use_llvm_config=0
esac
fi
if [[ $llvm_host_win32 = 1 ]]; then
llvm_config=$(win32_format_path "$llvm_config")
fi
if [[ $use_llvm_config = 1 ]]; then
llvm_api_version=`$llvm_config --mono-api-version` || "0"
with_llvm=`$llvm_config --prefix`
llvm_config_cflags=`$llvm_config --cflags`
llvm_system=`$llvm_config --system-libs`
llvm_core_components=`$llvm_config --libs analysis core bitwriter`
if [[ $llvm_api_version -lt 600 ]]; then
llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null`
else
llvm_old_jit=`$llvm_config --libs mcjit 2>>/dev/null`
fi
llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null`
if [[ ! -z $llvm_codegen_libs ]]; then
llvm_extra=`$llvm_config --libs $llvm_codegen_libs`
fi
# When building for Windows subsystem using WSL or CygWin the path returned from llvm-config.exe
# could be a Windows style path, make sure to format it into a path usable for WSL/CygWin.
if [[ $llvm_host_win32 = 1 ]]; then
with_llvm=$(win32_format_path "$with_llvm")
fi
fi
# When cross compiling for Windows on system not capable of running Windows binaries, llvm-config.exe can't be used to query for
# LLVM parameters. In that scenario we will need to fallback to default values.
if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then
# Assume we have llvm-config sitting in llvm-install-root/bin directory, get llvm-install-root directory.
with_llvm="$(dirname $llvm_config)"
with_llvm="$(dirname $with_llvm)"
llvm_config_path=$with_llvm/include/llvm/Config/llvm-config.h
# llvm-config.exe --mono-api-version
llvm_api_version=`awk '/MONO_API_VERSION/ { print $3 }' $llvm_config_path`
# llvm-config.exe --cflags, returned information currently not used.
llvm_config_cflags=
# llvm-config.exe --system-libs
if [[ $llvm_api_version -lt 600 ]]; then
llvm_system="-limagehlp -lpsapi -lshell32"
else
llvm_system="-lpsapi -lshell32 -lole32 -luuid -ladvapi32"
fi
# llvm-config.exe --libs analysis core bitwriter
if [[ $llvm_api_version -lt 600 ]]; then
llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport"
else
llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
fi
# llvm-config.exe --libs mcjit jit
if [[ $llvm_api_version -lt 600 ]]; then
llvm_old_jit="-lLLVMJIT -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport"
else
# Current build of LLVM 60 for cross Windows builds doesn't support LLVM JIT.
llvm_old_jit=
fi
# LLVM 36 doesn't support new JIT and LLVM 60 is build without LLVM JIT support for cross Windows builds.
llvm_new_jit=
# Check codegen libs and add needed libraries.
case "$llvm_codegen_libs" in
*x86codegen*)
# llvm-config.exe --libs x86codegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMObject -lLLVMBitReader -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport"
else
llvm_extra="-lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
fi
;;
*armcodegen*)
# llvm-config.exe --libs armcodegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMARMCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMMC -lLLVMSupport"
else
llvm_extra="-lLLVMARMCodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMMC -lLLVMSupport -lLLVMDemangle"
fi
;;
*aarch64codegen*)
# llvm-config.exe --libs aarch64codegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport"
else
llvm_extra="-lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lLLVMDemangle"
fi
;;
*)
llvm_extra=$llvm_codegen_libs
esac
fi
if [[ $llvm_config_cflags = *"stdlib=libc++"* ]]; then
llvm_libc_c="-stdlib=libc++"
llvm_libc_link="-lc++"
else
llvm_libc_c=""
llvm_libc_link="-lstdc++"
fi
if [[ $llvm_host_win32 = 1 ]]; then
host_cxxflag_additions="-std=gnu++11"
host_cflag_additions="-DNDEBUG"
else
host_cxxflag_additions="-std=c++11"
host_cflag_additions=""
fi
if [[ ! -z $llvm_extra_libs ]]; then
llvm_extra="$llvm_extra $llvm_extra_libs"
fi
# llvm-config --clfags adds warning and optimization flags we don't want
cflags_additions="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=$llvm_api_version $llvm_libc_c $host_cflag_additions"
cxxflag_additions="-fno-rtti -fexceptions $host_cxxflag_additions"
ldflags="-L$with_llvm/lib"
llvm_lib_components="$llvm_core_components $llvm_old_jit $llvm_new_jit $llvm_extra"
echo "LLVM_CFLAGS_INTERNAL=$cflags_additions"
echo "LLVM_CXXFLAGS_INTERNAL=$cflags_additions $cxxflag_additions"
echo "LLVM_LDFLAGS_INTERNAL=$ldflags"
echo "LLVM_LIBS_INTERNAL=$llvm_lib_components $ldflags $llvm_system $llvm_libc_link"
+1 -1
View File
@@ -1 +1 @@
EXTRA_DIST = iconv.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 $(wildcard *.m4)
EXTRA_DIST = lib-ld.m4 lib-link.m4 lib-prefix.m4 $(wildcard *.m4)
+40
View File
@@ -0,0 +1,40 @@
# Usage:
# AC_MONO_APPLE_TARGET(target-name, action-if-found, action-if-not-found)
#
# Checks whether `target-name` is defined in "TargetConditionals.h"
#
AC_DEFUN([AC_MONO_APPLE_TARGET], [
AC_MONO_APPLE_AVAILABLE([$1], [for $1], [$1 == 1], $2, $3)
])
# Usage:
# AC_MONO_APPLE_AVAILABLE(name, message, conditional, action-if-found, action-if-not-found)
#
# Checks for `conditional` using "TargetConditionals.h" and "AvailabilityMacros.h"
#
AC_DEFUN([AC_MONO_APPLE_AVAILABLE], [
# cache the compilation check
AC_CACHE_CHECK([$2], [ac_cv_apple_available_[]$1], [
AC_TRY_COMPILE([
#include "TargetConditionals.h"
#include "AvailabilityMacros.h"
],[
#if !($3)
#error failed
#endif
], [
ac_cv_apple_available_[]$1=yes
], [
ac_cv_apple_available_[]$1=no
])
])
# keep the actions out of the cache check because they need to be always executed.
if test x$ac_cv_apple_available_[]$1 = xyes; then
$1=yes
[$4]
else
$1=no
[$5]
fi
])
-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
])
+30
View File
@@ -271,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
+6 -1
View File
@@ -2,12 +2,17 @@
.SH NAME
Mono CIL strip
.SH SYNOPSIS
.B mono-cil-strip assembly [output-assembly]
.B mono-cil-strip [options] assembly [output-assembly]
.SH DESCRIPTION
mono-cil-strip is a tool which takes an assembly, and empty its method bodies.
This is useful to reduce an assembly size when an assembly has already been
compiled using Mono's Ahead Of Time compiler (AOT), where the CIL code is no
longer necessary, but the metadata still is.
.SH OPTIONS
The following options are available:
.TP
.I "-q"
Only output errors.
.SH COPYRIGHT
Copyright (C) 2008 Novell, Inc (http://www.novell.com)
.SH MAILING LISTS
+87 -16
View File
@@ -214,6 +214,20 @@ 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 llvmllc=[options]
Use this option to override the built-in set of flags passed to the
LLVM static compiler (llc). The list of possible flags that can be passed can be
obtained by calling the bundled
.I llc
program that comes with Mono.
.TP
.I llvm-outfile=[filename]
Gives the path for the temporary LLVM bitcode file created during AOT.
.I dedup
@@ -367,6 +381,9 @@ Prints additional information about type loading failures.
.TP
.I write-symbols,no-write-symbols
Instructs the AOT compiler to emit (or not emit) debug symbol information.
.TP
.I no-opt
Instructs the AOT compiler tot no call opt when compiling with LLVM.
.PP
For more information about AOT, see: http://www.mono-project.com/docs/advanced/aot/
.RE
@@ -471,6 +488,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
@@ -581,6 +601,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
@@ -1163,19 +1188,33 @@ 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\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
garbage collector would run at any point and suspend execution of all
threads as required to perform a garbage collection. The cooperative mode
on the other hand requires the cooperation of all threads to stop at a
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
flag when calling configure.
\fBMONO_THREADS_SUSPEND\fR
Selects a mechanism that Mono will use to suspend threads. May be set to
"preemptive", "coop", or "hybrid". Threads may need to be suspended by the
debugger, or using some .NET threading APIs, and most commonly when the SGen
garbage collector needs to stop all threads during a critical phase of garbage
collection. Preemptive mode is the mode that Mono has used historically, going
back to the Boehm days, where the garbage collector would run at any point and
suspend execution of all threads as required to perform a garbage collection.
The cooperative mode on the other hand requires the cooperation of all threads
to stop at a 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 enables the feature and allows us to find spots
that need to be tuned for this mode of operation. Hybrid mode is a combination
of the two that retains better compatability with scenarios where Mono is
embedded in another application: threads that are running managed code or code
that comprises the Mono runtime will be cooperatively suspended, while threads
running embedder code will be preemptively suspended.
Alternatively, coop and hybrid mode can be enabled at compile time by using the
--enable-cooperative-suspend or --enable-hybrid-suspend flags, respectively,
when calling configure. The \fBMONO_THREADS_SUSPEND\fR environment variable
takes priority over the compiled default.
.TP
\fBMONO_ENABLE_COOP_SUSPEND\fR
This environment variable is obsolete, but retained for backward compatibility.
Use \fBMONO_THREADS_SUSPEND\fR set to "coop" instead. Note that if configure flags
were provided to enable cooperative or hybrid suspend, this variable is ignored.
.TP
\fBMONO_ENV_OPTIONS\fR
This environment variable allows you to pass command line arguments to
@@ -1599,6 +1638,32 @@ 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_TLS_PROVIDER\fR
This environment variable controls which TLS/SSL provider Mono will
use. The options are usually determined by the operating system where
Mono was compiled and the configuration options that were used for
it.
.RS
.ne 8
.TP
.I default
Uses the default TLS stack that the Mono runtime was configured with.
Usually this is configured to use Apple's SSL stack on Apple
platforms, and Boring SSL on other platforms.
.TP
.I apple
Forces the use of the Apple SSL stack, only works on Apple platforms.
.TP
.I btls
Forces the use of the BoringSSL stack. See
https://opensource.google.com/projects/boringssl for more information
about this stack.
.TP
.I legacy
This is the old Mono stack, which only supports SSL and TLS up to
version 1.0. It is deprecated and will be removed in the future.
.RE
.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
@@ -1651,8 +1716,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
@@ -1781,6 +1846,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
@@ -1862,7 +1933,7 @@ 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. This can be a comma-separated list of method names to
method. This can be a semicolon-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).
+1 -1
View File
@@ -12,9 +12,9 @@ TestResult-*.xml
TestResult*.xml
.dep_dirs-*
apidiff/*
csprojdiff/*
errors/*.log
errors/dummy.xml
class/Mono.Data.Sqlite/test.db
class/RabbitMQ.Client/docs/specs/autogenerated-api-0-8.cs
class/RabbitMQ.Client/docs/specs/autogenerated-api-0-9.cs
class/RabbitMQ.Client/docs/specs/autogenerated-api-qpid-0-8.cs
+16 -6
View File
@@ -4,8 +4,7 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs packages
# Resgen is corlib specific tool
basic_SUBDIRS := build jay class
build_SUBDIRS := build class class/aot-compiler tools ilasm
build_SUBDIRS := build jay tools/gensources class class/aot-compiler tools
monodroid_SUBDIRS := build class tools
monodroid_tools_SUBDIRS := build class tools
monotouch_SUBDIRS := build class tools
@@ -36,7 +35,7 @@ all-local $(STD_TARGETS:=-local):
@:
dir-check:
@if [ "$(NO_DIR_CHECK)" = "" -a "$(PROFILE)" != "basic" ]; then $(MAKE) -C ../runtime; fi
@if [ "$(NO_DIR_CHECK)" = "" ]; then $(MAKE) -C ../runtime; fi
# fun specialty targets
@@ -83,7 +82,6 @@ $(_boot_:%=profile-do--winaot--%): profile-do--winaot--%:
$(_boot_:%=profile-do--orbis--%): profile-do--orbis--%: profile-do--build--%
$(_boot_:%=profile-do--unreal--%): profile-do--unreal--%: profile-do--build--%
$(_boot_:%=profile-do--wasm--%): profile-do--wasm--%: profile-do--build--%
$(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--%
testcorlib:
@cd class/corlib && $(MAKE) test run-test
@@ -152,9 +150,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 +177,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
+20 -6
View File
@@ -2,7 +2,7 @@ thisdir = build
SUBDIRS =
include ../build/rules.make
BUILT_FILES = common/Consts.cs
BUILT_FILES = common/Consts.cs $(topdir)/class/lib/$(PROFILE_DIRECTORY)/Consts.cs common/MonoNativeConfig.cs
all-local install-local test-local run-test-local csproj-local run-test-ondotnet-local uninstall-local doc-update-local: $(BUILT_FILES)
@:
@@ -10,14 +10,28 @@ all-local install-local test-local run-test-local csproj-local run-test-ondotnet
clean-local:
-rm -f $(BUILT_FILES) deps/*
common/Consts.cs: common/Consts.cs.in $(wildcard config.make)
$(topdir)/class/lib/$(PROFILE_DIRECTORY):
mkdir -p $@
common/Consts.cs $(topdir)/class/lib/$(PROFILE_DIRECTORY)/Consts.cs: common/Consts.cs.in $(wildcard config.make) | $(topdir)/class/lib/$(PROFILE_DIRECTORY)
test -n '$(MONO_VERSION)'
test -n '$(MONO_CORLIB_VERSION)'
sed -e 's,@''MONO_VERSION@,$(MONO_VERSION),' -e 's,@''MONO_CORLIB_VERSION@,$(MONO_CORLIB_VERSION),' $< > $@
PLATFORMS = darwin linux win32
#
# This is only used by corlib/Test/Mono/NativePlatformTest.cs, to ensure that we're using the correct native library.
# The test is disabled on all Windows platforms.
#
common/MonoNativeConfig.cs: common/MonoNativeConfig.cs.in $(wildcard config.make)
test -n '$(MONO_NATIVE_SUPPORTED)'
sed -e 's,@''MONO_NATIVE_SUPPORTED@,$(MONO_NATIVE_SUPPORTED),' \
-e 's,@''MONO_NATIVE_USING_COMPAT@,$(MONO_NATIVE_USING_COMPAT),' \
-e 's,@''MONO_NATIVE_PLATFORM_TYPE@,$(MONO_NATIVE_PLATFORM_TYPE),' \
-e 's,@''MONO_NATIVE_PLATFORM@,$(MONO_NATIVE_PLATFORM),' \
$< > $@
PLATFORMS = macos linux win32 unix
PROFILES = \
basic \
build \
binary_reference_assemblies \
net_4_x \
@@ -26,6 +40,7 @@ PROFILES = \
COMMON_SRCS = \
Consts.cs.in \
MonoNativeConfig.cs.in \
Locale.cs \
MonoTODOAttribute.cs \
basic-profile-check.cs \
@@ -33,14 +48,13 @@ COMMON_SRCS = \
AssemblyRef.cs
DISTFILES = \
README.makefiles \
README.makefiles.md \
README.platforms \
README.configury \
config-default.make \
corcompare.make \
corcompare-api.xsl \
executable.make \
gensources.sh \
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
+1
View File
@@ -1 +1,2 @@
/Consts.cs
/MonoNativeConfig.cs
+1 -1
View File
@@ -38,7 +38,7 @@ static class Consts
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";
public const int MonoCorlibVersion = @MONO_CORLIB_VERSION@;
public const string MonoCorlibVersion = "@MONO_CORLIB_VERSION@";
#if MOBILE
// Versions of .NET Framework for Silverlight 4.0
+10
View File
@@ -0,0 +1,10 @@
namespace Mono
{
static class MonoNativeConfig
{
internal const bool IsSupported = @MONO_NATIVE_SUPPORTED@;
internal const bool UsingCompat = @MONO_NATIVE_USING_COMPAT@;
internal const string PlatformTypeString = "@MONO_NATIVE_PLATFORM_TYPE@";
internal const string PlatformName = "@MONO_NATIVE_PLATFORM@";
}
}
+9 -10
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,7 +41,7 @@ class X {
Version min_mono_version;
#if __MonoCS__
min_mono_version = new Version (5, 13);
min_mono_version = new Version (5, 19);
#else
min_mono_version = new Version (5, 10);
#endif
+3 -3
View File
@@ -32,10 +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_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)
TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(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
+1 -1
View File
@@ -1,5 +1,5 @@
API_INFO = $(MONO_PATH) $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/mono-api-info.exe
API_DIFF = $(MONO_PATH) $(RUNTIME) $(topdir)/tools/corcompare/mono-api-diff.exe
API_DIFF = $(MONO_PATH) $(RUNTIME) $(topdir)/class/lib/$(PROFILE)/mono-api-diff.exe
TRANSFORM = $(MONO_PATH) $(RUNTIME) $(topdir)/tools/corcompare/transform.exe
OBJECTS = $(topdir)/build/corcompare/$(LIBRARY_NAME:.dll=.html)
+1
View File
@@ -191,6 +191,7 @@ csproj-local:
echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
(echo $(is_boot); \
echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(patsubst %,-r:%,$(LIB_REFS)); \
echo $(sourcefile); \
echo $(PROGRAM); \
echo $(BUILT_SOURCES_cmdline); \
echo $(build_lib); \
-113
View File
@@ -1,113 +0,0 @@
#! /bin/sh
outfile=$1
incfile=$2
excfile=$3
extfile=$4
extexcfile=$5
process_includes_1() {
sed -e '/^[ \t]*$/d' -e '/^[ \t]*#/d' -e '/*/d' $1 > $2
if cmp -s $1 $2; then
false
else
sed -n 's,^[ \t]*#include ,,p' $1 |
while read inc; do
cat $inc >> $2
echo $outfile: $inc >> $outfile.makefrag
echo $inc: >> $outfile.makefrag
done
# expand wildcards
sed -n '/*/p' $1 | grep -v '#' |
while read wildc; do
# quick syntax to exclude files:
# ../../../MyDir/*.cs:FileToExclude1.cs,FileToExclude2.cs
wc=`echo $wildc | cut -d \: -f 1` # ../../../MyDir/*.cs
qexc=`echo $wildc | cut -d \: -f 2` # FileToExclude1.cs,FileToExclude2.cs
if test "$wc" = "$qexc"; then
# no quick excludes - just expand the wildcard
ls $wildc >> $2
else
wcdir=`echo $wildc | cut -d \* -f 1` # ../../../MyDir/
# Enumerate files from 'FileToExclude1.cs,FileToExclude2.cs'
# and save to $outfile.exc
oldIFS=$IFS
IFS=,
for i in $qexc; do
echo "$wcdir$i" >> $outfile.exc
done
IFS=$oldIFS
ls $wc >> $2
fi
done
fi
}
process_includes() {
i=$1; o=$2; t=${2}.tmp
while process_includes_1 $i $o; do
mv $o $t
i=$t
done
rm -f $t
}
check_newline_eof() {
file=$1
if ! test -f "$file"; then return; fi
if ! test -z "$(tail -c 1 "$file")"; then echo "$file: missing newline at end of file."; exit 1; fi
}
check_newline_eof $incfile
check_newline_eof $excfile
check_newline_eof $extfile
check_newline_eof $extexcfile
rm -f $outfile.makefrag
process_includes $incfile $outfile.inc
if test x$extfile != x -a -f "$extfile"; then
process_includes $extfile $outfile.ext.inc
cat $outfile.ext.inc >> $outfile.inc
rm -f $outfile.ext.inc
fi
sort -u $outfile.inc > $outfile.inc_s
rm -f $outfile.inc
if test -n "$excfile" -a -f "$excfile"; then
process_includes $excfile $outfile.exc
fi
if test -n "$extexcfile"; then
process_includes $extexcfile $outfile.ext_exc
cat $outfile.ext_exc >> $outfile.exc
rm -f $outfile.ext_exc
fi
if test -f $outfile.exc; then
# So what we're doing below with uniq -u is that we take
# lines that have not been duplicated. This computes the
# symmetric difference between the files. This is not
# what we want. If a file is in the excludes but not in
# the sources, we want that file not to show up. By duplicating the
# excludes, we ensure that we won't end up in this failure state.
sort -u $outfile.exc > $outfile.exc_s
# Duplicate excludes
cat $outfile.exc_s >> $outfile.exc_s_dup
cat $outfile.exc_s >> $outfile.exc_s_dup
rm -f $outfile.exc $outfile.exc_s
cat $outfile.inc_s $outfile.exc_s_dup | sort | uniq -u > $outfile
rm -f $outfile.inc_s $outfile.exc_s_dup
else
mv $outfile.inc_s $outfile
fi
+15 -28
View File
@@ -14,13 +14,12 @@
# command line.
#
# All dependent libs become dependent dirs for parallel builds
# 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)) $(DEFAULT_REFERENCES)
LIB_REFS_ALIAS = $(filter-out $(LIB_REFS_FULL),$(LIB_REFS))
# All dependent libs become dependent dirs for parallel builds
DEP_LIBS = $(filter-out %=, $(subst =,= ,$(LIB_REFS)))
ifdef TARGET_NET_REFERENCE
# 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)))
@@ -61,11 +60,9 @@ endif
the_libdir_base = $(topdir)/class/$(lib_dir)/$(PROFILE_DIRECTORY)/$(if $(LIBRARY_SUBDIR),$(LIBRARY_SUBDIR)/)
ifdef RESOURCE_STRINGS
ifneq (basic, $(PROFILE))
RESOURCE_STRINGS_FILES += $(RESOURCE_STRINGS:%=--resourcestrings:%)
IL_REPLACE_FILES += $(IL_REPLACE:%=--ilreplace:%)
endif
endif
ifdef ENFORCE_LIBRARY_WARN_AS_ERROR
ifeq ($(LIBRARY_WARN_AS_ERROR),yes)
@@ -75,17 +72,6 @@ endif
endif
endif
#
# The bare directory contains the plain versions of System and System.Xml
#
bare_libdir = $(the_libdir_base)bare
#
# The secxml directory contains the System version that depends on
# System.Xml and Mono.Security
#
secxml_libdir = $(the_libdir_base)secxml
the_libdir = $(the_libdir_base)$(intermediate)
ifdef LIBRARY_USE_INTERMEDIATE_FILE
@@ -136,6 +122,7 @@ csproj-library:
echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
(echo $(is_boot); \
echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS) $(KEYFILE_MCS_FLAGS); \
echo $(LIBRARY); \
echo $(LIBRARY_NAME); \
echo $(BUILT_SOURCES_cmdline); \
echo $(build_lib); \
@@ -224,7 +211,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
@@ -236,11 +223,12 @@ ifdef RESOURCE_DEFS
$(foreach pair,$(RESOURCE_DEFS), $(eval $(call RESOURCE_template,$(word 1, $(subst $(ccomma), ,$(pair))), $(word 2, $(subst $(ccomma), ,$(pair))))))
endif
DISTFILES = $(wildcard *$(LIBRARY)*.sources) $(EXTRA_DISTFILES) $(DIST_LISTED_RESOURCES)
DISTFILES = $(wildcard *.sources) $(EXTRA_DISTFILES) $(DIST_LISTED_RESOURCES)
ASSEMBLY = $(LIBRARY)
ASSEMBLY_EXT = .dll
the_assembly = $(the_lib)
include $(topdir)/build/tests.make
ifdef HAVE_CS_TESTS
@@ -251,6 +239,7 @@ csproj-test:
echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
(echo false; \
echo $(USE_MCS_FLAGS) -r:$(the_assembly) $(TEST_MCS_FLAGS); \
echo $(LIBRARY); \
echo $(test_lib); \
echo $(BUILT_SOURCES_cmdline); \
echo $(test_lib); \
@@ -295,14 +284,12 @@ endif
# The library
# If the directory contains the per profile include file, generate list file.
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))
# TODO: depend on all *.sources (except tests) for now and figure out how to list only needed files later
PROFILE_sources = $(filter-out %test.dll.exclude.sources %test.dll.sources, $(wildcard *.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
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) --strict --platformsdir:$(topdir)/build "$@" "$(LIBRARY)" "$(PROFILE_PLATFORM)" "$(PROFILE)"
library_CLEAN_FILES += $(sourcefile)
@@ -390,9 +377,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
@@ -34,3 +34,5 @@ platform-check:
# echo "*** You need to build MCS with GNU make. Try \`gmake'" ; \
# exit 1 ; \
# fi
PLATFORM_MACOS=1
+36
View File
@@ -0,0 +1,36 @@
# -*- makefile -*-
#
# Platform-specific makefile rules. This one's for any unix (FreeBSD, OpenBSD, etc.)
#
PLATFORM_MCS_FLAGS =
PLATFORM_RUNTIME = $(RUNTIME)
PLATFORM_CORLIB = mscorlib.dll
PLATFORM_TEST_HARNESS_EXCLUDES =
EXTERNAL_MCS = mcs
EXTERNAL_MBAS = mbas
EXTERNAL_RUNTIME = mono
#ILDISASM = monodis
ILDISASM = false
PLATFORM_PATH_SEPARATOR = :
# Define this if this ever will work on Unix
# PLATFORM_MAKE_CORLIB_CMP = yes
# This is for changing / to \ on windows
PLATFORM_CHANGE_SEPARATOR_CMD = cat
hidden_prefix = .
hidden_suffix =
platform-check:
@:
# I tried this but apparently Make's version strings aren't that
# ... consistent between releases. Whatever.
#
# @if ! $(MAKE) --version |grep '^GNU Make version 3' 1>/dev/null 2>&1 ; then \
# echo "*** You need to build MCS with GNU make. Try \`gmake'" ; \
# exit 1 ; \
# fi
-121
View File
@@ -1,121 +0,0 @@
# -*- makefile -*-
monolite_path := $(topdir)/class/lib/monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)
with_mono_path_monolite = MONO_PATH="$(monolite_path)$(PLATFORM_PATH_SEPARATOR)$(monolite_path)/Facades$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
monolite_flag := $(depsdir)/use-monolite
use_monolite := $(wildcard $(monolite_flag))
MONOLITE_MSCORLIB = $(monolite_path)/mscorlib.dll
ifdef use_monolite
ifdef MCS_MODE
CSC_LOCATION = $(monolite_path)/mcs.exe
endif
PROFILE_RUNTIME = $(with_mono_path_monolite) $(RUNTIME)
BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
else
PROFILE_RUNTIME = $(EXTERNAL_RUNTIME)
ifdef MCS_MODE
BOOTSTRAP_MCS = mcs
else
BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
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)/cil-stringreplacer.exe
MCS = $(BOOTSTRAP_MCS)
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
API_BIN_PROFILE = v4.7.1
NO_SIGN_ASSEMBLY = yes
NO_TEST = yes
NO_INSTALL = yes
FRAMEWORK_VERSION = 4.5
# Compiler all using same bootstrap compiler
LIBRARY_COMPILE = $(BOOT_COMPILE)
# Verbose basic only
# V = 1
#
# Copy from rules.make because I don't know how to unset MCS_FLAGS
#
USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
.PHONY: profile-check do-profile-check
profile-check:
@:
ifeq (.,$(thisdir))
all-recursive: do-profile-check
all-local: post-profile-cleanup
clean-local: clean-profile
endif
clean-profile:
-rm -f $(PROFILE_EXE) $(PROFILE_OUT) $(monolite_flag)
post-profile-cleanup:
@rm -f $(monolite_flag)
PROFILE_EXE = $(depsdir)/basic-profile-check.exe
PROFILE_OUT = $(PROFILE_EXE:.exe=.out)
MAKE_Q=$(if $(V),,-s)
do-profile-check: $(depsdir)/.stamp
@ok=:; \
rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
if [ -z '$(MAKE_Q)' ] && [ -n '$(PROFILE_RUNTIME)' ]; then $(PROFILE_RUNTIME) --version; fi; \
$(MAKE) $(MAKE_Q) $(PROFILE_OUT) || ok=false; \
if $$ok; then rm -f $(PROFILE_EXE) $(PROFILE_OUT); else \
if test ! -s $(MONOLITE_MSCORLIB); then \
$(MAKE) $(MAKE_Q) do-get-monolite ; \
fi; \
if test -f $(MONOLITE_MSCORLIB); then \
$(MAKE) $(MAKE_Q) do-profile-check-monolite ; \
else \
echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2; \
echo "*** Check README for information on how to bootstrap a Mono installation." 1>&2 ; \
exit 1; fi; fi
ifdef use_monolite
do-get-monolite:
do-profile-check-monolite:
@echo "*** The contents of your 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)' directory may be out-of-date" 1>&2
@echo "*** You may want to try 'make get-monolite-latest'" 1>&2
rm -f $(monolite_flag)
exit 1
else
do-get-monolite:
@echo "*** Downloading bootstrap required 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)'" 1>&2
$(MAKE) $(MAKE_Q) -C $(topdir)/class get-monolite-latest
do-profile-check-monolite: $(depsdir)/.stamp
@echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2
@echo "*** Trying the 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)' directory." 1>&2
@echo dummy > $(monolite_flag)
$(MAKE) do-profile-check
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:$@ $<
$(PROFILE_OUT): $(PROFILE_EXE)
$(PROFILE_RUNTIME) $< > $@ 2>&1
+116 -11
View File
@@ -1,24 +1,129 @@
# -*- makefile -*-
BOOTSTRAP_PROFILE = basic
BUILD_TOOLS_PROFILE = basic
monolite_path := $(topdir)/class/lib/monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)
with_mono_path_monolite = MONO_PATH="$(monolite_path)$(PLATFORM_PATH_SEPARATOR)$(monolite_path)/Facades$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
monolite_flag := $(depsdir)/use-monolite
use_monolite := $(wildcard $(monolite_flag))
MONOLITE_MSCORLIB = $(monolite_path)/mscorlib.dll
ifdef use_monolite
ifdef MCS_MODE
CSC_LOCATION = $(monolite_path)/mcs.exe
endif
PROFILE_RUNTIME = $(with_mono_path_monolite) $(RUNTIME)
BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
else
PROFILE_RUNTIME = $(EXTERNAL_RUNTIME)
ifdef MCS_MODE
BOOTSTRAP_MCS = mcs
else
BOOTSTRAP_MCS = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(CSC_LOCATION)
endif
endif
#
# Special setup for boostrap tools which we want to run with system/monolite core libraries
# for all libraries build as part of this profile
#
ILASM = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/ilasm.exe
STRING_REPLACER = $(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/cil-stringreplacer.exe
GENSOURCES =$(PROFILE_RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/tmp/gensources.exe
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC)
MCS = $(BOOTSTRAP_MCS)
PLATFORMS = darwin linux win32
# nuttzing!
profile-check:
@:
PLATFORMS = macos linux win32 unix
DEFAULT_REFERENCES = mscorlib
PROFILE_MCS_FLAGS = -d:NET_4_0 -d:NET_4_5 -d:MONO -d:WIN_PLATFORM -nowarn:1699 -nostdlib
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
BOOTSTRAP_BIN_PROFILE = v4.7
NO_SIGN_ASSEMBLY = yes
NO_TEST = yes
NO_INSTALL = yes
FRAMEWORK_VERSION = 4.5
# Compiler all using same bootstrap compiler
LIBRARY_COMPILE = $(BOOT_COMPILE)
# Verbose basic only
# V = 1
#
# Copy from rules.make because I don't know how to unset MCS_FLAGS
#
USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
.PHONY: profile-check do-profile-check
profile-check:
@:
ifeq (.,$(thisdir))
all-recursive: do-profile-check
all-local: post-profile-cleanup
clean-local: clean-profile
endif
clean-profile:
-rm -f $(PROFILE_EXE) $(PROFILE_OUT) $(monolite_flag)
post-profile-cleanup:
@rm -f $(monolite_flag)
PROFILE_EXE = $(depsdir)/basic-profile-check.exe
PROFILE_OUT = $(PROFILE_EXE:.exe=.out)
MAKE_Q=$(if $(V),,-s)
do-profile-check: $(depsdir)/.stamp
@ok=:; \
rm -f $(PROFILE_EXE) $(PROFILE_OUT); \
if [ -z '$(MAKE_Q)' ] && [ -n '$(PROFILE_RUNTIME)' ]; then $(PROFILE_RUNTIME) --version; fi; \
$(MAKE) $(MAKE_Q) $(PROFILE_OUT) || ok=false; \
if $$ok; then rm -f $(PROFILE_EXE) $(PROFILE_OUT); else \
if test ! -s $(MONOLITE_MSCORLIB); then \
$(MAKE) $(MAKE_Q) do-get-monolite ; \
fi; \
if test -f $(MONOLITE_MSCORLIB); then \
$(MAKE) $(MAKE_Q) do-profile-check-monolite ; \
else \
echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2; \
echo "*** Check README for information on how to bootstrap a Mono installation." 1>&2 ; \
exit 1; fi; fi
ifdef use_monolite
do-get-monolite:
do-profile-check-monolite:
@echo "*** The contents of your 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)' directory may be out-of-date" 1>&2
@echo "*** You may want to try 'make get-monolite-latest'" 1>&2
rm -f $(monolite_flag)
exit 1
else
do-get-monolite:
@echo "*** Downloading bootstrap required 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)'" 1>&2
$(MAKE) $(MAKE_Q) -C $(topdir)/class get-monolite-latest
do-profile-check-monolite: $(depsdir)/.stamp
@echo "*** The runtime '$(PROFILE_RUNTIME)' doesn't appear to be usable." 1>&2
@echo "*** Trying the 'monolite-$(BUILD_PLATFORM)/$(MONO_CORLIB_VERSION)' directory." 1>&2
@echo dummy > $(monolite_flag)
$(MAKE) do-profile-check
endif
$(PROFILE_EXE): $(topdir)/build/common/basic-profile-check.cs
$(BOOTSTRAP_MCS) /warn:0 /noconfig /langversion:latest /r:System.dll /r:mscorlib.dll /out:$@ $<
$(PROFILE_OUT): $(PROFILE_EXE)
$(PROFILE_RUNTIME) $< > $@ 2>&1
+2
View File
@@ -2,3 +2,5 @@ include $(topdir)/build/profiles/monotouch_runtime.make
PROFILE_MCS_FLAGS += \
-d:FULL_AOT_RUNTIME
NO_SRE=1
@@ -39,3 +39,4 @@ NO_CONSOLE = yes
PROFILE_DISABLE_BTLS=1
MONO_FEATURE_APPLETLS=1
ONLY_APPLETLS=1
ENABLE_GSS=1
+1
View File
@@ -7,3 +7,4 @@ NO_THREAD_ABORT=1
NO_THREAD_SUSPEND_RESUME=1
NO_MULTIPLE_APPDOMAINS=1
NO_PROCESS_START=1
NO_VTS_TEST=1
+1
View File
@@ -12,3 +12,4 @@ NO_MONO_SECURITY=1
MONO_FEATURE_APPLETLS=
ONLY_APPLETLS=
MONO_FEATURE_APPLE_X509=1
NO_VTS_TEST=1
+7 -3
View File
@@ -5,7 +5,7 @@ BOOTSTRAP_PROFILE = build
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC)
MCS = $(BOOTSTRAP_MCS)
PLATFORMS = darwin linux win32
PLATFORMS = macos linux win32 unix
# nuttzing!
@@ -13,11 +13,15 @@ profile-check:
@:
DEFAULT_REFERENCES = mscorlib
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 $(PLATFORM_DEBUG_FLAGS)
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
XBUILD_VERSION = 4.0
MONO_FEATURE_APPLETLS=1
ENFORCE_LIBRARY_WARN_AS_ERROR = yes
ifdef PLATFORM_MACOS
MONO_FEATURE_APPLETLS=1
ENABLE_GSS=1
endif
+1
View File
@@ -39,6 +39,7 @@ MOBILE_PROFILE = yes
NO_VTS_TEST = yes
NO_CONSOLE = yes
PROFILE_DISABLE_BTLS = yes
NO_SRE=1
# Note need for trailing comma. If you add, keep it
PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
+1
View File
@@ -36,6 +36,7 @@ AOT_FRIENDLY_PROFILE = yes
MOBILE_PROFILE = yes
NO_VTS_TEST = yes
NO_CONSOLE = yes
NO_SRE=1
# Note need for trailing comma. If you add, keep it
PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
+1
View File
@@ -39,3 +39,4 @@ ALWAYS_AOT = yes
MOBILE_PROFILE = yes
NO_VTS_TEST = yes
NO_CONSOLE = yes
NO_SRE=1
+1
View File
@@ -37,6 +37,7 @@ AOT_FRIENDLY_PROFILE = yes
ALWAYS_AOT = yes
MOBILE_PROFILE = yes
NO_VTS_TEST = yes
NO_SRE=1
# Note need for trailing comma. If you add, keep it
PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS,
+1
View File
@@ -35,6 +35,7 @@ MOBILE_DYNAMIC = yes
MOBILE_PROFILE = yes
NO_CONSOLE = yes
ENABLE_GSS=1
PROFILE_DISABLE_BTLS=1
MONO_FEATURE_APPLETLS=1
ONLY_APPLETLS=1
+3
View File
@@ -1,5 +1,7 @@
include $(topdir)/build/profiles/net_4_x.make
PLATFORMS =
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 \
@@ -21,3 +23,4 @@ NO_SYSTEM_DIRECTORY_SERVICES_DEPENDENCY=1
PROFILE_DISABLE_BTLS=1
MONO_FEATURE_APPLETLS=1
ONLY_APPLETLS=1
ENABLE_GSS=1
+16 -8
View File
@@ -27,12 +27,8 @@ Q_MCS=$(if $(V),,@echo "$(if $(MCS_MODE),MCS,CSC) [$(intermediate)$(PROFILE_
Q_AOT=$(if $(V),,@echo "AOT [$(intermediate)$(PROFILE_DIRECTORY)] $(notdir $(@))";)
ifndef BUILD_TOOLS_PROFILE
ifeq ($(PROFILE),basic)
BUILD_TOOLS_PROFILE = basic
else
BUILD_TOOLS_PROFILE = build
endif
endif
USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_MCS_FLAGS) $(PLATFORM_MCS_FLAGS) $(PROFILE_MCS_FLAGS) $(MCS_FLAGS)
USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS)
@@ -56,7 +52,7 @@ INTERNAL_CSC = CSC_SDK_PATH_DISABLED= $(RUNTIME) $(RUNTIME_FLAGS) $(CSC_RUNTIME_
RESGEN = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resgen.exe
STRING_REPLACER = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/cil-stringreplacer.exe
ILASM = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/ilasm.exe
GENSOURCES = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/gensources.exe
depsdir = $(topdir)/build/deps
@@ -161,7 +157,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-xunit-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-%
@@ -238,6 +234,9 @@ endif
$(if $(filter $*,all), \
$(MAKE) $(PROFILE_PARALLEL_SUBDIRS) ENABLE_PARALLEL_SUBDIR_BUILD=1 || { final_exit="exit 1"; $$dk; };, \
$(foreach subdir,$(PROFILE_PARALLEL_SUBDIRS),$(MAKE) -C $(subdir) $* || { final_exit="exit 1"; $$dk; };))) \
$(if $(FACADES_FOLDER), \
$(MAKE) -C $(FACADES_FOLDER) $* || { final_exit="exit 1"; $$dk; }; \
) \
$$final_exit
ifdef ENABLE_PARALLEL_SUBDIR_BUILD
@@ -259,15 +258,24 @@ endif
# directories it depends on.
#
ifneq ($(PROFILE_PARALLEL_SUBDIRS),)
dep_dirs = .dep_dirs-$(PROFILE)
$(dep_dirs):
@echo "Creating $@..."
#
# This should track dependencies better but the variable can be defined in any
# Makefile dependency. On top of that we should also regenerate when any of the
# PROFILE_PARALLEL_SUBDIRS Makefile's are changed
#
$(dep_dirs): Makefile
$(if $(V),@echo "Creating $(abspath $@)...",)
list='$(PROFILE_PARALLEL_SUBDIRS)'; \
echo > $@; \
for d in $$list; do \
$(MAKE) -C $$d gen-deps DEPS_TARGET_DIR=$$d DEPS_FILE=$(abspath $@); \
done
-include $(dep_dirs)
endif
.PHONY: gen-deps
+70 -37
View File
@@ -19,19 +19,41 @@ 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_deps := System.Runtime
xunit_core := xunit.core xunit.execution.dotnet xunit.abstractions xunit.assert Xunit.NetCore.Extensions
xunit_deps := netstandard 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 = $(topdir)/class/lib/$(PROFILE)/RemoteExecutorConsoleApp.exe
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)/../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
$(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
ifeq ($(PROFILE),monotouch_tv)
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
else
ifeq ($(PROFILE),monotouch_watch)
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
endif
endif
xunit_class_deps :=
@@ -56,6 +78,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
@@ -67,12 +90,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 = $(PROFILE_PLATFORM)_$(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
@@ -80,7 +104,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
@@ -107,10 +131,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)
@@ -130,11 +150,11 @@ TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PRO
NOSHADOW_FLAG =
ifdef FIXTURE
FIXTURE_ARG = -test=MonoTests.$(FIXTURE)
FIXTURE_ARG = -test=$(FIXTURE)
endif
ifdef TESTNAME
TESTNAME_ARG = -test=MonoTests.$(TESTNAME)
TESTNAME_ARG = -test=$(TESTNAME)
endif
ifdef TEST_HARNESS_VERBOSE
@@ -156,14 +176,20 @@ endif
NUNITLITE_CONFIG_FILE=$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)nunit-lite-console.exe.config
patch-nunitlite-appconfig:
cp -f $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(NUNITLITE_CONFIG_FILE)
$(test_lib_output).nunitlite.config: $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(TEST_NUNITLITE_APP_CONFIG_GLOBAL) $(TEST_NUNITLITE_APP_CONFIG_RUNTIME) $(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL) | $(test_lib_dir)
cp -f $(topdir)/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config.tmpl $(test_lib_output).nunitlite.config
ifdef TEST_NUNITLITE_APP_CONFIG_GLOBAL
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_GLOBAL__/r $(TEST_NUNITLITE_APP_CONFIG_GLOBAL)" $(NUNITLITE_CONFIG_FILE)
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_GLOBAL__/r $(TEST_NUNITLITE_APP_CONFIG_GLOBAL)" $(test_lib_output).nunitlite.config
endif
ifdef TEST_NUNITLITE_APP_CONFIG_RUNTIME
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(NUNITLITE_CONFIG_FILE)
sed -i -e "/__INSERT_CUSTOM_APP_CONFIG_RUNTIME__/r $(TEST_NUNITLITE_APP_CONFIG_RUNTIME)" $(test_lib_output).nunitlite.config
endif
ifdef TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL
cp -f $(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL) $(test_lib_output).nunitlite.config.$(TEST_NUNITLITE_APP_CONFIG_SUPPLEMENTAL)
endif
copy-nunitlite-appconfig: $(test_lib_output).nunitlite.config
cp -f $(test_lib_output).nunitlite.config $(NUNITLITE_CONFIG_FILE)
ifdef PLATFORM_AOT_SUFFIX
@@ -209,10 +235,10 @@ TEST_HARNESS_EXEC=$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(TEST_COVERAGE_FLAGS) $
endif
## FIXME: i18n problem in the 'sed' command below
run-test-lib: test-local test-local-aot-compile patch-nunitlite-appconfig
run-test-lib: test-local test-local-aot-compile copy-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
@@ -236,15 +262,15 @@ 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_output).nunitlite.config | $(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
# This handles .excludes/.sources pairs, as well as resolving the
# includes that occur in .sources files
$(test_response_preprocessed): $(test_sourcefile) $(wildcard $(test_sourcefile_excludes))
$(SHELL) $(topdir)/build/gensources.sh $@ '$(test_sourcefile)' '$(test_sourcefile_excludes)'
$(test_response_preprocessed): $(test_sourcefile) $(wildcard *_test.dll.sources) $(wildcard *_test.dll.exclude.sources)
$(GENSOURCES) --basedir:./Test --strict --platformsdir:$(topdir)/build "$@" "$(test_sourcefile)" "$(test_sourcefile_excludes)"
$(test_response): $(test_response_preprocessed)
# @echo Creating $@ ...
@@ -266,8 +292,14 @@ ifdef HAVE_CS_XTESTS
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
@@ -283,34 +315,35 @@ XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(P
endif
check: 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)" REMOTE_EXECUTOR=$(XTEST_REMOTE_EXECUTOR) $(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)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs
$(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
# This handles .excludes/.sources pairs, as well as resolving the
# includes that occur in .sources files
$(xtest_response): $(xtest_sourcefile) $(wildcard $(xtest_sourcefile_excludes))
$(SHELL) $(topdir)/build/gensources.sh $@ '$(xtest_sourcefile)' '$(xtest_sourcefile_excludes)'
$(xtest_response): $(xtest_sourcefile) $(wildcard *xtest.dll.sources) $(wildcard $(xtest_sourcefile_excludes))
$(GENSOURCES) --strict --platformsdir:$(topdir)/build "$@" "$(xtest_sourcefile)" "$(xtest_sourcefile_excludes)"
$(xtest_makefrag): $(xtest_response)
@echo Creating $@ ...
@sed 's,^,$(xunit_test_lib): ,' $< >$@
@sed 's,^,$(xtest_lib_output): ,' $< >$@
-include $(xtest_makefrag)
@@ -1,93 +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.6.2</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,75 @@
<?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>
<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 -->
<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" />
<!-- @BUILT_SOURCES@ -->
<!--Common files-->
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="Accessibility\IAccessible.cs" />
<Compile Include="Accessibility\IAccessibleHandler.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
<ProjectReference Include="$(SolutionDir)\msvc\scripts\genconsts.csproj">
<Name>genconsts</Name>
<Project>{702AE2C0-71DD-4112-9A06-E4FABCA59986}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<!--End of common files-->
<!-- @ALL_SOURCES@ -->
<!-- @COMMON_PROJECT_REFERENCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<ProjectReference Include="../corlib/corlib.csproj" />
</ItemGroup>
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
<PropertyGroup>
<!-- Force the pre-build event to run after references have been resolved. The default
behavior is to run them before resolving references, which can cause things like
culevel.exe to be used before they have been built. -->
<PreBuildEventDependsOn>ResolveReferences</PreBuildEventDependsOn>
</PropertyGroup>
</Project>
@@ -1,59 +1,53 @@
<?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.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<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>
<!-- 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 -->
<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 Condition=" '$(Platform)' == 'net_4_x' ">
<Compile Include="Commons.Xml.Relaxng.Rnc\RncParser.cs" />
</ItemGroup>
<!-- @BUILT_SOURCES@ -->
<!--Common files-->
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
@@ -94,51 +88,44 @@
<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\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.exe -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="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
<ProjectReference Include="$(SolutionDir)\msvc\scripts\genconsts.csproj">
<Name>genconsts</Name>
<Project>{702AE2C0-71DD-4112-9A06-E4FABCA59986}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<Private>false</Private>
</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>
<ProjectReference Include="../corlib/corlib-net_4_x.csproj">
<Project>{2CA6026B-2DC8-4C4C-A12C-1E8234049DB7}</Project>
<Name>corlib-net_4_x</Name>
<ProjectReference Include="$(SolutionDir)\mcs\jay\jay.vcxproj">
<Name>jay</Name>
<Project>{5d485d32-3b9f-4287-ab24-c8da5b89f537}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<!--End of common files-->
<!-- @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>
<!-- Force the pre-build event to run after references have been resolved. The default
behavior is to run them before resolving references, which can cause things like
culevel.exe to be used before they have been built. -->
<PreBuildEventDependsOn>ResolveReferences</PreBuildEventDependsOn>
</PropertyGroup>
<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,3 +1,4 @@
../../test-helpers/TestResourceHelper.cs
RdpPatternTests.cs
RelaxngDatatypeProviderTests.cs
RelaxngReaderTests.cs
+10 -5
View File
@@ -11,15 +11,20 @@ LIB_REFS = System System.Xml
KEYFILE = ../mono.pub
LIB_MCS_FLAGS = \
$(foreach r, $(OTHER_RES), /resource:$(r),$(notdir $(r)))
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
EXTRA_DISTFILES = \
Commons.Xml.Relaxng.Rnc/RncParser.jay \
TEST_RESOURCE_FILES = \
$(wildcard Test/XmlFiles/*.rng) \
$(wildcard Test/XmlFiles/*.rnc) \
$(wildcard Test/XmlFiles/*.nvdl) \
$(wildcard Test/XmlFiles/*.xml) \
$(wildcard Test/XmlFiles/*.xml)
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169 $(foreach r, $(TEST_RESOURCE_FILES), -resource:$(r),$(r))
EXTRA_DISTFILES = \
Commons.Xml.Relaxng.Rnc/RncParser.jay \
$(wildcard Test/standalone_tests/*.cs) \
$(RESOURCE_FILES)
$(RESOURCE_FILES) \
$(TEST_RESOURCE_FILES)
Commons.Xml.Relaxng.Rnc/RncParser.cs: Commons.Xml.Relaxng.Rnc/RncParser.jay $(topdir)/jay/skeleton.cs
$(topdir)/jay/jay -ctv -o Commons.Xml.Relaxng.Rnc/RncParser.cs $< < $(topdir)/jay/skeleton.cs
@@ -13,6 +13,8 @@ using System.Xml;
using Commons.Xml.Nvdl;
using NUnit.Framework;
using MonoTests.Helpers;
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
@@ -21,7 +23,7 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void ReadNvdlNvdl ()
{
using (TextReader r = File.OpenText ("Test/XmlFiles/nvdl.nvdl")) {
using (TextReader r = File.OpenText (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/nvdl.nvdl"))) {
NvdlRules rules = NvdlReader.Read (
new XmlTextReader (r));
}
@@ -31,7 +33,7 @@ namespace MonoTests.Commons.Xml.Relaxng
public void ValidateNvdlNvdl ()
{
NvdlRules rules = null;
string path = "Test/XmlFiles/nvdl.nvdl";
string path = TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/nvdl.nvdl");
using (TextReader r = File.OpenText (path)) {
rules = NvdlReader.Read (
new XmlTextReader (path, r));
@@ -12,6 +12,8 @@ using Commons.Xml.Relaxng;
using Commons.Xml.Relaxng.XmlSchema;
using NUnit.Framework;
using MonoTests.Helpers;
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
@@ -23,7 +25,7 @@ namespace MonoTests.Commons.Xml.Relaxng
var datatypeLibrary = SetupMyDataProvider ();
XmlDocument xml = new XmlDocument ();
xml.LoadXml ("<root> <v1>mytype</v1> <v2>1</v2> </root>");
XmlDocument schemaXml = ReadDoc ("Test/XmlFiles/463264.rng");
XmlDocument schemaXml = ReadDoc (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/463264.rng"));
XmlReader reader = new RelaxngValidatingReader (new XmlNodeReader (xml), new XmlNodeReader (schemaXml), datatypeLibrary);
while (reader.Read ())
;
@@ -35,7 +37,7 @@ namespace MonoTests.Commons.Xml.Relaxng
var datatypeLibrary = SetupMyDataProvider ();
XmlDocument xml = new XmlDocument ();
xml.LoadXml ("<root> <v2>1</v2> <v1>mytype</v1> </root>");
XmlDocument schemaXml = ReadDoc ("Test/XmlFiles/463267.rng");
XmlDocument schemaXml = ReadDoc (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/463267.rng"));
XmlReader reader = new RelaxngValidatingReader (new XmlNodeReader (xml), new XmlNodeReader (schemaXml), datatypeLibrary);
while (reader.Read ())
;
@@ -13,6 +13,8 @@ using System.Xml;
using Commons.Xml.Relaxng;
using NUnit.Framework;
using MonoTests.Helpers;
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
@@ -33,7 +35,7 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void SimpleRead ()
{
loadGrammarFromUrl ("Test/XmlFiles/SimpleElementPattern1.rng");
loadGrammarFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.rng"));
RelaxngPattern p = reader.ReadPattern ();
Assert.AreEqual (RelaxngPatternType.Element, p.PatternType);
@@ -42,7 +44,7 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void CompileRelaxngGrammar ()
{
loadGrammarFromUrl ("Test/XmlFiles/relaxng.rng");
loadGrammarFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng"));
RelaxngPattern p = reader.ReadPattern ();
Assert.AreEqual (RelaxngPatternType.Grammar, p.PatternType);
@@ -14,6 +14,7 @@ using Commons.Xml.Relaxng;
using NUnit.Framework;
using RVR = Commons.Xml.Relaxng.RelaxngValidatingReader;
using MonoTests.Helpers;
namespace MonoTests.Commons.Xml.Relaxng
{
@@ -45,8 +46,8 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void SimpleElementPattern1 ()
{
SetupReaderFromUrl ("Test/XmlFiles/SimpleElementPattern1.xml",
"Test/XmlFiles/SimpleElementPattern1.rng");
SetupReaderFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.xml"),
TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern1.rng"));
while (!reader.EOF)
reader.Read ();
@@ -55,8 +56,8 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void SimpleElementPattern2 ()
{
SetupReaderFromUrl ("Test/XmlFiles/SimpleElementPattern2.xml",
"Test/XmlFiles/SimpleElementPattern2.rng");
SetupReaderFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern2.xml"),
TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/SimpleElementPattern2.rng"));
while (!reader.EOF)
reader.Read ();
@@ -65,7 +66,7 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void ReadPracticalSample1 ()
{
SetupReaderFromUrl ("Test/XmlFiles/team.xml", "Test/XmlFiles/team.rng");
SetupReaderFromUrl (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/team.xml"), TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/team.rng"));
while (!reader.EOF)
reader.Read ();
}
@@ -75,8 +76,8 @@ namespace MonoTests.Commons.Xml.Relaxng
{
// validate relaxng.rng with relaxng.rng
RVR r = new RVR (
new XmlTextReader ("Test/XmlFiles/relaxng.rng"),
new XmlTextReader ("Test/XmlFiles/relaxng.rng"));
new XmlTextReader (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng")),
new XmlTextReader (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rng")));
while (!r.EOF)
r.Read ();
}
@@ -15,6 +15,8 @@ using Commons.Xml.Relaxng;
using Commons.Xml.Relaxng.Rnc;
using NUnit.Framework;
using MonoTests.Helpers;
namespace MonoTests.Commons.Xml.Relaxng
{
[TestFixture]
@@ -43,19 +45,19 @@ namespace MonoTests.Commons.Xml.Relaxng
[Test]
public void TestRelaxngRnc ()
{
Compile ("Test/XmlFiles/relaxng.rnc");
Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/relaxng.rnc"));
}
[Test]
public void TestAtomRnc ()
{
Compile ("Test/XmlFiles/atom.rnc");
Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/atom.rnc"));
}
[Test]
public void TestInfocardRnc ()
{
Compile ("Test/XmlFiles/schemas-xmlsoap-or-ws-2005-05-identity.rnc");
Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/schemas-xmlsoap-or-ws-2005-05-identity.rnc"));
}
[Test]
@@ -85,8 +87,8 @@ start = mine";
[Test]
public void InheritDefaultNamespace ()
{
RelaxngPattern g = Compile ("Test/XmlFiles/include-default-namespace.rnc");
XmlReader xtr = new XmlTextReader ("Test/XmlFiles/include-default-namespace.xml");
RelaxngPattern g = Compile (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/include-default-namespace.rnc"));
XmlReader xtr = new XmlTextReader (TestResourceHelper.GetFullPathOfResource ("Test/XmlFiles/include-default-namespace.xml"));
RelaxngValidatingReader r = new RelaxngValidatingReader (xtr, g);
try {
while (!r.EOF)
@@ -1,100 +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>{2AB43CEE-0BE1-46EF-971E-3678330BEA13}</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>cscompmgd</AssemblyName>
<TargetFrameworkVersion>v4.6.2</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="..\..\build\common\Locale.cs" />
<Compile Include="..\..\build\common\MonoTODOAttribute.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
<Compile Include="Microsoft.CSharp\Compiler.cs" />
<Compile Include="Microsoft.CSharp\CompilerError.cs" />
<Compile Include="Microsoft.CSharp\ErrorLevel.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="../System/System-net_4_x.csproj">
<Project>{2762E921-91A8-4C87-91E9-BA628013F753}</Project>
<Name>System-net_4_x</Name>
</ProjectReference>
<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>
+79
View File
@@ -0,0 +1,79 @@
<?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>{546B21E5-FB99-44A5-8721-2D672FBCD7FF}</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>cscompmgd</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>../msfinal.pub</AssemblyOriginatorKeyFile>
</PropertyGroup>
<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 -->
<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" />
<!-- @BUILT_SOURCES@ -->
<!--Common files-->
<ItemGroup>
<Compile Include="..\..\build\common\Consts.cs" />
<Compile Include="..\..\build\common\Locale.cs" />
<Compile Include="..\..\build\common\MonoTODOAttribute.cs" />
<Compile Include="Assembly\AssemblyInfo.cs" />
<Compile Include="Microsoft.CSharp\Compiler.cs" />
<Compile Include="Microsoft.CSharp\CompilerError.cs" />
<Compile Include="Microsoft.CSharp\ErrorLevel.cs" />
<ProjectReference Include="$(SolutionDir)\msvc\scripts\genconsts.csproj">
<Name>genconsts</Name>
<Project>{702AE2C0-71DD-4112-9A06-E4FABCA59986}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<!--End of common files-->
<!-- @ALL_SOURCES@ -->
<!-- @COMMON_PROJECT_REFERENCES@ -->
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<ProjectReference Include="../System/System.csproj" />
<ProjectReference Include="../corlib/corlib.csproj" />
</ItemGroup>
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
<PropertyGroup>
<!-- Force the pre-build event to run after references have been resolved. The default
behavior is to run them before resolving references, which can cause things like
culevel.exe to be used before they have been built. -->
<PreBuildEventDependsOn>ResolveReferences</PreBuildEventDependsOn>
</PropertyGroup>
</Project>
@@ -8,6 +8,7 @@
//
using System;
using System.Collections.Generic;
using Microsoft.CSharp;
using NUnit.Framework;
@@ -21,5 +22,11 @@ namespace MonoTests.Cscompmgd
public void GetReady ()
{
}
[TestCase]
public void EmptySourceTexts ()
{
Assert.Throws<IndexOutOfRangeException> (() => Compiler.Compile (Array.Empty<string> (), Array.Empty<string> (), "", null, null));
}
}
}
Loaded 100 of 3598 files, more files were not shown because too many files have changed in this diff. Show more