At 2:10 PM +0200 9/8/04, Leopold Toetsch wrote:
Jens Rieks wrote:
Hi,

the examples in examples/streams are not working with --gc-debug,
FileLines.imc crashes even without it.

Any idea why?

Nasty. After spending some hours with gdb and thinking up, down, and in circles, I could eventually boil it down to the code below.


The continuation created in sub2 has in its context a snapshot of the register backing stacks. After returning from sub2, this context is still alive in the continuation. Now when calling another sub, the interpreter's context changes. The register preserving code is attaching different register backing stacks to the context (simulated by "pushi" below). Now, when these new stack chunks happen to have the same address as the stack saved in the context of the continuation, Bad Things happen.

This shouldn't happen--we're apparently doing wrong things with the backing stacks. (This was working properly at one point) If a continuation's taken then the backing stacks should all be marked COW. Pushes to partially filled stack chunks should result in the chunk getting cloned with the original chunk left for anything holding onto it.


There are two simple answers here (the proposal for the change in the way interpreter context structs are handled isn't it -- we'll have the same problem because we'll still have backing stacks). Either get COW working on the backing stacks as it ought, or switch to a one-frame-per-chunk scheme. Both will work out just fine.
--
Dan


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

Reply via email to