Dan Sugalski writes:
> At 10:09 PM +0100 1/12/04, Leopold Toetsch wrote:
> >Luke Palmer <[EMAIL PROTECTED]> wrote:
> >> This fixes a rather obvious and silly oversight in my patch.
> >
> >> +    PObj_COW_CLEAR((PObj*)buf);
> >
> >I don't think that works or better let's say: it's ok 50 percent - for
> >the new "buf" chunk, but the old one, which maybe hasn't any refering
> >COWed copy anymore still has the COW flag on that buffer.
> 
> I think I'd as soon leave COW-marked buffers as COW forever, or until 
> they're garbage collected. Most stack segments that get marked COW 
> are either going to be unreferenced, in which case the COW status is 
> irrelevant, or are on a code path likely to create a continuation 
> with a handle on the COW'd chunk thus making its COW status 
> reasonable.

I agree with Dan here.  Thinking about the common cases, marking COW
means marking "immutable", as in a continuation.  Once that's made, it
will never become mutable again.   Indeed, once the continuation gets
collected, then you can unmark the stack, but half of it's probably
already copied and in use somewhere else instead.

But that patch needs to go in anyway, as copying something so you can
mutate it and then keeping it cow is... silly at best.

Luke

> Since this is going to be invisible to user code, we can leave it as 
> is for now and revisit the entire scheme in its entirety later if we 
> want to do an optimizing run across the source.
> -- 
>                                         Dan
> 
> --------------------------------------"it's like this"-------------------
> Dan Sugalski                          even samurai
> [EMAIL PROTECTED]                         have teddy bears and even
>                                       teddy bears get drunk

Reply via email to