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

Fergus Henderson fjh@cs.mu.oz.au
Thu, 1 Aug 2002 23:54:43 +1000


On 01-Aug-2002, Zoltan.2.Varga@nokia.com <Zoltan.2.Varga@nokia.com> wrote:
> 
> From: Dietmar Maurer 
> > Sure, but I also has some advantages. For example it works with
> > exceptions and garbage collection. I have no idea how we can 
> > include GC support with the gcc approach.
> 
> A conservative garbage collector, like the Boehm collector can work with gcc code if the code is "GC-safe", i.e. it always
> keeps pointers to the beginning or interior of all live objects. An example of non-gc safe code is:
>      a[i - 5] = 0;

That code is GC-safe.  The problem is just that an optimizing
compiler might transform it to something which is not GC-safe.

> When confronted with such code an optimizing compiler might decide to transform it to something like (a-5)[i], which means
> there are no pointers left pointing to a, so it will be garbage collected.

Right.  But in practice this does not seem to be a significant problem.
Hardware failure seems to be a more common source of errors.

If you can produce a test case for which GCC generates
non-GC-safe object code, I will produce a patch for GCC which
adds a compiler option to generate GC-safe code, and handles
that test case correctly.

-- 
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.