[Mono-list] Announce: A .NET assembly -> native code generation tool (ala ngen for MONO)

Fergus Henderson fjh@cs.mu.oz.au
Thu, 1 Aug 2002 12:39:59 +1000

On 29-Jul-2002, Dietmar Maurer <dietmar@ximian.com> wrote:
> On Sun, 2002-07-28 at 06:03, Miguel de Icaza wrote:
> > Zoltan wrote:
> > 
> > >    The first version of my ngen clone for MONO is available at:
> > > 
> > > http://www.nexus.hu/vargaz2


> > This announcement is of course really exciting.  I have only taken a
> > very superficial look so far at the code generator, but the approach is
> > a very interesting idea.  I will let Dietmar and Paolo comment further
> > on it.

I think this approach is a really good approach.

> > What I wanted to look into was to use the JIT to generate code that
> > would end up in a library, basically reusing the JIT, but turning on all
> > the optimizations for this.
> This approach would also avoid much code duplication.

This approach is what MS did.  This approach sucks.
You just won't get good performance that way.

An ahead-of-time compiler can afford to spend a lot more time compiling,
and as a result it can use much more sophisticated optimizations than
a JIT compiler can.

There's no point trying to duplicate all of GCC's optimizations in your
JIT compiler; doing that would be a huge amount of code duplication.
It's much better to reuse GCC's optimizer, as Zoltan has done.

Note also that GCC's optimizer has already been ported to a lot more
architectures than the mono JIT has been.  For architectures where
the choice is to use an interpreter or an ahead-of-time compiler,
the ahead-of-time compiler should give a very significant speedup.

Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.