[WIP] [WASM] Ongoing AOT work. (#11728)
commitc7a71ca4bd4a744b98dc7c1eb7e1d86360817edb
authorZoltan Varga <vargaz@gmail.com>
Tue, 20 Nov 2018 07:21:21 +0000 (20 02:21 -0500)
committerGitHub <noreply@github.com>
Tue, 20 Nov 2018 07:21:21 +0000 (20 02:21 -0500)
treeb8043912df0f931a35d4aa1fab8787d06d24fad9
parent90a3ca90a29f531eefde1d9a2a77eb08bfe9355a
[WIP] [WASM] Ongoing AOT work. (#11728)

* [wasm] Add the declaring types assembly name to the mangled name for instances during dedup. Fixes failures when two assemblies have a generic type with the same name.

* [runtime] Rename MONO_WRAPPER_UNKNOWN to MONO_WRAPPER_OTHER.

* [aot] Make the aot name mangling a little denser.

* [wasm] Don't emulate lojg shifts/multiplications.

* [runtime] Fix warnings.

* [aot] Small cleanups to the dedup code:

* Fix the dedup logging in llvmonly mode.
* Split mono_compile_assembly () into 2 functions, the second one doing the emission.
* Split the setting of cfg->skip from emit_code ().
* Skip more code and some logging for the other assemblies in the dedup-include case.

* [jit] Do the conversion to JIT intrinsics somewhat earlier.

This is needed to avoid emitting the code for passing the mrgctx etc. for
generic intrinsics like RuntimeHelpers.IsReferenceOrContainsReferences ().

* [aot] Implement sharing of gsharedvt wrappers passing/receiving
valuetype arguments based on their layout.

This is done by replacing valuetypes with instances of the
newly added Mono.ValueTuple generic structures inside the
wrappers. For example, for the type:
struct FooStruct {
  int i; object o;
}
and the gsharedvt out wrapper:
gsharedvt_out (ref FooStruct v);

This will be replaced by:
gsharedvt_out (ref ValueTuple<int, object> v);

The two structures have the same layout so as far as the JIT is
concerned, they are identical.

* [aot] Share native int/native uint with int32/uint32 in gsharedvt wrappers on 32 bit platforms.

* [bcl] Make the Mono.ValueType structs internal.
15 files changed:
mcs/class/corlib/LinkerDescriptor/mscorlib.xml
mcs/class/corlib/Mono/RuntimeStructs.cs
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/wrapper-types.h
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/method-to-ir.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-llvm.c
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini-wasm.h
mono/mini/mini.c
mono/mini/unwind.c