On Sun, May 26, 2002 at 08:20:23AM -0700, Sean O'Rourke wrote: > I'm sure it's been discussed before somewhere, but why can't we guarantee > that we only do GC runs between ops? Each op would just have to guarantee > that all of its persistent data is reachable before it returns. It seems > like this would avoid the need for a neonate flag entirely.
If you know how much memory the op is going to need, then you can run the GC just before executing the op to make sure that at least this amount of memory is available (and non fragmented). But this seems to be a pretty strong requirement. Otherwise, you should be able to run the GC whenever you allocate some memory. > > "Mike Lambert" wrote: > > > Another proposal is to walk the C stack. What about managing explicitly a stack of Parrot values? Something like this: /* Save the top of the stack */ struct parrot_frame *parent = parrot_stack; /* Create a variable "x" which contains Parrot values */ parrot_value x = 0; /* This is the variable */ struct parrot_frame frame; /* Allocate a stack frame */ frame.val = &x; /* Push the value into the stack */ frame.next = parrot_stack; parrot_stack = &frame; /* ... Body of the function */ parrot_stack = parent; /* Pop the stack */ return; /* Exit the function */ With a suitable set of macros, this should be manageable. -- Jerome