[metadata] split IL generation code into seperate compilation units. (#7487)
commit868a402137d8d91d31387fb2df7c72f2174f4d1f
authorBernhard Urban <bernhard.urban@xamarin.com>
Fri, 9 Mar 2018 19:19:04 +0000 (9 20:19 +0100)
committerLudovic Henry <luhenry@microsoft.com>
Fri, 9 Mar 2018 19:19:04 +0000 (9 14:19 -0500)
tree5669428f52cbf87c97acb899c7e238598360515a
parent826f15a509add59182517aad629efc75b7db56a1
[metadata] split IL generation code into seperate compilation units. (#7487)

* [metadata] split IL generation code into seperate compilation units.

* [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

* [fixup!] resolve merge conflicts with class getter commits

* marshal.c: b8da9736209427ef49267923e1321c801c65dfd2
* sgen-mono.c: 8ba4947f7a3b37b3c5e5458834109fad317f91bc

at some point I gave up to resolve merge conflicts and worked through
errors/warnings by compiling with
> `CFLAGS=-DENABLE_CHECKED_BUILD_PRIVATE_TYPES=1`
so the result is likely a bit different

* redo lost changes from 57f3f34e60ee6d17fb1dada4b8799f3d753ca2b0

* redo lost changes from 52514effbf19992edc323ff9d7bf21766bc50b2c

* [fixup!] fix array marshal

* [method-builder] use eglib types

review comment by Ludovic,
https://github.com/mono/mono/pull/7375#discussion_r171876337

* [marshal] remove stelem strings from header

review comment by Rodrigo,
https://github.com/mono/mono/pull/7375#discussion_r171921029
26 files changed:
configure.ac
mono/metadata/Makefile.am
mono/metadata/boehm-gc.c
mono/metadata/cominterop.c
mono/metadata/cominterop.h
mono/metadata/marshal-ilgen.c [new file with mode: 0644]
mono/metadata/marshal-ilgen.h [new file with mode: 0644]
mono/metadata/marshal-internals.h
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/metadata-internals.h
mono/metadata/method-builder-ilgen-internals.h [new file with mode: 0644]
mono/metadata/method-builder-ilgen.c [copied from mono/metadata/method-builder.c with 86% similarity]
mono/metadata/method-builder-ilgen.h [copied from mono/metadata/method-builder.h with 71% similarity]
mono/metadata/method-builder-internals.h [new file with mode: 0644]
mono/metadata/method-builder.c
mono/metadata/method-builder.h
mono/metadata/remoting.c
mono/metadata/sgen-mono-ilgen.c [new file with mode: 0644]
mono/metadata/sgen-mono-ilgen.h [new file with mode: 0644]
mono/metadata/sgen-mono.c
mono/metadata/sgen-mono.h [new file with mode: 0644]
mono/mini/mini-generic-sharing.c
msvc/libmonoruntime-common.targets
msvc/libmonoruntime-common.targets.filters
winconfig.h