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

Zoltan.2.Varga@nokia.com Zoltan.2.Varga@nokia.com
Mon, 29 Jul 2002 10:06:40 +0200

					Hi All,

> -----Original Message-----
> From: ext Miguel de Icaza [mailto:miguel@ximian.com]
> Sent: 28. July 2002 6:04
> To: Varga Zoltan.2 (NMP/Budapest)
> Cc: mono-list@ximian.com
> Subject: Re: [Mono-list] Announce: A .NET assembly -> native
> codegeneration tool (ala ngen for MONO)
> Hello Zoltan,
> >    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.
> 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.

   I originally wanted to write a GCC front end for CIL, but after looking at the gcc front end code, I decided against it :)
  The advantage of this approach against saving the JIT generated code is increased performance. The greatest disadvantage
is the long compilation time: It takes almost 3 minutes to compile corlib.dll to native code. 

> btw, why are exception methods not supported? 

It is very hard (impossible?) to implement try-catch-finally in C. The generated code would need to contain the address
ranges of the exception handler, which is hard to obtain, since labels are local to C functions. Also, the optimizer would
need to be notified that the runtime could jump into a middle of a C function anytime.  Instead of this mess, I'm thinking about targeting C++ instead of C, and use the exception handling tables generated by g++.

> You forgot to include a couple of files, which are links in your
> package.

Thanks for noticing this. I uploaded a new snapshot which hopefully contains the missing files.

> Miguel