Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mono to the repository #1912

Closed
wants to merge 10,000 commits into from
Closed

Add Mono to the repository #1912

wants to merge 10,000 commits into from

Conversation

akoeplinger
Copy link
Member

This adds the Mono runtime sources including the full history and some initial build system integration 🎉

We're planning to wire up the CI on Monday and then we'll enable Mono by default as part of the build.

/cc @dotnet/runtime-infrastructure @jkotas @danmosemsft @jaredpar

lateralusX and others added 30 commits November 5, 2019 01:57
…o#17518)

* Fix correct accumulated time for parallelized jobs in SGEN.

Current implementation incorrectly accumulate time for scan jobs for
the follow metrics when running parallel minor GC:

time_minor_scan_major_blocks,
time_minor_scan_los,
time_major_scan_mod_union_blocks,
time_major_scan_mod_union_los

Commit fix so updates are atomic making sure values are correct in cases
where parallel minor GC is used.

* Implement 64-bit atommic add fallback in SGEN.


Commit migrated from mono/mono@44e6226
* [mini] Fix Coverity CID 1455161 & 1455162

> Null-checking "ji" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

* do not rely on assert to guard ji-nullness.  refactor a bit


Commit migrated from mono/mono@93b97d5
Handles reduction -- 4 MERP functions.




Commit migrated from mono/mono@1e8e357
…no/mono#17691)

Reduce the scope of git submodule update --init to only LLVM and/or BTLS
repositories when building external MSVC dependencies.

Commit migrated from mono/mono@1a6c092
…#17730)

Running Start-Process, Wait-Process on msbuild.exe have showed a couple
of hangs in the build script. This is most likely due to msbuild.exe
spawned child processes (like compile servers) running longer than
spawned msbuild.exe process. Since there is no specific requirements
when spawning the process from build.ps1, switch to regular process
exec and LastExitCode.

Commit migrated from mono/mono@bda239f
…#17681)

Remove handles from ves_icall_System_Array_InternalCreate.

Also combine two allocas.


Commit migrated from mono/mono@7b4b5e7
* Fix assert when calling externally call mono_runtime_object_init, mono_object_get_domain, mono_string_to_utf8
* Adding samples/embed as unit-test

Commit migrated from mono/mono@4bdacea
…#17740)

* [profiler] Add test case for pinvokes and reverse pinvokes

* [profiler] Fix crash in native to managed wrappers

When we call back to managed from a pinvoke, we're in GC Safe mode and the
profiler instrumentation is inserted in the wrapper before it does the
transition to GC Unsafe.  So we need an extra transition before the profiler
calls its locking functions

Fixes mono/mono#17687

* [coop] Mark internal GC Unsafe functions with MONO_PROFILER_API

Allow the profiler to transition to GC Unsafe mode

* [profiler] ptestrunner.pl fix profiler modules directory

we used to specify mono/mini/.libs but that's not where the profiler plugins live, they're in mono/profiler/.libs.   We probably picked up the profiler plugins from the system Mono install.

Commit migrated from mono/mono@2c56ac5
* [reflection] Pass assembly load context through mono_reflection_get_type_with_rootimage

The entry points are mono_reflection_type_from_name_checked and
mono_reflection_get_type_checked which for now pass in an ambient ALC, but
should be updated to take an ALC argument.

Internally mono_reflection_get_type_with_rootimage is recursive through a half
dozen helper functions which all get an ALC argument too.

The principle place where the ALC is used is in
_mono_reflection_get_type_from_info which passes it to
mono_assembly_loaded_internal and to replace the call to mono_assembly_load by
a direct call to mono_assembly_request_byname with an explicit ALC set in the
request.

* Mark mono_assembly_load as external only

* Pass an alc through non-static reflection functions

* Fix usage in wasm debugger

* Relax assertions due to wasm


Commit migrated from mono/mono@2c22d0d
[LLVM] Change llvm submodule to dotnet-org fork of official LLVM git repo

Commit migrated from mono/mono@3948a06
The extraneous call basically guarantees that the call right after will fail. Fixes merp stating that its process has failed when it hasn't.

Commit migrated from mono/mono@23f2baa
This is implemented in a lazy way for convenience when manually testing until the tests are wired up to xunit

