This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: a .NET alternative (GJC et al)

On 09-Aug-2001, Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE> wrote:
> Fergus Henderson <> writes:
> [GC, backend cooperation
> > The reason that this technique works is that the back-end compiler
> > can't do any fancy optimizations on locals.p and local.q, since
> > &locals has been stored in a global variable and so any function
> > call might update them.
> But there is a subtle form of backend cooperation lurking here: You
> assume that the backend does not know too much about the functions
> being called.  In fact, if there isn't a collector, the stack frame
> marking does not have any externally visible effect, so it is legal to
> optimize it away completely.
> In order to make things work, you have to throw in a few volatile
> qualifiers here and there, I think, which will deteriorate performance
> further.

No, neither volatile nor back-end cooperation is needed.
If there isn't a collector, the back-end can (if it is very
clever, and uses intermodule optimization) optimize away the
stack frame marking.  Great!  Fantastic!  I wish GCC was that smart! ;-)
If there's no collector, that's exactly what I want the back-end to do.

If there *is* a collector, however, the back-end can't optimize *away*
the stack marking, because the collector gets passed (via the
global variable) a linked list of all the stack frames, and
it traverses them.  The back-end may perhaps be able to do some
optimizations, for example inlining, which may mean that what the
garbage collector sees in its linked list don't correspond directly
to the actual stack frames.  No problem.  If the compiler is really clever it
may even decide to specialize the garbage collector for each different
call to the allocation routine.  Great!  That won't break the collector;
it may even help it run faster.

Fergus Henderson <>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <>  |     -- the last words of T. S. Garp.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]