[Gc] GC hooks.

Boehm, Hans hans_boehm@hp.com
Thu, 29 May 2003 13:53:27 -0700


Aside from Fergus' comments, the approach basically looks good to me.
(Also note that GCThreadFunctions needs to be GC_ThreadFunctions to
follow the namespace convention.  But see below ...)

I would however prefer not to integrate this until after 6.2, and then
to extend this a little, beyond just linux_threads.c.  In particular,
this potentially gives a clean hook for replacing the stack marking routine.
Currently it's a bit ugly to do that.  I think it's important, in that it
allows you to take advantage of any stack layout information you may have.

Note that I just integrated Brian Alliet's Darwin patch, which split
linux_threads.c into pthread_support.c and pthread_stop_world.c (and darwin_stop_world.c).
I suspect that interacts well with this change.  We may want to arrange
things so that the ..._stop_world.c files only define GCThreadFunction entries.
But don't bother with the details of the patch right now.  Not a lot of the
linux_threads code changed much, but it did move around.

Speaking of prototypes, does anyone object to getting rid of GC_PROTO for 6.3,
and consistently assuming at least the C89 standard?  My impression is that
last compilers that failed to support this are either gone or rapidly disappearing.

Hans

> -----Original Message-----
> From: Fergus Henderson [mailto:fjh@cs.mu.oz.au]
> Sent: Wednesday, May 28, 2003 9:35 AM
> To: Miguel de Icaza
> Cc: Martin Baulig; Hans Boehm; ximian-mono-list@ximian.com;
> gc@napali.hpl.hp.com
> Subject: Re: [Gc] GC hooks.
> 
> 
> On 28-May-2003, Miguel de Icaza <miguel@ximian.com> wrote:
> > Index: include/gc.h
> ...
> > +typedef struct
> > +{
> > +	void (* initialize) (void);
> > +
> > +	void (* stop_world) (void);
> > +	void (* push_all_stacks) (void);
> > +	void (* start_world) (void);
> > +} GCThreadFunctions;
> > +
> > +extern GCThreadFunctions *gc_thread_vtable;
> 
> There should be some comments there explaining who is allowed to
> modify the gc_thread_vtable structure, and what the meaning of
> each of the fields is -- what each function does.
> 
> Those prototypes should probably use the GC_PROTO() macro.
> 
> > +++ linux_threads.c	16 May 2003 23:49:08 -0000
> ...
> > +static void linux_stop_world()
> >
> > +static void linux_start_world()
> ...
> > +static void linux_push_all_stacks()
> 
> There should be prototypes for those functions.
> The collector's sources are not very good in this respect,
> but in modern-day C, there should be a function prototype for 
> every function.
> 
> > +GCThreadFunctions linux_thread_vtable = {
> 
> That variable should be declared "static".
> 
> -- 
> 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.
>