Commit migrated from mono/mono@68d1429
Implement the GC.GetGCMemoryInfo API.

Commit migrated from mono/mono@5b0a822
* [wasm] Bump emscipten to 1.39.2.

* Disable some code in libtest.c which causes emscripten to fail.

* [wasm] Source emscripten env before make install as well.


Commit migrated from mono/mono@73b5089
…no/mono#17757)

It tried to use dynamic codegen which is not available in FullAOT.
We can use the `RuntimeFeature.IsDynamicCodeSupported` to check for this, added a JIT intrinsic which returns false in FullAOT.

Used a linker friendly way to check for TypeBuilder by adding an `internal virtual IsTypeBuilder` method in the `Type` class which returns false, and overwrote it in `TypeBuilder`.

Commit migrated from mono/mono@ed2d5f6
Commit migrated from mono/mono@d90030d
…ono#17719)

* [netcore] Complete Monitor.LockContentionCount implementation

Fixes mono/mono#16538



Commit migrated from mono/mono@722c6f7
Many of the tests from the llvm-project monorepo cause problems to `make dist`

Commit migrated from mono/mono@c256fc8
This has the following benefits:

* Clearer structure for mirroring
* Slight build time improvement on bundled zlib use (as it only builds once)
* Removes pages of subdir-objects spew from autogen

Commit migrated from mono/mono@8bceb40
* Rewrite the rest of the array non-generic fast paths in C# (mono/mono#27703)

* Rewrite the rest of the array non-generic fast paths in C#

* Add missing resource string

* Use CorElementType and handle native ints to match the unmanaged implementation

* Avoid try pattern for Sort and Reverse

* Match the native implementation more closely

Signed-off-by: dotnet-bot <[email protected]>

* Rewrite Enum.CompareTo in C# (dotnet/coreclrmono/mono#27792)

* Rewrite Enum.CompareTo in C#

* Handle floating point too for match the existing native implementation

Signed-off-by: dotnet-bot <[email protected]>

