[m-dev.] Trailing

Fergus Henderson fjh at cs.mu.oz.au
Wed Aug 13 23:10:36 AEST 1997


Tyson Richard DOWD, you wrote:
> Bart Demoen wrote:
> 
> > we probably need
> > 
> >         struct value_trail_entry {
> >             Word *address;
> >             Word value;
> > 	    Type type;
> >         };
> 
> Peter and I did work out a scheme where you can avoid this - it's
> difficult to say whether it's a win, however, as you need to create a
> bitmap, which marks which values the trail is interested in keeping around,
> and the accurate GC needs to check each of these, and update the
> addresses in the trail as well (the accurate GC engine knows the
> type of the data it is copying at the time it does the check).

Zoltan pointed out that ideally the garbage collector should consider
`trail.value' to be a root iff `trail.address' is reachable.
This seems to be a strong argument in favour of the extra bitmap approach.

> > it is already a problem for the C-interface (combined with native gc)
> > right now I think - is there a general plan on how to handle it
> > (independent of fancy trailing) ?
> 
> There is a sketchy plan for this - for any C data structure that stores
> data on the heap, it needs to provide a function that will copy it from
> one heap to another (it's possible it would be easier to let it provide
> a some data describing its structure, but this would probably constrain
> the C data structures somewhat). How this works, exactly, is still
> somewhat up in the air, and unfortunately its design is probably
> influenced by things like fancy trailing.

I think basically the idea is that any C data structure that contains a
pointer that points to data on the Mercury heap to explicit register
that pointer with the GC via a function and to unregister it when done.
The call to MR_gc_add_pointer() would specify (i) the address of the pointer
and (ii) either a type_info or a mark procedure or a copy procedure or
something like that so that the GC knows how to deal with that pointer.

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



More information about the developers mailing list