[Mono-devel-list] New Mono compilation engine available.
Miguel de Icaza
miguel at ximian.com
Sat Apr 5 14:49:13 EST 2003
The new compilation framework for Mono has been checked into CVS.
Like the rest of the runtime engine, it is released under the terms of
the GNU LGPL. It lives inside the `mono' module, in `mono/mini'.
Currently it has not been integrated into the build system, to use it,
you need to compile mono first, and then go into mono/mini and run
The resulting binary `mini', is the new code generator. It can be
used in two modes: just-in-time compiler or ahead-of-time compiler.
In JIT mode, you have to run it like this:
To run in ahead-of-time compilation mode, do this:
mini --aot program.exe
That will generate a precompiled assembly with the suffix `.so'.
This can be used to reduce JIT startup time (not that I have ever
noticed this time in real world use, but anyways, the functionality is
part of Mono now).
The new engine had a number of goals:
* Simplify porting the JIT engine.
* Provide a solid framework for implementing advanced
optimizations in the JIT engine.
* Support ahead-of-time compilation (precompilation).
We are very happy with the new framework, because it is very
modular, and it allows us to cleanly replace in the future components
of it, if we choose to, or revamp components of it. Today the new
infrastructure has helped us implement an inliner that does not have
the limitations of the old mono's inliner.
The following optimizations are implemented:
Dead code elimination
Emit per-domain code
Fast x86 FP compares
Inline method calls
Intrinsic method implementations
Linear scan global reg allocation
Loop related optimizations
Tail recursion and tail calls
Various of those implementations use the SSA representation, which
in turn allows us to implement the more advanced optimizations that
people are doing with SSA.
An early draft of the internals of the new compilation engine is
in mono/mini/mini-doc.txt, if you are interested in understanding
the new engine, this document is a good starting point.
The job of doing a good JIT requires a tradeoff between
compilation speed, and code generation quality. Some are
computing-time expensive and some are cheap. In JIT mode, we only
turn on a few optimizations, but you might want to turn them all on
when doing pre-compilations (-O=all, see mini --help for details).
After a period of testing, we will rename `mini' to mono, and it
will officially become the new JIT engine.
Mini is closer to the spec than Mono was, as the JIT team has been
mostly working on this for a while, so plenty of checks and tests that
were not implemented before, are implemented now.
More information about the Mono-devel-list