Okay, we're finally hitting the DOD sweeps, and they're starting to 
cause some trouble. As I see it there are a few ways we can keep 
embryonic PMCs and Buffers from getting collected before they're 
fully created and anchored:

1) Set the immortal flag on them until they're fully created

2) Set some sort of partially immortal flag on them

3) Push 'em onto the stack as soon as they're allocated

4) Disable DOD when its inconvenient


I think we can discard #4 pretty much right off the bat. We do that 
too much and we'll find ourselves almost never doing a DOD run. Ick.

#3 is interesting, but the downside is that we end up spending a fair 
amount of time twidding with the stack on every PMC allocation (or a 
good number of them) for those rare occasions when we actually have a 
problem.

#1 is almost OK, but it's got leakage issues. If something throws an 
exception without properly cleaning up, well... bang. Or leak. Or 
something.

So, I think #2 is the way to go. We'll add a new flag, 
(BUFFER|PMC)_stay_of_execution_FLAG or something, that gets added to 
allocated PMCs and Buffers. It'll be treated the same way as the 
constant/immortal flag is treated for DOD purposes, with one 
difference--there'll be an op which specifically clears the flags. 
Since the flag is *not* valid to be set across ops, we're fine.

Only those functions that *must* set it will, and they are also 
required to make sure the stay_of_execution_count interpreter 
variable is set to the proper number (or at least large enough) on 
abnormal exit. (That way we can keep the flag clearing op from 
actually running if there's no reason)

Make sense to everyone?
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                       teddy bears get drunk

Reply via email to