Age | Commit message (Collapse) | Author |
|
Add capability to interrogate cgroup limitations when determining CP and memory limits
This code has been adapted from coreCLR. It has been modified from C++ but uses the same naming conventions in the event of a unified mechanism that can be shared between both runtimes being developed. The code has been tested on Ubuntu 20.04 and CentOS 7 with cgroupv1 and cgroupv2.
This code is required in the event of running mono in a container as the current limitations being discovered by mono are purely for the machine and not in a container which may have lower quotas.
* mono/utils/Makefile.am
- Add new file to build
* mono/utils/memfuncs.c
- Call `getRestrictedPhysicalMemoryLimit()` or `getPhyscalMemoryAvail()`
* mono/utils/memfuncs.h
- Add prototypes for the new APIs
* mono/utils/mono-cgroup.c
- Code adapted from coreCLR to interrogate sysfs to determine any limitations on memory or CPU
* mono/utils/mono-proclib.c
- Add call to `getCpuLimit()`
* mono/utils/mono-proclib.h
- Add prototype for the new API
|
|
They are no longer needed here.
|
|
Bump to MSBuild vs16.9, Roslyn 3.9.0 and NuGet 5.9.0
|
|
This PR implements changes that lets us build Xamarin.iOS/Xamarin.Mac SDKs so that it is possible for a Xamarin.Mac project to target x86_64+arm64 (i.e. Apple Silicon). Most of the changes are related to the mac Sdk build, but there are some extra changes as well :
- Fix configure to not automatically target iOS when targeting aarch64
- Necessary to compile a cross-compiler targetting macOS arm64
- Fix aot compiler to target macOS arm64 when running on x64 (missing arch parameters)
- Support offset tool for aarch64
- Necessary to compile macOS arm64 cross-compiler
- Fix pthread_jit_write_protect_np and preadv usage
- Missing define meant the function wasn't found (at least on Xcode 12.2)
- Restrict usage to macOS
- Fix crash on launch on iOS/tvOS arm64 caused by invalidly setting `MAP_JIT` on those platforms even though it's not a valid option.
- Adapt macOS SDK
- Build libraries for x64+arm64 and lipo them together
- Create a aarch64 cross-compiler for macOS, similar to the iOS Sdk
The arm64 support will only work with Xcode 12.2. To support in Xamarin.Mac, it also doesn't work if built from stable branches (because the rest of the arm64 support hasn't made it to the latest stable branch from what I can figure out)
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
|
|
It causes a build warning otherwise which fails the build:
```
cc1plus: warning: command line option '-Wc++-compat' is valid for C/ObjC but not for C++
```
|
|
* [arm64-osx] Remove an apple m1 workaround, newer versions of config.guess from brew work correctly.
* [runtime] Fix a crash in merp on arm64.
|
|
Co-authored-by: lateralusX <lateralusX@users.noreply.github.com>
|
|
Fixes mono/mono wasm build
cc: @vargaz
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
|
|
Apparently `--enable-werror` broke some time back, so fix it.
Contributes to https://github.com/dotnet/runtime/issues/41357
CMake probably needs similar changes. cc: @vargaz
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
|
|
This PR:
* Enables `-Wc++-compat` on all platforms: we support building the runtime as C++, so this helps catch errors before they're found in CI and will help keep the netcore build C++-compatible
* Sets `-Werror` on netcore CI for OSX
It also fixes various warnings currently present in the build.
`-Werror` should probably be extended to cover all CI platforms eventually. Adding a new platform is as simple as adding to the line in mono.proj whitelisting platforms and fixing the warnings.
Not sure if there's a better way to handle the cpuidex function, but if we're using that from mini it should definitely be in a header somewhere.
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
|
|
`$enable_monodroid` and `$enable_monotouch` are set to no by default, not an empty string.
Accidentally enabled globally here: https://github.com/dotnet/runtime/commit/a54d391d9daebf7b53e7f1efc1690c1c35177570#diff-294e5f7514d4059e724506770913e1d7R1386
Fixes https://github.com/dotnet/runtime/issues/40147
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
|
|
We need to set these defines so we don't use obsolete ICU functions and cause warnings, just like we do in the CMakeLists.txt version..
Co-authored-by: akoeplinger <akoeplinger@users.noreply.github.com>
|
|
versions. (#20192)
|
|
* Fix __asm__ specs to work with clang
* 1. No need for USE_STRING_INLINES anymore
2. Code around clang bug where %r0 is being rejected from BASR instruction
* Fix a couple of more __asm__ specifications for clang
|
|
* Fix configure check for arm64+osx.
* Add mono_codeman_enable_write/disable_write functions.
* Use clang --shared for linking aot images.
* Fix eglib remapping.
* Make code memory writable during code generation.
* Enable/disable writable code around dlmalloc operations, dlmalloc allocates from code memory.
* Fix some defines.
* Fix set/clear_breakpoint.
* Fix llvm jit support.
* Fix gsharedvt.
* Force float32 to be enabled on osx/arm64.
* Add codegen macros for arm64e.
* Disable some crash tests if --disable-crash-reporting is used.
* Disable btls. Disable boehm by default.
* Fix a warning.
* Fix vararg calls, the vararg icalls assume every argument is in in own stack slot, but the default osx/arm64 calling code is the same as ios which allows small arguments to share a stack slot.
* Fix formatting.
* Fix the build.
* Use aarch64-darwin-ios as the target triple when cross compiling to ios so configure can distinguish between osx/arm64 and ios.
* Assume ios when cross compiling to aarch64-darwin.
|
|
This disables several debugging features in sgen, helps the compiler remove some unused code related to concurrent collector and disables more assertion messages, but also some other logs. We might have to reenable some of them if this is problematic.
Saves about 60k on wasm
Co-authored-by: BrzVlad <BrzVlad@users.noreply.github.com>
|
|
wasm. (#20095)
Co-authored-by: vargaz <vargaz@users.noreply.github.com>
|
|
Co-authored-by: kg <kg@users.noreply.github.com>
|
|
- coreclr/build-test.sh now has a new subcommand: 'mono_aot', which builds a
new target, named 'MonoAotCompileTests', added to
coreclr/tests/src/runtest.proj. This target compiles the runtime tests using
Mono LLVM AOT in a simple configuration where the host platform is identical to
the target platform. Parallel compilation happens via a hack: actual
compilation happens in mono/msbuild/aot-compile.proj, a single-target msbuild
file, and runtest.proj invokes this single-purpose project and target using
batching to create multiple parallelizable instances of this project. Future
work: use the MonoAOTCompiler custom task currently used to build the iOS
sample program.
- Avoid using the runtimeVariant string when defining
coreClrProductArtifactName in mono/templates/xplat-pipeline-job.yml. There are
no "runtime variants" of CoreCLR configured with this parameter; instead,
depend on a shared non-runtime-variant build of CoreCLR.
- Mark function DISubprograms as local definitions--this is an LLVM 9
compatibility fix.
- Use --tag=CXX when linking libmonosgen-2.0.so via libtool when LLVM is linked
into Mono.
This makes libtool use the C++ compiler driver when linking Mono--which uses
whatever platform-specific flags are necessary to link against the C++ stdlib.
Previously, libtool would use the C compiler driver, which didn't do this and
would produce shared objects with no explicit dependency on libstdc++.
This problem is normally masked because of the very lax dynamic linking
semantics on ELF, but Mono on our CI setup is built in a CentOS 7 image (which
does not contain a C++11 libstdc++) that has a GCC 7 compatibility package
installed, along with a clang 9 installation that detects headers from the GCC
7 compatibility package. This compatibility package includes a libstdc++ linker
script that links C++11 libstdc++ components statically into the target while
dynamically linking against components present in pre-C++11 libstdc++. The end
result of all of this is that Mono built with this configuration will
dynamically depend on C++11 libstdc++ symbols that should have been statically
linked into the library, and will outright fail to run on machines without a
newer version of libstdc++ available.
- Add tests that fail after LLVM AOT compilation to issues.targets.
|
|
Fixes https://github.com/dotnet/runtime/issues/33079
Co-authored-by: CoffeeFlux <CoffeeFlux@users.noreply.github.com>
|
|
Co-authored-by: vargaz <vargaz@users.noreply.github.com>
|
|
(#20028)
* - Update exception signature as per other archs
- Make roslyn the default for s390x
* Put the compiler check in the right place
|
|
Also, bumps roslyn to `3.7.0-1.20262.2`
|
|
Summary:
* wire `$(Compiler)` in `mono.proj`, that comes from `eng/build.sh`.
* add configurations for illumos cross-compilation.
* set `-Werror=strict-prototypes` for `madvise` and `posix_madvise` introspection, which is used during the compilation.
* implement `mono-threads-sunos.c`.
* add some solaris-specific thread priority levels.
With this set of changes, `dotnet hwapp.dll` works with mono flavored `System.Private.CoreLib.dll` and `libcoreclr.so` on SmartOS 2020.
Contributes to: dotnet/runtime#34944.
Co-authored-by: am11 <am11@users.noreply.github.com>
|
|
- Implementing QCalls on mono
- Use QCalls on ICU Shim implementation
Fixes https://github.com/dotnet/runtime/issues/36449
Co-authored-by: thaystg <thaystg@users.noreply.github.com>
|
|
Fixes https://github.com/mono/mono/issues/19733
Co-authored-by: fanyang-mono <fanyang-mono@users.noreply.github.com>
|
|
(#19914)
Fixes #7167
The PR 3e8108ea6576b07de2a64528be18674683879189 introduced a deadlock on Alpine, making it impossible to even build mono. This PR reverts the setting of PTHREAD_PRIO_INHERIT when on Alpine.
Since GCC on Alpine doesn't provide a builtin macro to detect Alpine, I also added a #define in configure.ac.
|
|
potentially shared between runtimes.
PR handling port of EventPipe C++ library from CoreCLR into a C library that can be shared between Mono as well as CoreCLR runtime.
Due to dependencies and current time line it has been decided to initially target Mono runtime (since it doesn't have event pipe functionality at the moment), but library is still designed to integrate into other runtimes, replacing current C++ library implementation, when time permits.
Until that happens, we will need to make sure changes done in C++ code base gets ported over to C library. The amount of changes going into the native library should however be small and if major changes needs to be done, we should first make sure to move over to use the shared version of event pipe C-library in CoreCLR and then only do changes into shared version of the library.
Port is currently mapping existing C++ code base, no focus on rewrite or change current implementation (unless needed to port code over to C).
Library source files are currently placed into mono/eventpipe folder and build as a separate library, linked into runtime, but will be moved when ready to be shared between runtimes. We might also move all code into a loadable library and p/invokes, depending on size, at least for Mono runtime targeting mobile devices.
There is also a unit test runner under mono/eventpipe/tests using eglib test runner, running through a set of unit tests covering the eventpipe library implementation.
Library is split up over a couple of source files closely mapping corresponding coreclr source files. Most code could be shared between runtimes and artifacts that are runtime specific, like locks/lists/maps/strings/pal layer etc, a shim API is defined in `ep-rt.h` and `ep-rt-types.h` that gets implemented by the targeted runtime consuming the event pipe C library, like `ep-rt-mono.h` and `ep-rt-types-mono.h`. All function in the shim API is small and should be inlinable. For example, locking the configuration lock is declared like this in `ep-rt.h`:
```
bool
ep_rt_config_aquire (void);
```
and in `ep-rt-mono.h` it is implemented like this:
```
static
inline
bool
ep_rt_config_aquire (void)
{
ep_rt_spin_lock_aquire (ep_rt_mono_config_lock_get ());
return true;
}
```
and CoreCLR should implement the function using its corresponding locking primitives. NOTE, since we primarily target Mono in initial port there might smaller adjustments needed to the shim API once bringing it over to CoreCLR, but those changes/adjustments can be done when needed.
Since library could be shared, it tries to standardize on common C99 data types when available. If there are runtime specific types needed, they are declared in `ep-rt-types.h` and implemented by each runtime in corresponding file. Most of library is currently following Mono coding guidelines.
For shared types naming is done like this, `EventPipe[Type]`, like `EventPipeProvider`. This naming follow naming of other types in Mono as well as CoreCLR. There is one exception to this rule, types that are runtime specific implementation, naming is following function naming with a _t prefix, like `ep_rt_session_provider_list_t`, that is a list specific type, implemented by each runtime. This is done to make it easier to see difference of types implemented in the runtime specific shim and types implemented in the shared library API surface.
Since library shim implemented by targeted runtime will be called by C code, it can't throw exceptions, the C library should however compile under C++, meaning that CoreCLR's shim should be able to use C++ constructions as long as it don't throw any exceptions.
Library function naming follows the following pattern, for "public" functions included in `ep-*.h` , ep_ + object + action, so for example, `ep_config_create_provider`, corresponds to `EventPipe::Configuration::CreateProvider` in C++ library. For "private/internal" functions not, ep_ prefix is dropped, but object + action is still preserved, for example `config_create_provider` and function is marked as being static when possible. If a function assumes a lock is held when getting called, it is using _lock_held (similar to SAL annotations) postfix to indicate that function doesn't claim lock and if function needs lock to be held by caller, it will assert that condition on enter (similar to `PRECONDITION(EventPipe::IsLockOwnedByCurrentThread())`).
Library uses asserts internally to validate state and conditions. This is a debug/checked build assert that should be excluded in release builds. It is defined in `EP_ASSERT` and should be redefined by targeted runtime. Private/internal functions asserts incorrect input parameters and state, while "public" functions return back error to caller when detecting incorrect input parameters. Incorrect state can still be assert in all kinds of functions.
Getters/Setters are setup for accessing type members. All functions except a type's own alloc/init/fini/free implemented in `ep-*.c` are not allowed to use direct type member access and should go through available inlinable getter/setter functions. There is also a way to build the library that catches incorrect use of members at compile time (not in `ep-*-internals.c` since it include alloc/init/fini/free implementations, but in other source files).
Types that can be stack allocated offers a init/fini function pairs. Types that should only be heap allocated, alloc/free, and types supporting both stack/heap, implements alloc/init/fini/free. Since C can't prevent incorrect usage patterns, the implementation needs to follow correct life time management patterns. Types allocated using alloc should be freed with corresponding free function. For example, `ep_event_alloc` should be freed by `ep_event_free`, the init/fini methods are then called by the alloc/free implementations. For types supporting stack allocation and allocated on stack or aggregated within other types, init must be called before first use and fini before going out of scope.
Ownership of allocated objects is only considered complete on successful function calls. If a function fails, caller still owns resource and need to take actions.
Library uses UTF8 strings internally, mainly since Mono runtime already uses that and it is more portable. Number of strings in the library is limited, and in cases where stream protocol uses UTF16 strings, a prealloc string is stored on the type, reducing need to do multiple UTF8 -> UTF16 conversions over the lifetime of the type.
NOTE, this is first PR setting up most of the direction of the library and (as part of doing that) ported a great deal of eventpipe code and added ~40 native unittests. It is however not complete, or fully working, so there will be several follow up PR's building on top of this work in order to get complete library. Next component to integrate into the library, once this PR is merged, is BufferManager.
|
|
HAVE_STRUCT_SOCKADDR_IN6 needs to be defined to enable IPv6 features in
mono/metadata/w32socket.c.
Fixes TcpListener issues in wine-mono.
|
|
Linking statically ICU shim on mono for windows, linux, macOs and android.
Co-authored-by: thaystg <thaystg@users.noreply.github.com>
|
|
Co-authored-by: vargaz <vargaz@users.noreply.github.com>
|
|
* Initial perf jitdump implementation
* Incorporate PR feedback
* Incorporate feedback round 2
* Incorporate feedback round 3
* Minor change
* Incorporate feedback round 4
|
|
Resolves #18528 in for both detection and compiling. This should backport cleanly to next release.
Tested on 12.1-RELEASE with libinotify; configure detects features correctly, compiles successfully, resolves some observed issues during run.
```
#define HAVE_SYS_INOTIFY_H 1
#define HAVE_LIBINOTIFY 1
#define HAVE_INOTIFY_INIT 1
#define HAVE_INOTIFY_ADD_WATCH 1
#define HAVE_INOTIFY_RM_WATCH 1
#define HAVE_INOTIFY 1
```
|
|
|
|
|
|
exist any more. (#18868)
* [llvm] Remove loaded llvm support, the startup perf penalty doesn't seem to exist any more.
* Fix the windows build.
* Remove more mini-llvm-loaded.c references.
* Remove more --enable-loadedllvm references.
* Make --enable-loadedllvm the same as --enable-llvm.
* Fix run-jenkins.sh.
* Address review comments.
|
|
It hangs: https://github.com/mono/mono/issues/18827
|
|
for processes and .config files. (#18822)
|
|
Traditionally, Mono is build with native compilers (i.e. "build for this architecture" running in an ARM or ARM64 chroot on an ARM64 server), but to align with CoreCLR, let's go the cross-compile way.
This enables cross-compiler support, by passing a whole bunch of extra info to `./configure`, some of which is set in the common YAML (like the `--sysroot` value)
Co-authored-by: Jo Shields <directhex@apebox.org>
|
|
* [cross] support arm-linux-gnueabihf cross compiling with netcore
Some notes on usage:
```console
$ sudo apt install g{++,cc}-gnu-linux-gnueabihf python3-pip
$ ./autogen.sh --disable-boehm --target=arm-linux-gnueabihf \
--with-cross-offsets=arm-linux-gnueabihf-cross-offsets.h \
--with-core=only \
CFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer" \
CXXFLAGS="-O0 -ggdb3 -fno-omit-frame-pointer"
$ make -C tools/offsets-tool-py/
$ python3 tools/offsets-tool-py/offsets-tool.py \
--targetdir=/home/lewurm/work/mono \
--abi=arm-linux-gnueabihf \
--monodir=/home/lewurm/work/mono \
--outfile=arm-linux-gnueabihf-cross-offsets.h \
--libclang=/usr/lib/x86_64-linux-gnu/libclang-7.so.1 \
--sysroot=/usr/arm-linux-gnueabihf \
--netcore
```
* better include path guessing
|
|
The default handlers for SIGTRAP, SIGSYS on macOS and Linux crash the process, so we now have Mono report this.
This patch also changes how the name of the signal is acquired for passing on to the crash reporting functions, allowing code reuse on crashing signals.
|
|
|
|
I fear this causing packaging problems, but as-is we require Python 3 for most of our Python files but don't actually check for that in configure. We should be consistent about this. Some projects (notably wasm) also use the Python version detected here, so bumping this will also bump the version used in those cases (a good thing, since there are some known bugs when using the scripts with Python 2).
|
|
The original fix back at #18554 did not work quite right, which was missed for lack of CI.
Reworked this check to instead test for `-mminimal-toc` on all powerpc hosts, and to only do the ELF version check on FreeBSD.
Fixes #18554 #18578 current CI build failures on AIX
|
|
Fixes #18554 by making autoconf actually check if `-mminimal-toc` works instead of assuming on powerpc. Tested with FreeBSD 12.x and 13.x on powerpc64 ELFv2.
While we are in here, also enable BTLS which has passed testing.
|
|
* Contributing: fix typos
* fixed encoding and other typos
* fixed encoding and spotted other typos
* Update TransformationRules.cs
|
|
This causes an additional dependency of mono on libintl which we didn't have before.
Reported by a user on gitter, it's problematic on macOS since it makes the mono binary depend on the libintl we ship in the Mono .pkg.
It was introduced in Mono 6.6 by https://github.com/mono/mono/commit/18e0ebfe89be0a175d2f904b9bb1ec6816daa318
|
|
|
|
(#18480)
* [runtime] NOHANDLES for ves_icall_System_Threading_Thread_GetCurrentThread
This function (and its call to mono_handle_new) was showing up in the
flamegraph for some async-heavy benchmarks
|
|
|