Jeff Clites writes:
> On Jan 6, 2004, at 3:41 PM, Luke Palmer wrote:
>
> >Leopold Toetsch writes:
> >>
> >>Good. Pass it over to me :) COW copy of stacks and of other
> >>buffer-based
> >>items is still broken. These need distinct headers so that they work
> >>like COWed strings.
> >
> >Alright, I've got a pretty big incomplete patch here (see, when one has
> >a deadline on a compiler written with the assumption of working
> >continuations, one can be pretty determined :-).
> >
> >It makes each chunk into a subclass of Buffer like so:
> >
> > struct RegisterChunkBuf {
> > size_t used;
> > PObj* next;
> > };
>
> To do that properly, I think you need a pobj_t as the first struct
> member, like string has:
>
> struct parrot_string_t {
> pobj_t obj;
> UINTVAL bufused;
> void *strstart;
> UINTVAL strlen;
> const ENCODING *encoding;
> const CHARTYPE *type;
> INTVAL language;
> };
Ah, no. That's how you create a new type of header. I need nothing
more than the simple buffer header. So I make a PObj and stick this
struct in its bufstart.
> so maybe something like:
>
> struct RegisterChunkBuf {
> pobj_t obj;
> UINTVAL bufused;
> RegisterChunkBuf* next;
> };
>
> But also take a look at list.h and see if it's already doing what you
> want to do; you may be able to do it directly.
>
> >And then, for example:
> >
> > struct PRegChunkBuf {
> > struct RegisterChunkBuf buf;
> > struct PRegFrame PRegFrame[FRAMES_PER_CHUNK];
> > };
> >
> >I want these things to be garbage collected, but DOD doesn't trace the
> >buffer. I can't seem to find a way to mark the frames without making
> >the chunks into PMCs (yuck). Is there a way to do this?
>
> I think you'll need to add something to the root set tracing code
> (probably trace_active_buffers() in src/dod.c). I'm not sure what all
> of you stuff hangs off of, though.
Did that. That works for the main part, but continuations and
who-knows-what-else are going to be holding references to parts of
these, so I'd like to mark these automatically.
Unless... hey! You just gave me an idea. I'll make a mark_regstack
that anything that holds on to one of these has to call as part of its
mark routine. I know, it seems like a no-brainer. Mustn't have had a
brain earlier :-)
> Just some thoughts--I'm a little fuzzy on where these items are rooted.
That's fine, and thanks. I learned most of these concepts earlier today
hacking on this patch...
Luke