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.
* [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
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.
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.
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.
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.
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.
When using the interp_wrapper to enter interp from native we don't need to save the lmf since it doesn't make sense to unwind to native. Also make sure we have the interp context set up if we weren't attached at interp transition time.
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.
* [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.
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
* Bump msbuild to track mono-2018-02
.. and track changes in the build scripts.
* [msbuild] Zip test results and log files for surfacing in jenkins (#8523)
(cherry picked from commit 0b8f0d2f83)
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.
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"),
(cherry picked from commit 376050c2bc)
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).
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.
* [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.
* [interp] Interp entry trampoline for arm64
* [interp] Include lmf wrapper in aot image
* [arm64] Add unwind info for native to interp trampoline
* [arm64] Set correct frame type for trampoline frames
* [runtime] Add a signal handler for sigterm
* [runtime] Register sigtramp when merp handler enabled
* [runtime] Limit sigterm handler symbol definition to OSX
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.
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
* [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.
* [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
* [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.
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
* [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.
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.
(cherry picked from commit a748bad303)
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.
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
```
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.
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.
* [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.
* [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
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.
* [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
* [sdks] Add targets for the watch cross compiler. (#7061)
* [offsets-tool] Add an '--output' argument to specify the output file directly instead of generating it from the target triple.
* [sdks] Add targets for the watch cross compiler.
* Ios sdk changes (#7258)
* [sdks] Add armv7s device build.
* [sdks] Disable dtrace on the cross compiler builds.
* [sdks] Avoid building mono-dtrace.h for the cross compilers, its not needed anymore.
* [sdks] Add a configure-mono target.
* [sdks] Put back the call to CheckXcodeDir.
* [sdks] Enable ccache if possible.
* [sdks] Generalize iosDeviceTemplate so it can build the tvos runtime as well. Add tvos device build.
* [sdks] Add tv simulator build.
* [sdks] Add watch simulator build.
* [sdks] Add watch device build.
* [sdks] Unify targets to build runtimes (#7394)
* [sdks] Move common targets
* [sdks] Have RELEASE be empty when CONFIGURATION != 'release'
* [sdks] Create common runtime compilation template
* [sdks] Use runtime template for Android
* [sdks] Use runtime template for iOS
* [sdks] IOS fixes. (#7617)
* [sdks] Fix ios build.
* [sdks] Pass -DMONOTOUCH to the ios cross compiler builds. Compile monotouch/tvos/watchos profiles for the bcl build.
* [sdk] missing diffs for ios and android
* [ci] sync run-jenkins.sh regarding sdks android
* [ci] remove package-android-host-Linux
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`.
The latest `WebCompletionSource<T>` changes (PR #7358) exposed and
intensified the side-effects of a race condition between `WebOperation`
and `ServicePointScheduler`.
* WebCompletionSource<T> now contains new `CurrentResult` and `CurrentStatus`
properties, which allow completion status to be checked in a non-blocking way.
* WebOperation.CompleteResponseRead() has been renamed into Finish() and
contains the continuation that was previouly known as FinishReading().
Calling this new Finish() method will now complete the `finishedTask`
completion, which has a new accessor called `Finished`.
* The ServicePointScheduler's main-loop is still woken up by completion of
`WebOperation.Finished.Task`, but we use the new `CurrentResult` property
to check state in a non-blocking way. This ensures the the clean-up and
bookkeeping work that's necessary after `WebCompletion.Finish()` always
happens prior to starting new connections.
* Don't load framework Facade assemblies that are older than expected.
If there is an older framework Facade assembly in the search order before the
one that we want, don't load it.
"older" here means just compare the major components of the version.
Fixes https://github.com/mono/mono/issues/7624
Even though it's found during configure when targetting 10.7, it's not "really" available before versions 10.12 and it would crash with "lazy symbol binding failed".
* Use current nursery size when computing allowance
The allowance is the minimum heap growth that we allow between two majors (which is 4 * nursery_size). We need to use the current nursery size instead of the 4MB default, in order to facilitate low memory uses.
* Account for soft heap limit in allowance calculation
This is relevant in cases where the nursery size and soft heap limit are comparable in size.
* Introduce `WebCompletionSource<T>` and use it in `WebOperation`.
* Fix issue in ServicePointScheduler with collection being modified in foreach.
* Update WebOperation.cs
* Work around mcs limitations.
* Use TaskCreationOptions.RunContinuationsAsynchronously in WebCompletionSource.
* Add the test from #7355.
* Put back the 'foreach' loop in ServicePointScheduler.
With the WebCompletionSource changes, this should no longer cause
any problems.
* Add missing Facades that exist in .NET 4.7.1
Some of them we had on mobile only, others were missing completely.
Fixes https://github.com/mono/mono/issues/7536
* Bump API snapshot submodule
* Fix race between abort socket syscall and thread shutdown
The race happens when we call mono_thread_info_abort_socket_sycall_for_close on
a thread that's about to shut down.
We lookup the MonoThreadInfo for that thread outside the
mono_thread_info_suspend_lock, and then use it to send the signal once we've
taken the lock.
In between those two actions, the other thread already finished
unregister_thread and pthreads may already have destroyed its TLS keys and
otherwise started to dismantle the thread.
The fix is to do a second mono_thread_info_lookup once we have the lock and
only signal the other thread if it still around.
Fixes https://github.com/mono/mono/issues/6998
* Simplify mono_thread_info_abort_socket_syscall_for_close
Call mono_thread_info_lookup while holding the thread info suspend lock.
We no longer need to check for STATE_DETACHED because removing MonoThreadInfo on
detach is done while holding the suspend lock.
Assume a class implementing multiple generic I`1 interfaces. If a virtual call invocation is trying to resolve the correct interface using object O implementing I`1 also , the interface is resolved using a set of rules (not fully implemented in Mono), but a requirement is that the chosen interface is "variant-compatible" with object O, that is its generic parameters are set to the same types.
This last requirement is relaxed as an implementation-specific detail when I`1 is IEnumerator`1, in which case e.g. a virtual call on a class implementing IEnumerator<byte> can happen with an object of type IEnumerator<sbyte> by way of sharing IEnumerator`1 as a generic interface they define. Here, clearly the interfaces are not "variant-compatible", and this is allowed.
Resolution of classes implementing IEnumerator should still attempt to select a compatible interface using the standard rules before attempting to apply this special rule.
There would be a compilation error in the XA build as follow:
```
obj/Release/bundles/armeabi-v7a/temp.c: In function 'install_aot_modules':
obj/Release/bundles/armeabi-v7a/temp.c:49:25: error: 'MONO_AOT_MODE_NORMAL' undeclared (first use in this function)
mono_jit_set_aot_mode (MONO_AOT_MODE_NORMAL);
^
obj/Release/bundles/armeabi-v7a/temp.c:49:25: note: each undeclared identifier is reported only once for each function it appears in
```
Address https://github.com/mono/mono/issues/7093 in kind of an adhoc way.
The correct fix is to make
```
((IEnumerable<U>) (new T[] {...})).GetEnumerator()
```
return an `IEnumerator<U>` (like .NET does) instead of `IEnumerator<T>`
and to stop marking IEnumerator as an array special interface.
The Linux build currently just displays "tarball" since we don't
have the .git directory when building the Linux packages.
This allows us to pass environment variables that contain the
branch+commit to the build for generating version.h so we can
show the more detailed info like on OSX.
(cherry picked from commit 7c34f0c746)
* [metadata] move ENABLE_ILGEN definition to configure
* [metadata] split IL generation code into seperate compilation units.
By adding callbacks for IL generating runtime code, we can link in code
later into the runtime that does such for configurations which do not
need IL generation initially. This is the case if you configure the
runtime with `--enable-minimal=jit,interpreter`.
In such configuration, the build will produce an additional library,
called `libmono-ilgen`.
An embedded can choose to link this library to the final binary and
initialize IL generation with the following three, newly added, API
calls:
* `void mono_marshal_ilgen_init (void)`
* `void mono_method_builder_ilgen_init (void)`
* `void mono_sgen_mono_ilgen_init (void)`
This change is mostly moving code around, but there are minor changes
like introducing the enum `MarshalTypeCheckPositions`, so we avoid
copy/paste constants accross compilation units.
* [windows] add IL gen files to windows build and set ENABLE_ILGEN
* [fixup!] fix windows build
fetching Microsoft.NET.Build.Extensions nuget from `cli-deps` to
`dotnet-core`. Both of these should have the same nugets but sometimes
seem to be off by one.
(cherry picked from commit 89182050a769013e68d1d90d5fbca90415425aec)
The original version of this code overwrote the same string over and over
again. Because of the order of operations, when looking for siblings of
Test.dll, we would probe for Test.dll.mdb, then Test.pdb, then Test.pdb.config
(note the last one - should be Test.dll.config).
New version of the code uses fresh strings for each sibling.
Fixes https://github.com/mono/mono/issues/7262
We had a few stubs that threw not implemented exceptions in Dispose()
which causes the finalizer thread to abort.
Since those classes throw in the constructor already there's no way
to create a valid object and we can remove the throw in Dispose().
Fixes https://github.com/mono/mono/issues/7338
* [test] System.Type.IsAssignableFrom of gtd array special interfaces.
Regression test for https://github.com/mono/mono/issues/7095
* [runtime] Don't assert in mono_class_is_assignable_from on iface gtd
Don't assert when comparing if an "array special interface" is assignable from
an array.
The code assumed that the special interface is some sort of generic instance
like ``IList`1<string>``, but it could be a generic type definition
``IList`1``.
There is a case where we would be obligated to return TRUE:
If someone used reflection to get the generic param of ``IList`1`` and then made an
array:
```
var i = typeof (IList<>);
var iparam = i.GetTypeInfo().GenericTypeParameters [0]; // returns gparam T
var a = iparam.MakeArrayType (); // T[]
Console.WriteLine (i.IsAssignableFrom (a));
```
But that case is handled by the `MONO_CLASS_IMPLEMENTED_INTERFACE` check,
earlier in mono_class_is_assignable_from.
So we can return FALSE here.
Fixes https://github.com/mono/mono/issues/7095
Context: https://github.com/xamarin/xamarin-android/pull/1078
xamarin-android uses `mono-api-html` and `mono-api-info` in order to
perform API comparisons; see e.g. 4e459045.
A recent problem has arisen regarding "inter-API-level diffs": there
are many API changes which we consider to be acceptable, and thus
would like to ignore. Unfortunately, `mono-api-html` doesn't support
ignoring many of these constructs, e.g. base class changes:
<h3>Type Changed: Android.Preferences.CheckBoxPreference</h3>
Modified base type: <span class='removed removed-inline removed-breaking-inline'>Android.Preferences.Preference</span> <span class='added '>Android.Preferences.TwoStatePreference</span>
and property type changes:
<h3>Type Changed: Android.Views.InputEvent</h3>
<p>Modified properties:</p>
<pre>
<div data-is-breaking> public <span class='added added-breaking-inline'>abstract</span> int DeviceId { get; }
</div><div data-is-breaking> public <span class='added added-breaking-inline'>abstract</span> InputSourceType Source { get; }
Overhaul the `mono-api-html` "ignore" infrastructure:
* Introduce ignore "scoping". Previously, the ignore options would
only match the *member* text against any provided regular
expression. Thus, `mono-api-html -r ToString` would ignore *all*
members containing `ToString`. Furthermore, there was no way to
restrict the ignore to a particular type. Expand the regex
semantics so that the declaring type is used as a "prefix" for the
to-be-matched text. For example, if a class `Example` is removed,
`mono-api-html` will now match the following value against any
`-r` regular expressions:
Example: Removed type
* Add a `mono-api-html -v` option, to control output verbosity.
When specified, `mono-api-html` will print out available `-r`/etc.
option values:
$ mono-api-html expected.xml new.xml -v
Possible -a value: Android.Resource: Added fields: public static const int AccessibilityEventTypes;
Possible -r value: Android.Preferences.CheckBoxPreference: Modified base type: 'Android.Preferences.Preference' to 'Android.Preferences.TwoStatePreference'
Possible -r value: Android.Views.InputEvent: Modified properties: public int DeviceId { get; }
Possible -n value: Android.Views.UnavailableException: Added type
...
Additionally, allow `mono-api-html` to take a
`Mono.Options.ResponseFileSource`, which allows `@response-files` to
be used as command-line options.
* Make icall tables loadable.
Move the icall table code into a separate icall-table.c file, which is either linked into libmono or compiled into a
separate libmono-icall-table.a archive which can be linked into an app, and installed by calling mono_icall_table_init ().
* Change ClCompile to ClInclude for new .h file.
* [runtime] Fix the --enable-icall-symbol-map build. (#6943)
.. process. Version from:
https://github.com/dotnet/cli/blob/501e11d928c21608999c934f0a7078570b688c6c/build/DependencyVersions.props
```
<MicrosoftNETSdkPackageVersion>2.1.0-preview1-62414-02</MicrosoftNETSdkPackageVersion>
<MicrosoftNETBuildExtensionsPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftNETBuildExtensionsPackageVersion>
```
Also, update the list in the runtime and deniedAssembliesList.txt
installed for use by msbuild.
.. assemblies.
This is specifically required for handling .net assemblies in
`Microsoft.NET.Build.Extensions` nuget which don't work on mono. These
assemblies are bundled with msbuild and we want to be able to deny these
at runtime.
Fix a regression introduced in the new web stack - when connecting
to a DNS host name that resolves to multiple IP addresses, we need
to probe them all.
On iOS, "localhost" will resolve to both "::1" and "127.0.0.1".
Setting ReadTimeout in WebResponseStream.ctor throws System.Net.Sockets.SocketException : Invalid arguments on iOS.
Set it in WebConnection.InitConnection() immediately after establishing a connection, before we read/write anything.
As a follow up to https://github.com/mono/mono/issues/6848 I checked
all the assemblies and found some more identity mismatches with .NET
(cherry picked from commit c84e6c81a2,
minus the Microsoft.VisualC.dll version fix)
* Add a 'frame_addr' field to MonoStackFrameInfo, which is equal to either interp_frame or ctx->sp.
Use this field to compare frames with each other or with stack addresses instead of setting ctx->sp to
the interp frame address, which breaks mixed mode, since mixed mode assumes ctx->sp is the real
sp of the last native interpreter frame.
* Reenable mixed mode tests.
* Get autotools scripts for Mono and Boehm to recognize i
PASE is most similar to AIX, and perhaps I assume other commercial
Unices, as well as PowerPC Linux, so grab variables from them as
needed.
With this, we get glib failing to build due to missing mkdtemp.
* Use better cpp definition to grab more of what we want
* Fix random and 64-bit file offset support
* Set TARGET on IBM i on POWER
* Add hack to gfile-unix.c to work around flawed AIX header
From comment:
/* HACK: the preprocessor will not give us mkdtemp no matter
what and Mono (for good reason) does
"-Werror-implicit-function-declaration" so we error out;
instead declare mkdtemp here; the linker will find mkdtemp
anwyays. libuv has had similar issues, but they just ignore
the compiler warning instead of failing on it.
See: github.com/libuv/libuv/pull/740 */
* Work around missing definition on AIX/PASE
* Fix conflicting definition from due too AIX headers
* Initial work to get JIT working on AIX
* uncertain about NIP; is IAR the right register? need review from
PPC asm people
* needs calling convention work; AIX does NOT use ELF
* Fix lack of casting on sigcontext macros, fix errnos for AIX
* AIX doesn't distinguish between ENOTEMPTY and EEXIST without a
define. Handle this case with a conditional cpp directive..
* When ctx is a void pointer, dereferencing as a struct will fail.
Handle this case with a cast.
* Handle regular AIX as well as PASE
* Implement stack boundaries check for AIX, volume info func
* vol info should be like other Unix, just needs to bridge ifdef
* highly uncertain for the bounds checking, needs further review
* Fix typo in mono/utils/mono-threads-aix.c
* In boehm-gc.c, don't use pthread_getattr_np on AIX even if available
It's not available on IBM i, and even if available, toolchains for AIX
may "helpfully" swap out system headers with variants that remove
functions like pthread_getattr_np.
* Don't use "-export-dynamic" on non-GNU ld
IBM ld considers "-e" to be a flag for setting the entry point.
Detect non-GNU ld, and offer equivalents when possible.
The makefile in mini had to be changed as a result due to
hardcoded flags.
* Use pthread-stop-world.c on AIX
Remove an ifdef that gated this off to AIX. It seems the old AIX
specific files shouldn't be used, and that the changelog for libgc
says pthread should work fine on AIX instead; yet it was blocked.
Restore this, as it compiles and seems to let mono-boehm link fine.
* AIX workarounds for some of support dir
* fstab on AIX is there, but defines a struct more like other
platforms' checklist struct.
* AIX, like macOS and some BSDs, doesn't define some serial types.
* psignal is another victim of GNU; even then it isn't in PASE
headers anyways
* More support workarounds for AIX headers
* Replacement function body for syslog2 on vsyslog-less platforms
AIX lacks vsyslog; detect in autoconf and act appropriately.
* Final support hacks for AIX
* Fix problematic stack management on AIX
this gets us past ifdefs, after much handwringing
* get the right end of the stack; r1/stack pointer is on the wrong
end and ustk is just plain broken
* AIX doesn't seem to like the semantics of the mmap call valloc
does here; either we're allocating into an area we shouldn't be
or we're not passing the right flags. Until then, learn to live
without the stack guard?
* Disable Boehm GC on AIX
Focus on getting SGen working, and avoid legacy debugging nonsense
* Remove AIX ifdef-undef and replace with s/hz/uhz
* Don't use sigaltstack on AIX due to bugginess with guard sections
The valloc call on AIX has issues after issuing mprotect; don't do
do it. I believe it fails because we aren't issuing the right
flags on AIX, or because we're allocating inside of an already
allocated area.
* Perform a 64-bit build on AIX
We still crash at the same place, but probably for the best that
we switch to 64-bit. (Maybe we could make it configurable?)
* Fix func descriptor ifdef, add initial (likely wrong) defs for AIX
* AIX doesn't define __powerpc64__ or __ppc64__ when compiling as
64-bit. Use an alternate ifdef, and shuffle around that ifdef
anyways, as it could lead to wrong results on other platforms
too.
* AIX likely needs special definitions, especially on 32-bit. The
calling convention is closest to PPC64BE Linux, but not exactly.
* Fix stack size on AIX
Ruby dealt with this before: https://github.com/ruby/ruby/commit/a2594be783c727c6034308f5294333752c3845bb
* Set up initial PPC hwcap for AIX, fix ftnptr ifdefs, tweak AIX defs
* Fix hwcap to use better values on PPC AIX
Still needs more adjustment though
* Fix alignment issue on AIX, tweak mini-ppc values just a bit more
* On AIX, doubles are always aligned by 4 if they're in structs.
Since we need to have them aligned by 8 on 64-bit, this is bad,
so change the type on AIX.
* We can use this definition on AIX
Now we can bootstrap Mono!
* Shuffle MonoArray ifdef per suggestion of @vargaz
* Fix System.Decimal division on big endian systems
Before, we got non-sensical overflow on things like
`(Decimal)Int32.MaxValue / 1000`; now they get the same value,
comparing this POWER6 running AIX to my server's output running
OpenBSD/amd64.
* Fix dynamically linked build of Mono on AIX
nm wasn't seeing 64-bit symbools as it defaults to 32-bit mode,
also never try to use GNU nm
* Fix PPC64 define in mono-config
Interestingly, there was an AIX define already present, and that
definition is present in AIX's passed includes, so continue to use
it.
* Don't use __thread even if detected on AIX
tl;dr: The assembler gets angry with __thread and minimal-toc, and
changing options to replace minimal-toc causes linker issues; this
TLS option isn't important anyways if we have pthread instead,
like before when we were using Perzl's old GCC without __thread.
* Get lib.a(lib.o) type archives working with P/Invoke for AIX
AIX libraries are very, very strange compared to other Unices.
I'm not entirely sure if this is correct or optimal; it may need
to special case further. For now, it's enough to get gacutil
up and running.
Some resources I found useful for this charade:
<http://stromberg.dnsalias.org/~dstromberg/AIX-shared-libs.html>
Also set libc and libintl to their proper values.
* Scheduling priority hack for i
PASE doesn't accept anything other than SCHED_OTHER, and the funcs
for getting min/max don't work either. AIX suffers, but only a
little bit.
* Final polish on request
Remove Boehm changes if we don't use Boehm, tweak some defines,
remove some externs, tweak autoconf file
* Be aware of ERESTART, on OSes that use it
Instead of EINTR/EAGAIN, AIX uses ERESTART. Handle this, so things
like xsp are less chatty when performing async IO.
The `label` environment variable is set by Jenkins based on the
chroot/node configuration a given job is using.
This crept into the CI scripts while it should have been a
separate concern and caused all sorts of issues when we bumped
from e.g. debian-8-* to debian-9-* in some jobs.
Instead we should consistently use the CI_TAGS env var which we
control exclusively.
* [sdks] Fix build for llvm
* [sdks] Have .stamp-%-configure always depend on .stamp-%-toolchain
* [sdks] Dependencies on directories should always be order-only
This commit implements checking whether the compiler used to build mono supports
the recently added switches to generate code designed to mitigate the effects of
the Spectre/Meltdown bugs of the modern CPUs (https://meltdownattack.com/).
As of this commit the options are implemented for GCC 8.x, 7.3 and backported to
some older versions of gcc 7.x (e.g. in Ubuntu). The options tested for, and
used, here are:
-mindirect-branch (https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/x86-Options.html#index--mindirect-branch)
-mfunction-return (https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/x86-Options.html#index--mfunction-return)
Checks and usage of the above flags is hidden behind the
`--with-spectre-mitigation` configure option, defaulting to `no`.
Two additional options are implemented to specify the kind of thunk to implement
by each of the flags above:
--with-spectre-indirect-branch-choice=keep,thunk,inline,extern
Convert indirect branches to the specified kind of thunk (defaults to inline)
--with-spectre-function-return-choice=keep,thunk,inline,extern
Convert function return instructions to the specified kind of
thunk (defaults to inline)
The CoreFX version has a few error checks which are not in the
referencesource, switching to CoreFX allows us to enable their tests.
Use Path.GetRandomFileName() and Path.GetTempFileName() in tests.
We are now using nested streams to take care of buffering, chunked encoding and automatic decompression.
GZip / Deflate decompression have been moved inside `WebResponseStream`, the `HttpWebResponse` now always returns a `WebResponseStream` (and not a `GZipStream`) because we have to do extra book-keeping after reading the entire content.
Returns TRUE if the method flags indicate that it's not expected to have a
body because it is abstract, a PInvoke, an internal call or a
runtime method.
* Print combined stdout and stderr in console output.
* Print the RNG seed used for a test run on startup and in the test report.
* Set the individual test timeout back to 6 hours.
* Use the nodefaults profiler option.
* Allow configuration through environment variables:
- MONO_PROFILER_STRESS_OPTIONS: Specify a set of profiler options to use
instead of the randomly generated ones.
- MONO_PROFILER_STRESS_REGEX: Specify a regular expression to filter which
tests should be run.
- MONO_PROFILER_STRESS_SEED: Specify the RNG seed. Useful for reproducing full
test runs at a later point.
- MONO_PROFILER_STRESS_TIMEOUT: Specify a different individual test timeout
from the default.
it has the right logic to avoid this:
```
ld: -undefined and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together
```
i.e. setting `-no-undefined`. However, this requires that we link
against `libmonosgen` on those platforms.
We've been using a certain pattern for the Windows .msi for a long
time but the build output used a different name which we simply
manually renamed before publishing.
Since we want to automate as much as possible we can change the
build to produce the correct name right away.
For mono_thread_get_undeniable_exception to work, it needs to unwind the stack and find the first managed frame. This is only possible if we push an interp LMF with a frame for the interp to native transition.
During interp frame unwinding, we were initializing the sp field (to the corresponding interpreter frame) starting with the parent frames of the first interpreter frame.
Debugger maintains it's own list of loaded classes. The unload/filter
logic does not handle composite types like arrays and generic instances.
Expose and reuse the logic from metadata that properly detects any
usage of an image within a type.
This prevents the cache from containing MonoClass values which have
already been freed by the metadata cleaning code.
* Minimal fix to Authenticode infrastructure to understand PE32+.
A number of other problems are noticed in the code but commented only.
This fixes https://bugzilla.xamarin.com/show_bug.cgi?id=56071
* Induce many array out of bounds accesses, and some other error paths.
* Tweaks.
* tweak
* Move braces, move addition, document constants and use them.
* whitespace
* fix comment
* remove diff-minimizing hacks
* cosmetic
* move braces and assume zero-initialization; adjust comment.
* improving Makefile but still a ways to go
* fix C# indent
* Change from C++ to C, and cleanup Makefile.
* update clean target in Makefile
* cleanup Makefile and C#
* remove test code that people don't like and it wasn't very useful
wordsmithing and new good information in comments
* Fix indentation
When an exception is thrown from jitted code, the EH mechanism correctly sets the interp resume data to the right interp frame that should catch the exception, but it resumes to the interpreter by force, setting the MonoContext. This context has invalid data (for example the SP points to a InterpFrame and it is not the real sp at interp exit)
This bug was exposed by inlining changes from d3763c6c1e
* Move machine handling of performance counters from native
to managed -- just slightly less native code therefore.
* PR feedback: Rename ValidMachine to IsValidMachine.
Use string::operator== instead of .Length/[].
Change InstanceExistsInternal to return bool/MonoBoolean directly instead of int.
Remove question mark on FIXME comment for more reliable grep.
Remove redundant zeroing of a pointer.
Also add two more variants
* mono_error_assert_msg_ok (err, msg) to print "msg, due to <err>" on failure
* mono_error_assertf_ok (err, fmt, args...) to print
"<formatted args>, due to <err>" on failure.
Avoid inlining some functions with high stack frame locals usage (ex functions that use MonoLMFExt which is a big structure).
No performance cost was observed on microbenchmarks, while stack usage decreased by over 3 times on amd64 and over 4 times on arm.
Give it 2.5 seconds.
https://jenkins.mono-project.com/job/test-mono-pull-request-amd64/10727/parsed_console/log.html
Tests run: 120, Passed: 119, Errors: 0, Failures: 1, Inconclusive: 0
Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
Elapsed time: 00:00:32.8320000
Errors and Failures:
EndBuildWaitsForSubmissionCompletion (MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion)
#5
Expected: less than or equal to 00:00:02
But was: 00:00:02.0757916
at MonoTests.Microsoft.Build.Execution.BuildSubmissionTest.EndBuildWaitsForSubmissionCompletion () [0x00126] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs:105
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in /mnt/jenkins/workspace/test-mono-pull-request-amd64/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
Split mono_method_get_header_checked into internal and external forms. (#6609)
External form is mono_method_get_header_checked, the preexisting name.
Internal form is mono_method_get_header_internal.
External must initialize the MonoError for compatibility, internal can/should assume it is already initialized per the new pattern.
* g_assert should be an expression not a statement; provide g_assertf f is format like printf
- g_assert should be an expression, not a statement
ANSI C assert gets this correct, and I corrected
widely used NT ASSERT circa 2001 with no ill effects
Note that ANSI C assert is void, g_assert here is boolean.
- provide g_assertf
f is for format, like printf -- too terse?
Where you might previously say:
if (!(expr))
g_error(...); // like printf
now:
g_assertf(expr, ...)
Manual tests provided -- how to provide a test whose success is failure to compile?
Correct existing eglib/test to build and pass, but don't enable in build.
Enabling it is a line in toplevel configure.ac to add eglib/test/Makefile
after eglib/Makefile.
* Fix comment in test code.
* format with s instead of hs
* review
* [WASM] Fix System.Core issues and disable broken tests.
* [wasm] Fix cookie computation heap overflow. Use a local to make it thread safe.
* [wasm] Disable System tests that don't work under WASM. Change the wasm profile to disable BSD sockets.
* [wasm] Address reviewer feedback.
* [wasm] Disable test that requires multiple threads.
* [wasm] Add package target to wasm.
* [wasm] Modify the runner to exit(1) if the test suite fails.
* [wasm] Add CI configuration for WebAssembly.
* [wasm] Fix issues found over review.
* [runtime] Export mono_class_get_checked () for use in profilers.
* [runtime] Expand mono_method_get_header_summary () to collect more info.
It now collects all the trivially-accessible header data that doesn't require
chasing down other metadata.
* [profiler] Use mono_method_get_header_summary () in the coverage code.
We only need code start and size information, not all the data that is present
in the header. By switching to this function, we avoid all the side effects
that come with resolving local variables and exception clauses (which can even
result in loading assemblies in the worst case).
* [profiler] Write out all uncovered classes/methods in a loaded image.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=60225
This required a bit of refactoring and some workarounds for various special
cases. This also fixes some race conditions with respect to how data was
inserted into the lock-free hash tables and queues.
In c7d8d247c3 I unified how we're
passing -arch in CFLAGS to "-arch=XXX" since the original change
in 63a49e9eb8 mixed the formats.
Turns out the correct syntax is "-arch XXX" instead and it broke
the ccache build in bockbuild because it complained about the
unknown format.
Also add LDFLAGS in the amd64 case to match what we have in bockbuild.
When we had a jit info table for aot images loaded in the domain, we would queue jit infos for freeing at domain unload time. This means leaking during entire application life.
Add comment for jit info freeing when having multiple tables.
Fixes#60986.
This cute hack allow us to cut the budget of perf irrelevant blocks[1] while massively boosting those that are perf relevant[2].
It has a ton of missing features, like it doesn't detect nested loops, it doesn't take hints from inlined methods and it doesn't compute EH info.
Beyond that, inlining budget is all but horrible, so there's ton of room for improvement here.
Results are promising.
A marginal improvements in benchmarks like Roslyn (2% user) while as much as 30% in micro benchmarks where the now bigger methods are in loop bodies.
Code size with Roslyn changed from 5433242 to 5501751, IE extra 68.5k, or 1.2% more.
[1] those ending in throw or in a catch handler
[2] Loops
we return the address of the StackOverflowException object in
`restore_soft_guard_pages`, so it ends up in the architecture specific
result register (e.g. %rax) where the exception handler expects it.
fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60862
* [test-runner] Record test duration in NUnit xml
This allows us to keep track of the time on Jenkins.
Also fix issue where we were recording .Seconds of a TimeSpan instead of .TotalSeconds.
* [tests] Bump timeouts in process-stress-?.exe runtime tests
We're seeing these fail sometimes on Linux Azure VMs, let's try
if bumping the timeouts helps.
* [class] Add Obsolete message to ICSharpCode.SharpZipLib.dll
Users should use the nuget package instead, we'll remove the assembly in Mono 6.0
Don't install it into the 4.7.1 reference assembly directory anymore.
* Bump API snapshot submodule
* [runtime] Allow access to protected default interface methods from classes which implement the interface.
* [interp] Add some automatic conversations between virtual and non-virtual calls that .net has. Fixes dim-valuetype.il.
* [bcl] Sort the MethodImpl table in PEAPI.
* [runtime] Enable dim-methodimpl.exe test.
* [runtime] Fix vtable construction tracing.
* [interp] Fix null checks on the receiver when converting virtual calls to non-virtual.
Rationale:
1. it asks for double faulting scenarios we can't do anything about
it anyway, exception just unmap yet another page
2. `mprotect(2)` behaves weirdly (at least on macOS) if you try to
change permissions for subsequent pages with different permissions.
With the previous code it happened that the requested memory range
would go from somewhere in the stack guard and overlap into the
regular, unprotected stack and end up with unpredictable behaviour.
We could be more careful about it, but it would complicate things
even more.
no longer needed. It remains only for register_icall.
Remove casts from void* to HANDLE, as HANDLE always and forever
will also be void*.
Add comments explaining the valid use of INVALID_HANDLE_VALUE (-1).
With CreateFileMapping, for the file handle, it means to
use physical memory / pagefile.
Previously, we tried to keep the intern status of a string consistent across domains. Meaning
that if you interned "FOO" in domain 0, it would return true for String.IsInterned in domain 1.
This behavior exists in the CLR because the string table is shared between domain as string are
what they call agile objects - those that can exit in multiple domains at the same time.
Mono appdomain isolation doesn't work that way and there's not visible advantage of keeping that property.
The reason for this change is to potentially reduce the amount of interned strings and, more importantly,
reduce the amount of domain lookups, which are quite expensive and unsafe.
This should speed up interning queries.
Follow up to https://github.com/mono/mono/pull/6431, we should
capture the exception that is passed to the methods.
Copied the SetResult() method that referencesource uses.
* [mini] factor out interp into a library
It enables us to ship the interpreter as an add-on to the runtime.
Embedder can statically link it into their application on demand.
Usage:
configure mono without the interpreter, such as:
```
$ ./autogen.sh --enable-minimal=interpreter ...
$ make; make install
```
run your favorite program with the interpreter and see it fail:
```
$ ./mono/mini/mono-sgen --interpreter ./mono/mini/basic.exe
Mono IL interpreter support is missing
```
despite `--enable-minimal=interpreter`, we can still build the interp
module:
```
% make -C mono/mini libmono-ee-interp-static.la
CC interp/libmono_ee_interp_static_la-interp.lo
CC interp/libmono_ee_interp_static_la-mintops.lo
CC interp/libmono_ee_interp_static_la-transform.lo
CCLD libmono-ee-interp-static.la
```
`libmono-ee-interp-static.a` can be statically linked into the target
application.
* [fixup] include libmono-ee-interp reference in runtime unit-tests
* [runtime] Mark mono_class_get and mono_class_get_full external only.
Runtime should use mono_class_get_checked and
mono_class_get_and_inflate_typespec_checked, respectively.
* [runtime] Mark mono_ldtoken external only
Runtime should use mono_ldtoken_checked
* [metadata] Mark mono_type_create_from_typespec external only
Runtime should use mono_type_create_from_typespec_checked
* [runtime] Remove mono_class_inflate_generic_method_full.
Mark mono_class_inflate_generic_method external only.
Runtime should use mono_class_inflate_generic_method_full_checked.
* [runtime] Mark mono_get_inflated_method external only
This function is obsolete. It should have no callers.
* [metadata] Mark mono_field_from_token external only
Runtime should use mono_field_from_token_checked
* [runtime] Add MonoError arg to mono_class_get_inflated_method
* [metadata] Mark mono_metadata_parse_method_signature external only
Runtime should use mono_metadata_parse_method_signature_full
* [metadata] Mark mono_metadata_interfaces_from_typedef as external only.
Runtime should use mono_metadata_interfaces_from_typedef_full
* [mini] Add MonoError arg to mono_class_get_method_generic
Also move its declaration from metadata/class-internals.h to mini/mini.h
since it's defined and used in mini/
* [class] Assert that mono_class_get_inflated_method never returns NULL
* [interp] Add missing param support for floating types in interp_entry
Remove some duplicated code
* [interp] Reenable thunks.exe on arm
It fails due to the known RGCTX register clobbering by trampolines.
* include netinet/in.h for in_addr_t
* there is no need for an openbsd specific implementation anymore
so you use the generic pthread one
* signal.h is required for sigaltstack
* add missing mono/utils/mono-threads.h include
* there is no malloc.h on OpenBSD either
* sys/socket.h is required for struct sockaddr
* add support for btls on openbsd and default to with_tls=pthread as there is only emultls support which is not enough for mono
* there is no need for pthread_attr_init/destroy anymore
* add -Wl,-zwxneeded to LDFLAGS on OpenBSD
W^X is strictly enforced by default on OpenBSD;
a program can only violate it if it is located on a filesystem mounted
with the wxallowed mount(8) option and has been linked with the
above flag
Since object-internals.h is included in a ton of places, we get one Centrinel warning
about mono_internal_thread_handle_ptr per translation unit every time the
header is included which is ridiculously noisy.
This commit will suppress the warning about the body of this function.
Note that uses of the function will still get a warning since it returns a
MonoInternalThread* and we haven't yet taught Centrinel that those calls are ok since
the thread object is pinned.
Otherwise we'd get a "directory not empty" exception in the
TestFixtureTearDown (which for some reason isn't shown in the log?).
This was added in https://github.com/mono/mono/pull/6272
They were set in https://github.com/mono/mono/pull/6272 but since
env vars are process wide we'd end up with non-existing paths once
the tests are done. It is safer to unset the variables after the test.
* [System] Add unit test for Xamarin-2315
* [System] Use temporary directory for saving settings files
This change modifies the ApplicationSettingsBaseTests so that they
store the settings files in a temporary directory. This reduces
the risk of failed tests because of stale files from previous test
run, or from a build that runs in parallel.
* [System] Improve Settings behavior (Xamarin-15818)
Improve behavior of ApplicationSettingsBase class to match Windows .NET
more closely.
* Implement Upgrade to allow Upgrading of settings
* Make SettingsPropertyValue serialization work for complex objects
* Make Save and Update throw in unimplemented configurations
* Changed Reload to clear PropertyValues so they are reloaded
and fire PropertyChanged event for all Properties
* Modified Reset to do what Reload used to do.
* Added a backup Type loading for custom SettingsProviders
* don't call SettingsSaving on Reset()
* [System] Fire SettingsSaving event (Xamarin-2315)
When calling ApplicationSettingsBase.Save() the SettingsSaving
event has to be fired.
* [System] Add unit tests for Xamarin-15818
* [interp] Check for exception at field address failure
For example if the static constructor throws an exception
* [interp] Run class cctor before allocating objects
Otherwise we could end up throwing TypeInitializationException from the finalizer thread. We do the same with jit (emit_class_init).
* [interp] Check for method access failure when doing a call
* Fix some ThreadPool performance counters.
https://bugzilla.xamarin.com/show_bug.cgi?id=41294
The bug is that some performance counters are always zero.
Because we do not update them.
This addresses two of them: Work items added and thread count.
There is PerformanceCounter class and you can Increment instances,
however its metadata and some of the implementation is in System.dll.
Most of the code is in native.
ThreadPool is in mscorlib.dll, so can't use System.dll.
A few options exist to address this.
We could move and forward the type. We could duplicate and rename
and possibly subset the type.
Here we add a new icall very specifically for the scenario.
There is slight cost for the icall, and for the atomic increment.
There is an attempt to measure but the results were unclear.
Note that the count of work items is not specifically for QueueUserWorkItem
as one might expect, but also for any async calls.
Fix a little bit of typos.
* Take command lines from command line per PR feedback.
* newline at end of file
* Adds support for nanosecond resolution file information where available.
This patch adds support to the runtime to use the nanosecond
information available on Mac and Linux on `struct stat`.
`stat.st_Xtimespec` strucutre on OSX, and `stat.st_Xtime` and
`stat.st_Xtim.tv_nsec` pair on Linux.
Additionally, this adds support in `Mono.Posix` for MacOS nanosecond stat
data, it already had Linux support before.
* Use ULL here to prevent the computation from overflowing
utf16 to ascii for equality.
g_utf16_ascii_equal takes lengths, which are checked first
and unequal length implies unequal strings, and then no characters are looked at.
"z"" for zero means nul terminated and requires scanning the string.
Still, an equality primitive is often desired vs. inverting inequality.
These can cleanup some code -- extracted from a larger not yet commited PR
that uses it.
I found out that we were packaging e.g. MonoPosixHelper.dll from
the gtksharp msi instead of the one we build in Mono :P
This only happened in the x86 build because we don't package
gtksharp in the x64 build.
* Remove duplicated code by factoring on endian parameter.
* Force inline to mimic previous.
* fix the forceinline part
* Do not forceinline utf32, we never use it.
This can happen when emitting code like:
```
class Foo<T> {
T elt;
public T getter () {
return elt; // ILGenerator.Emit (OpCodes.Ldfld, /*FieldBuilder of Foo::elt*/)
};
}
```
the old incorrect code emitted a fielddef token for Foo::elt, but it should be a
memberref for Foo<!0>::elt.
Likewise, if we have
```
class Foo<T> {
public T f () { /*...*/}
public void g () {
var x = f (); // ILGenerator.Emit (OpCodes.Call, /* MethodBuilder of Foo::f */)
/*... */
}
}
```
Fixes https://github.com/mono/mono/issues/6192
the old incorrect code would emit a fieldref token for Foo::f but it should be
a memberref for Foo<!0>::f
They contain files with very long names which causes issues with `tar`.
We simply remove them from the dist directory before creating
the tarball since we don't use them in the Mono build anyway.
Fixes https://github.com/mono/mono/issues/6349
On some distros the number of strings you can pass to execve()
is limited which means you get the following error when trying
to create the tarball:
```
make[5]: execvp: /bin/sh: Argument list too long
make[5]: * [../../build/rules.make:303: dist-default] Error 127
```
To solve this we split the DISTFILES variable into groups of 100
entries and invoke the shell for each group instead of adding all
into the same invocation. Also removed looking for 'makefile' and
'GNUmakefile' since those don't exist in Mono and simplifies the logic.
Found during investigation of https://github.com/mono/mono/issues/6349
Revert the embedding API behavior change introduced by dcdfb3c500
mono_string_new will:
* return NULL if the given byte sequence is not a valid UTF-8 sequence
* assert if there is not enough memory to allocate a new MonoString.
This only changes the behavior of the API function. The runtime will continue
to use mono_string_new_checked which sets MonoError* for both sorts of
failures.
* [runtime] Bring jemalloc to mono
Jemalloc is known to have much better performance than system memory
allocators, and is safe in concurrent/re-entrant situations.
To use, provide the following options to configure:
--with-jemalloc to enable optionally. To use at runtime,
export MONO_USE_JEMALLOC to the environment.
--with-jemalloc-always to enable and make the default
--with-jemalloc-assert to enable with assertions to catch memory
unsafety. It adds overhead, but an overhead that's much less than
valgrind or asan.
If you export
MONO_JEMALLOC_CONF="stats_print:true"
You will see detailed memory statistics for mono at exit.
Now note that jemalloc is used through an explicit registration, so
C libraries called through pinvoke calls will not use jemalloc unless
they configure themselves to do so separately.
To understand the build work, I'm statically linking jemalloc.a into
the compilation unit for mono/utils/mono-jemalloc.c, which is
responsible for registering it with mono at startup. No further
copying out of the submodule is necessary at installation time.
* [runtime] Fix OSX 32-bit build definition
* Unbreak XMM register handling on platforms without MonoContextSimdReg
Platforms like Haiku (and glibc-less Linux, but that was unbroken a few
weeks ago) don't have this implemented on Mono. (yet?) Restore old
behaviour behind an #ifdef (same one as on mono-context.h) - perhaps it
could be a nicer ifdef, but I'm keeping this consistent for now.
* Attempt at a universal ifdef for MonoContextSimdReg presence
Suggestion of @kumpera. I've put #ifdefs in the obvious places, and
verified that the commit ensures we're still in the same position as
before.
* Fix non-MonoContextSimdReg calls in tramp-amd64.c
Follow advice of @joncham wrt the type and function to use instead.
* "Fix" a case of an error being ignored.
* And then remove mono_string_to_utf8_image_ignore which is not used.
And then remove the gboolean ignore_error parameter which is always FALSE.
Unlike on the jit (where we set a local variable on the stack frame of the last finally block), use the simple explicit abort protecting code which is used also for cctors. We can't use handler block guard logic since we can't async unwind from the interpreter.
* cooperative suspend babystep wrt mono_domain_try_type_resolve(MonoObject*).
No reduction in warnings, but remove one call to a function that has
warnings, leaving sre.c alone for now.
We have:
mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb)
mono_domain_try_type_resolve_checked (MonoDomain *domain, char *name, MonoObject *tb, MonoError*)
The MonoObject* tb parameter causes a warning under cooperative suspend static validation.
Between name and tb, only one is ever used -- i.e. the non-null one, favoring name.
The non-checked function is embedded, so it survives for the time being.
Internally, we have reflection.c calling _checked(name != null, tb == null) and sre.c the opposite.
So, this fix refactors the function such that one takes const char* and the other MonoObject* (or MonoReflectionTypeBuilder*).
Some calls to a function with a warning are therefore replaced by calls to a function without a warning.
sre.c is left alone for now, therefore the number of warnings does not go down.
The caching within of System.AppDomain.DoTypeResolve is refactored into mono_class_get_appdomain_do_type_resolve_method.
Should we have GENERATE_GET_METHOD_WITH_CACHE like GENERATE_GET_CLASS_WITH_CACHE? Or GENERATE_GET_METHOD_CACHED?
A few stylistic experiments:
ternary operator?
const?
Some name shortening?
Non-anonymous struct tags?
Forward declaration to increase type safety?
_checked suffix optional if not differentiating from other?
* Cleanup MonoError initialization and usage.
Thread MonoError through a bit -- add mono_class_get_method_from_name_checked.
Could also be named mono_class_get_method_from_name_flags_checked.
Rename tb to typebuilder.
rename _builder to _typebuilder.
Reduce but don't eliminate struct/typedef change.
Remove extra braces.
* More MonoError tweaking -- the existance of cleanup breaks the model.
* remove a newline that was added
* Remove line breaks.
Put struct forward declaration among others.
Restore g_warning.
i.e. code review feedback
* Remove some newlines.
* more newlines
* Move from public class.h to private class-internals.h.
* Move new forward declarations out of public header object.h
and into new internal header object-forward.h.
waitpid(-1,...) reaps all zombie child processes of the calling process (see `man waitpid`). After a child process is reaped, it can no longer be queried. Because this reaping step is invoked via the `SIGCHLD` signal, all zombie children of the calling process are reaped every time any child process terminates, regardless of whether that child process was tracked by Mono.
The impact of this bug is that apps using Mono that spawn their own child processes (outside of Mono's `w32process` API) cannot query the exit state of its children. For example, a call to `waitpid(my_child_pid,...)` will return `ECHILD` for "no such child" because Mono has already cleaned up the child the moment `SIGCHLD` was raised.
* Minor cleanup split out and expanded from another larger change.
- Spelling in comment.
- 'l' is a short identifier that looks like '1' -- use "len".
- Remove extra braces.
- Add some g_assert (error) before error_init (error).
* remove unuseful asserts
* [ios-sdk] Rename test-runner directory to 'runtime' to be consistent with xamarin.ios.
* [ios-sdk] Add missing xamarin_log () icall used by Console.Write ().
* [ios-sdk] Change the run-ios-sim target so it works on ios11 as well, the --console option to simctl appears to be broken.
* [ios-sdk] Add a test harness.
The test harness is resposible for starting the emulator, installing the app on the emulator, running it, and
collecting application output using the osx logging facilities.
* [ios-sdk] Fix detection of the app exiting with an unhandled exception.
* [ios-sdk] Add CI support for running some test suites on the simulator.
* [ios-sdk] Kill the log reader process on shutdown.
* [ios-sdk] Disable android on CI because the make targets error out if the android sdk is not installed.
* [ios-sdk] Fix error checking in make targets.
* [ios-sdk] Remove accidently commited binary.
* [ios-sdk] Switch to using os_log instead of NSLog (), the latter doesn't seem to show up in the logs anymore. Switch to using the default ios sdk instead of hardcoding 11.1.
* [ios-sdk] Don't hardcode the ios version when creating a simulator.
* [ios-sdk] Parse the output of simctl list runtimes as json.
* [ios-sdk] Use 'syslog' style logging, its supported by older osx versions.
* [ios-sdk] Fix logfile parsing.
* [ios-sdk] Fix log filtering.
* [ios-sdk] Add test exclusions file for System.
* [ios-sdk] Redirect runtime logging to os_log ().
* [ios-sdk] Link libMonoPosixHelper and zlib into the test runner.
* [ios-sdk] Fix the target64 and cross64 builds.
* [ios-sdk] Build target64/cross64 on CI.
* [ios-sdk] Add device support to the runtime lib. Mark strings in os_log () calls as public.
* [ios-sdk] Log stdout messages using a separate subsystem for easier filtering.
* [ios-sdk] Add an 'appbuilder' tool which can generate simulator and device apps.
* [ios-sdk] Build device tests on CI.
* [ios-sdk] Add a test-runner instead of using nunit-lite-console.exe. The two are identical right now, but they might diverge in the future.
* [ios-sdk] Add a script to download prebuild llvm binaries.
* [ios-sdk] Run the runtime initialization on a separate thread, not the UI thread.
* [ios-sdks] Fix the build.
* [ios-sdk] Build the cross compiler against llvm.
* [ios-sdk] Add missing file.
* [ios-sdk] Add llvm support, enabled by passing LLVM=1 to make build-ios-dev-<app>.
* [bcl] Enable System.Security tests on the MOBILE profile.
* [ios-sdk] Enable more test suites.
* [ios-sdk] Fix device builds.
* [ios-sdk] Make some test steps non-fatal.
* [ios-dev] Use ad-hoc signing to sign device apps.
* [ios-sdk] Decrease the timeout on run-sim to 20m.
* [ios-sdk] Send back the test results using a tcp connection, parsing the ios logs is too fragile.
* [ios-sdk] Mark System.Net.Http tests as notworking, they seem to fail on CI.
* [ios-sdk] Compile the 32 bit cross compiler against llvm as well.
* [ios-sdk] Package up the binaries which can be uploaded to storage.
* [ios-sdk] Fix the download-llvm.sh script.
* [ios-sdk] Compile cross32 on CI.
* [ios-sdk] Use Options.cs from the mcs sources instead of making a copy.
* [ios-sdk] Avoid hardcoding the xcode sysroot, obtain it using 'xcode-select -p'.
* [ios-sdk] Fix the previous change.
* [ios-sdk] Add an option to appbuilder to cache aot compilation results between building different apps.
* [ios-sdk] Build device apps with llvm as well on CI.
* [ios-skd] Use XCODE_ROOT in a few more places, update README.md.
Triggering a forced collection means that it should to an immediate full collection of that generation. If we were having a running concurrent collection we were only finishing it. We should also trigger a new serial gc.
After minor or concurrent collections, we can have dead objects (can not be referenced starting from the current root set) still alive on the heap which can confuse profiling tools.
If we have a heapshot requested and we can't do it on the current collection, defer it to the finalizer.
Lack of it causes a build error in XA:
CMake Error at [..]mono/external/boringssl/util/android-cmake/android.toolchain.cmake:800 (message):
Specified Android native API level 'android-12' is not supported by your
The set of minimum API levels in `configure.ac` is incorrect. The current
NDK (r16) requires minimum API level of 14 for the 32-bit targets and level 21
for the 64-bit targets.
For a m2n transition we expect that we are already in managed (interp) and the delegate's method_ptr expects an InterpMethod. Refactoring will be needed in the future.
Mirror mono_marshal_get_struct_to_ptr. These methods can also handle non valuetypes (with certain attributes), which CEE_UNBOX doesn't logically handle.
There is no need to use BSTR marshaling to convert a SecureString to a
string. On some platforms, BSTR marshaling is not implemented, but we
still want to be able to convert a SecureString to a string on those
platforms.
So instead, use Unicode string marshaling.
https://github.com/mono/mono/pull/5599 fixed a race condition during shutdown
when runtime threads have come parts of their way through detach, but still
depend on runtime resources, like GC memory. The fix added runtime threads
to the joinable thread list just before they vanished from mono_thread_manage
radar making sure shutdown waited upon the thread before cleaning up.
The above fix slightly changed the behavior of the finalizer thread since it
waits on joinable threads and will now potential block on threads still
executing code (that involves runtime resources). There’s was an assumption
around the threads on the joinable thread list that they should be very close
to complete when added, so join calls coming from the finalizer thread should
almost never block and if it does, the code that remains to execute should not
involve runtime operations risking deadlock situations. Adding the thread to
the list earlier than previously done expose the shutdown to some potential
theoretical problems.
To mitigate the risk and still solve the race condition this commit adds a
mechanism to keep track of active runtime threads until they park on joinable
thread list. The pending counter will be waited upon by the shutdown
thread, just before it does its regular wait on all joinable threads
(after finalizer thread has stopped) to make sure all runtime threads have
been added to the joinable thread list before waiting upon them. Threads are
added to the joinable thread as late as possible, exactly how it’s been done
in the past by sgen_client_thread_detach_with_lock. Shutdown thread will wait
on runtime threads to appear on the list for a short time and if timeout (pending
runtime thread count not reaching 0 before timeout), it will just print a warning
and continue shutdown.
Getting into a wait state during shutdown due to runtime threads not yet added to
joinable threads list should be very rare (hitting previous race condition that was rare),
triggering the timeout should be even more rare, and if that ever happens, we are exposed
to shutdown race condition as we have had in the past, but now we at least get a warning in
the log making it simpler to analyze further.
This commit also fixes a problem with the debugger thread hitting the same race condition as above.
The shutdown thread stopping the debugger thread didn't completely wait for it to stop using runtime
resources before continue shutdown sequence. This triggers the same race condition as when shutting
down regular runtime threads. This commit makes sure stop_debugger_thread waits on the debugger thread
handle to become signaled (happens at the very end of thread lifetime) before continuing the shutdown
logic.
* [jit] Remove unused mono_arch_instrument_mem_needs () function.
* [jit] Remove unused mono_arch_instrument_epilog_full () function, only the non-full version is used.
* [jit] Remove some unused arch specific functions previously used by the global regalloc prototype.
This is a follow on to mono/roslyn-binaries#3 which adds the Roslyn VB.NET compiler to the roslyn-binaries repo. This will then install the binaries to the mono installation.
This change re-implement GC roots reporting in a way that allows users to correctly track the source of a GC root.
The new design is based on emitting GC root information upfront and only report addresses during heap dumps.
When a GC root is registered we emit an event that is an address range, the root kind, a key and a text description.
A decoder can use this information to match a reported root address with all registration addresses to figure out what they mean.
A GC Root key is used to further its meaning. For example, if kind is thread, key is a tid, if kind is static variables, key is the vtable pointer and so on.
The build of the change is introducing this key argument across all root registration code and rework our root reporting code to encode their addresses.
Some roots use pseudo-addresses when they are not registrable. This is the case of thread stacks/registers and the finalizer queue.
Finally, root reporting was changed to happen only once per collection and at the end, leading to correct and useful data being produced.
* Compile on amd64 Haiku
Use sigcontext (somewhat like win32, or x86) on Haiku amd64.
On amd64, Haiku doesn't have issues with marshalling 64-bit values,
but it currently does have issues with SGen either causing a stall
or a core dump. As such, while it can compile the stdlib (further
than x86 got), it's still a work in progress.
* Use set_real_time_clock for sys-time.c on Haiku
* Get mono-boehm compiling on Haiku again
It still doesn't work. Initialization will call GC_mark_from, which
will cause a segmentation fault as it decrements pointers. (Mono
will enter an infinite loop in mono_get_hazardous_pointer as a result.)
For now, mono-sgen will continue to be used by default.
make update-solution-files works but actually throws an ArgumentOutOfRangeException and as a result - corrupted csproj (fails on System.Runtime.CompilerServices.Unsafe -
System.Runtime.CompilerServices.Unsafe.dll.sources is empty)
* [linker-analyzer] added --flat option
This options allows to see all dependencies per vertex at once, with
displayed distance in the graph between the vertex and dependent
vertex.
An example of flat output:
Loading dependency tree from: linker-dependencies.xml.gz
--- Type dependencies: 'Android.App.Activity' --------------------------
Distance | TypeDef:Android.App.Activity [total deps: 7]
------------------------------------------------------------------------
1 | TypeDef:XA.App.MainActivity
2 | Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
3 | Other:Mono.Linker.Steps.ResolveFromAssemblyStep
3 | Other:Mono.Tuner.CustomizeActions
3 | Other:MonoDroid.Tuner.MonoDroidMarkStep
2 | TypeDef:XA.App.MainActivity/<>c__DisplayClass1_0
* [linker-analyzer] Get back to using "unnamed" tuples
Use unnamed tuples to workaround mcs bug. We can revert this change,
once mcs is updated.
The build with mcs was failing like this, because of mcs bug:
```
MacBook:linker-analyzer rodo$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-local
MCS [net_4_x-darwin] linkeranalyzer.exe
Unhandled Exception:
System.NotImplementedException: named tuples for .interfaceimpl
at Mono.CSharp.TypeDefinition.Emit () [0x00028] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeDefinition.Emit () [0x002e8] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.Class.Emit () [0x00000] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.Driver.Compile () [0x002f3] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <e953cb7042ea446195951c3e14c2cc5a>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NotImplementedException: named tuples for .interfaceimpl
at Mono.CSharp.TypeDefinition.Emit () [0x00028] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeDefinition.Emit () [0x002e8] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.ClassOrStruct.Emit () [0x00025] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.Class.Emit () [0x00000] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeDefinition.EmitContainer () [0x0000f] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00007] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.TypeContainer.EmitContainer () [0x0001e] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.ModuleContainer.EmitContainer () [0x0009c] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.AssemblyDefinition.Emit () [0x00098] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00126] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.Driver.Compile () [0x002f3] in <e953cb7042ea446195951c3e14c2cc5a>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00052] in <e953cb7042ea446195951c3e14c2cc5a>:0
make[1]: *** [../../class/lib/net_4_x-darwin/linkeranalyzer.exe] Error 1
make: *** [do-all] Error 2
```
Jemalloc is known to have much better performance than system memory
allocators, and is safe in concurrent/re-entrant situations.
To use, provide the following options to configure:
--with-jemalloc to enable optionally. To use at runtime,
export MONO_USE_JEMALLOC to the environment.
--with-jemalloc-always to enable and make the default
--with-jemalloc-assert to enable with assertions to catch memory
unsafety. It adds overhead, but an overhead that's much less than
valgrind or asan.
If you export
MONO_JEMALLOC_CONF="stats_print:true"
You will see detailed memory statistics for mono at exit.
Now note that jemalloc is used through an explicit registration, so
C libraries called through pinvoke calls will not use jemalloc unless
they configure themselves to do so separately.
To understand the build work, I'm statically linking jemalloc.a into
the compilation unit for mono/utils/mono-jemalloc.c, which is
responsible for registering it with mono at startup. No further
copying out of the submodule is necessary at installation time.
When using "fat" session (~2MB) and multiple (~20) simultaneous calls
the retrieval sometimes fails and lock the session.
The original code blocks on the calling thread (AutoResetEvent.WaitOne())
and uses another thread with the timer to do the polling.
If the polling succeeds, the TimerCallback AutoResetEvent.Set(),
with no guarantes that it will wake up the thread.
(see Remarks in http://msdn.microsoft.com/en-us/system.threading.eventwaithandle.set%28v=vs.110%29)
In this patch we simply replace all this code with an equivalent
loop + sleep, which give us the same behaviour
(we still block the calling thread with the sleep, but we didn't use another one)
Signed-off-by: Frederic Mestayer <[email protected]>
Signed-off-by: Etienne CHAMPETIER <[email protected]>
2014-12-22 09:20:01 +01:00
738 changed files with 39397 additions and 23397 deletions
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
AC_DEFINE(MONO_JEMALLOC_ENABLED, 1, [Enable jemalloc usage for mono])
AC_SUBST(MONO_JEMALLOC_ENABLED, 1)
AC_SUBST(JEMALLOC_CFLAGS)
AC_SUBST(JEMALLOC_CPPFLAGS)
AC_SUBST(JEMALLOC_LDFLAGS)
AC_SUBST(JEMALLOC_AUTOCONF_FLAGS)
fi
# Terminology:
# Crash privacy - Attempts to not send identifying information in the crash dump / to protect the obscurity of the program control flow
# MERP - The MS telemetry profile. Not for general use.
# Structured crashes - crashes at runtime that trigger a stack walk by mono that happens cooperatively
# Structured crashes are not merp crashes. Structured crashes are json dumps made by mono during crashes. Merp upload is going to use the dumping code is a very specific way, and is enabled at runtime with an icall.
#--with-crash_privacy=yes --with-structured_crashes=no means we don't wanna dump in non-merp-enabled builds, and we want to not send symbol strings. This is going to be the default pair of settings for VS4Mac.
#--with-crash_privacy=yes --with-structured_crashes=yes means you want to see crashes on your console, and you want to not see unmanaged symbol names. This is an option for proprietary apps that have manual bugs filed.
#--with-crash_privacy=no --with-structured_crashes=no means you want to see no crash dumps on failure and you don't care about privacy. This is how you'd set a "don't want it, don't care" configuration.
#--with-crash_privacy=no --with-structured_crashes=yes means you want full crashes and you want to see them in the terminal, not on telemetry. This is going to be how we build for CI.
AC_ARG_WITH(crash-privacy, [ --with-crash_privacy=yes,no If you want your crashes to not include names of symbols present in the binary. ], [], [with_crash_privacy=no])
AC_ARG_WITH(structured-crashes, [ --with-structured_crashes=yes,no If you want your unmanaged crashes to result in a small crash dump file. ], [], [with_structured_crashes=yes])
if test "x$with_crash_privacy" = "xno"; then
AC_DEFINE(MONO_PRIVATE_CRASHES,1,[Do not include names of unmanaged functions in the crash dump])
fi
if test "x$with_structured_crashes" = "xno"; then
AC_DEFINE(DISABLE_STRUCTURED_CRASH,1,[Do not create structured crash files during unmanaged crashes])
fi
#
# Set the build profiles and options before things which use them
#
@@ -933,6 +1023,52 @@ AC_ARG_WITH(wasm, [ --with-wasm=yes,no If you w
AC_ARG_WITH(runtime_preset, [ --with-runtime_preset=net_4_x,all,aot,hybridaot,fullaot,bitcode,unreal Which default profile to build (defaults to net_4_x)], [], [with_runtime_preset=net_4_x])
AC_ARG_WITH(spectre-mitigation, [ --with-spectre-mitigation=yes,no If you want to build the runtime with compiler flags that enable Spectre mitigation (defaults to no)], [], [with_spectre_mitigation=default])
AC_ARG_WITH(spectre-indirect-branch-choice, [ --with-spectre-indirect-branch-choice=keep,thunk,inline,extern Convert indirect branches to the specified kind of thunk (defaults to inline)], [], [with_spectre_indirect_branch_choice=inline])
AC_ARG_WITH(spectre-function-return-choice, [ --with-spectre-function-return-choice=keep,thunk,inline,extern Convert function return instructions to the specified kind of thunk (defaults to inline)], [], [with_spectre_function_return_choice=inline])
dnl
dnl Spectre compiler mitigation flag checks
dnl
if test "x$with_spectre_mitigation" = "xyes"; then
AC_MSG_NOTICE([Compiler Spectre mitigation support checks])
publicconststringArg_KeyNotFoundWithKey="The given key '{0}' was not present in the dictionary.";
publicconststringArrayInitializedStateNotEqual="Object is not an array with the same initialization state as the array to compare it to.";
publicconststringArrayLengthsNotEqual="Object is not an array with the same number of elements as the array to compare it to.";
publicconststringCannotFindOldValue="Cannot find the old value";
publicconststringCapacityMustBeGreaterThanOrEqualToCount="Capacity was less than the current Count of elements.";
publicconststringCapacityMustEqualCountOnMove="MoveToImmutable can only be performed when Count equals Capacity.";
publicconststringCollectionModifiedDuringEnumeration="Collection was modified; enumeration operation may not execute.";
publicconststringDuplicateKey="An element with the same key but a different value already exists. Key: {0}";
publicconststringInvalidEmptyOperation="This operation does not apply to an empty instance.";
publicconststringInvalidOperationOnDefaultArray="This operation cannot be performed on a default instance of ImmutableArray<T>. Consider initializing the array, or checking the ImmutableArray<T>.IsDefault property.";
Loaded 100 of 738 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.