* Remove unused argument from GetRegionDisplayName (dotnet/coreclrmono/mono#27806)

* Remove unused argument from GetRegionDisplayName

* Address race conditions in CultureData

While most of the race conditions in this file are benign, in these cases, a thread could end up returning an intermediate value due to multiple potential writes to the same field.

Signed-off-by: dotnet-bot <[email protected]>

* Fix StyleCop rule SA1129 ("Do not use default value type constructor") (mono/mono#27716)

Will enable the rule in corefx once these changes have propagated.

Signed-off-by: dotnet-bot <[email protected]>

* Remove non-shared Enum.CompareTo/InternalCompareTo implementation, add new Array icalls used by shared code


Commit migrated from mono/mono@bd278dd
…/mono#17773)

* [wasm] Change netcore support to use a prebuilt corefx runtime.

* [wasm] Build and test netcore support on CI.

* [wasm] Disable netcore tests on CI for now.

* [wasm] Add an error check.

* [wasm] Add a linker exclusion.

* [wasm] Add netcore runtimes to the nupkg.


Commit migrated from mono/mono@eaf895f
jaykrell and others added 17 commits January 14, 2020 22:17
mono/mono#18457)

* [loader] ReflectionOnlyLoad(byte[]) should not apply binding redirects

Match .NET Framework behavior.

Addresses mono/mono#18388

* [tests] ReflectionOnlyLoad(byte[]) should not apply binding redirects

Regression test for mono/mono#18388


Commit migrated from mono/mono@e7e81a4
…no/mono#18454)

[arm] account for signed bit when calculating offset to PLT entry

See `bl` documentation (make sure you look at the thumb2 one):
<img width="1003" alt="Screenshot 2020-01-14 at 22 43 33" src="https://user-images.githubusercontent.com/75403/72385601-2bb53b00-3720-11ea-9858-d73bc2d02a7e.png">


Fixes mono/mono#18247


Commit migrated from mono/mono@bdde94b
…hread (mono/mono#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


Commit migrated from mono/mono@c1498b8
* [aot] fix warnings on linux (gcc 8.3.0)

Fixes these warnings:
```
aot-compiler.c: In function ‘emit_trampolines’:
aot-compiler.c:7675:28: warning: ‘_e’ directive writing 2 bytes into a region of size between 1 and 256 [-Wformat-overflow=]
    sprintf (end_symbol, "%s_e", symbol);
                            ^~
aot-compiler.c:7675:4: note: ‘sprintf’ output between 3 and 258 bytes into a destination of size 256
    sprintf (end_symbol, "%s_e", symbol);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At top level:
aot-compiler.c:753:1: warning: ‘link_shared_library’ defined but not used [-Wunused-function]
 link_shared_library (MonoAotCompile *acfg)
 ^~~~~~~~~~~~~~~~~~~
aot-compiler.c:558:1: warning: ‘mangle_symbol_alloc’ defined but not used [-Wunused-function]
 mangle_symbol_alloc (const char * symbol)
 ^~~~~~~~~~~~~~~~~~~
aot-compiler.c:535:1: warning: ‘mangle_symbol’ defined but not used [-Wunused-function]
 mangle_symbol (const char * symbol, char * mangled_symbol, gsize length)
 ^~~~~~~~~~~~~~~~~~~
```

* [amd64] fix warnings on linux (gcc 8.3.0)

Fixes this warning:
```
tramp-amd64.c: In function ‘mono_arch_create_generic_trampoline’:
tramp-amd64.c:242:65: warning: variable ‘ex_offset’ set but not used [-Wunused-but-set-variable]
  int i, lmf_offset, offset, res_offset, arg_offset, rax_offset, ex_offset, tramp_offset, ctx_offset, saved_regs_offset;
                                                                 ^~~~~~~~~
```

* [lldb] fix warnings on linux (gcc 8.3.0)

Fixes these warnings:
```
lldb.c:243:1: warning: ‘buffer_add_buffer’ defined but not used [-Wunused-function]
 buffer_add_buffer (Buffer *buf, Buffer *data)
 ^~~~~~~~~~~~~~~~~
lldb.c:215:1: warning: ‘buffer_add_id’ defined but not used [-Wunused-function]
 buffer_add_id (Buffer *buf, int id)
 ^~~~~~~~~~~~~
lldb.c:208:1: warning: ‘buffer_add_long’ defined but not used [-Wunused-function]
 buffer_add_long (Buffer *buf, guint64 l)
 ^~~~~~~~~~~~~~~
lldb.c:188:1: warning: ‘buffer_add_short’ defined but not used [-Wunused-function]
 buffer_add_short (Buffer *buf, guint32 val)
 ^~~~~~~~~~~~~~~~

```

* [interp] fix warnings on linux (gcc 8.3.0)

Fixes these warnings:
```
interp/interp.c:3425:1: warning: ‘g_error_xsx’ defined but not used [-Wunused-function]
 g_error_xsx (const char *format, int x1, const char *s, int x2)
 ^~~~~~~~~~~
  CC       interp/libmono_ee_interp_la-mintops.lo
  CC       interp/libmono_ee_interp_la-transform.lo
  CCLD     libmono-ee-interp.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       libmono_dbg_la-debugger-agent.lo
  CC       libmono_dbg_la-debugger-state-machine.lo
  CC       libmono_dbg_la-debugger-engine.lo
  CCLD     libmono-dbg.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     mono-sgen
  AR       libmain.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       interp/libmaintest_a-whitebox.o
In file included from interp/whitebox.c:3:
interp/transform.h:163:12: warning: ‘stack_type’ defined but not used [-Wunused-variable]
 static int stack_type [] = {
            ^~~~~~~~~~
interp/transform.h:155:20: warning: ‘stack_type_string’ defined but not used [-Wunused-variable]
 static const char *stack_type_string [] = { "I4", "I8", "R4", "R8", "O ", "VT", "MP", "F " };
                    ^~~~~~~~~~~~~~~~~

```

* [thread state] fix warnings on linux (gcc 8.3.0)

Fixes these warnings:
```
  CC       libmonoutils_la-mono-threads-state-machine.lo
mono-threads-state-machine.c:33:1: warning: ‘get_thread_no_safepoints’ defined but not used [-Wunused-function]
 get_thread_no_safepoints (int thread_state)
 ^~~~~~~~~~~~~~~~~~~~~~~~
mono-threads-state-machine.c:26:1: warning: ‘get_thread_suspend_count’ defined but not used [-Wunused-function]
 get_thread_suspend_count (int thread_state)
 ^~~~~~~~~~~~~~~~~~~~~~~~
```

* [domain] fix warnings on linux (gcc 8.3.0)

Fixes these warnings:
```
appdomain.c:2415:1: warning: ‘get_app_context_base_directory’ defined but not used [-Wunused-function]
 get_app_context_base_directory (MonoError *error)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       libmonoruntimesgen_la-assembly-load-context.lo
  CC       libmonoruntimesgen_la-domain.lo
domain.c:135:1: warning: ‘mono_domain_alcs_lock’ declared ‘static’ but never defined [-Wunused-function]
 mono_domain_alcs_lock (MonoDomain *domain);
 ^~~~~~~~~~~~~~~~~~~~~
domain.c:138:1: warning: ‘mono_domain_alcs_unlock’ declared ‘static’ but never defined [-Wunused-function]
 mono_domain_alcs_unlock (MonoDomain *domain);
 ^~~~~~~~~~~~~~~~~~~~~~~
domain.c:2129:1: warning: ‘mono_alc_free’ defined but not used [-Wunused-function]
 mono_alc_free (MonoAssemblyLoadContext *alc)
 ^~~~~~~~~~~~~
domain.c:2108:1: warning: ‘mono_domain_create_default_alc’ defined but not used [-Wunused-function]
 mono_domain_create_default_alc (MonoDomain *domain)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
domain.c:2084:1: warning: ‘create_alc’ defined but not used [-Wunused-function]
 create_alc (MonoDomain *domain, gboolean is_default)
 ^~~~~~~~~~

```

* [native library] fix warnings on linux (gcc 8.3.0)

Fixes this warning:
```
  CC       libmonoruntimesgen_la-native-library.lo
native-library.c:295:1: warning: ‘mono_loader_register_module_locking’ defined but not used [-Wunused-function]
 mono_loader_register_module_locking (const char *name, MonoDl *module)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

* [sample] fix warnings on linux (gcc 8.3.0)

Fixes this warning:
```
  CC       libtestlib_la-test-mono-embed.lo
In file included from test-mono-embed.c:7:
../../samples/embed/teste.c:20:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 gimme () {
 ^~~~~

```

* fix for checked builds


Commit migrated from mono/mono@b4c506c
Follow-up for mono/mono#18480

We might want to replace calls to this with an intrinsic

Commit migrated from mono/mono@1f0e147
[prof] remove wrong cast for format string

Fixes this warning:
```
  CC       mprof-report.o
mprof-report.c:408:62: warning: format specifies type 'char *' but the argument has type 'guint64' (aka 'unsigned long long') [-Wformat]
                        snprintf (format, sizeof (format), "%s : %%" PRIu64 "\n", (guint64)key_format);
                                                            ~~                    ^~~~~~~~~~~~~~~~~~~
                                                            %llu
/Applications/Xcode112.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro
      'snprintf'
  __builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
                                                             ^~~~~~~~~~~
```

mistake in refactoring commit https://github.com/mono/mono/commit/mono/mono@07402062541fa9555bef99dbaac84cfb587926cd#diff-c825627ea9ddb3fa753fa3617eaec7c8R408





Commit migrated from mono/mono@73eeda1
Compilation warnings fixes





Commit migrated from mono/mono@0a96741
Also add packaging project for Microsoft.NETCore.Runtime.Mono.
@steveisok steveisok mentioned this pull request Jan 18, 2020
24 tasks
@directhex
Copy link
Contributor

For the love of $DEITY, remember to merge, not squash!

@KennyDizi
Copy link

This’s great step!

@jkotas jkotas self-requested a review January 19, 2020 19:12
@akoeplinger
Copy link
Member Author

akoeplinger commented Jan 19, 2020

I pressed the merge button and 1cb1285 was committed to master 👍

Looks like this PR was a little too heavy for GitHub to automatically close so I'm manually closing it :)

ManickaP pushed a commit to ManickaP/runtime that referenced this pull request Jan 20, 2020
This adds the Mono runtime sources including the full history and some initial build system integration.
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.