Leopold Toetsch <[EMAIL PROTECTED]> writes: > Piers Cawley wrote: > >> Leopold Toetsch <[EMAIL PROTECTED]> writes: >>> >>>Here is a proof of concept patchoid: >>> >> Fabulous >> >>>1) change to your example code: >>> $P1 = clone P1 >>> store_lex 1, "cc", $P1 >>>(the clone strips off all recycle flags) >>> >> Oh nice, much neater than what I was thinking of involving making a >> 'real' continuation and copying context info across from the return >> continuation. > > Yep. That was the reason I rewrote the clone code in the first place. > >> ... Does this pretty much remove the last distinction between >> RetContinuation and Continuation? > > Pretty much, yes. Continuation still have one relict from COWing times: > these are warnings and errors flags buffers. But it's very likely, that > COW copying these buffers is wrong too and a plain copy will do it, as > it works with all stacks now. When this is removed, RetContinuations and > Continuations are the same. It looks like the only distinction might be > the creation of the Continuation: > > invokecc # create Continuation for recycling or > callemthodcc # same > > newsub $P1, .Continuation, label # or > $P1 = clone P1 # recycling disabled > > This OTOH means, that a Continuation created with invokecc shall be > never silently reused. There is currently one protection in the code > against that: If ever one Continuation is created explicitely, > RetContinuation recycling is disabled - forever.
When you make a full continuation with clone, can't you chase up its continuation chain and mark its reachable continuations (and only those continuations) as non recyclable? (This is one of the reasons I think that a Continuation should have an explicit copy of the continuation that was current when it was made, rather than relying on savetop/pushtopp to capture it.)