Re: [PATCH] Continuations now close over register stacks

2004-01-12 Thread Dan Sugalski
At 1:02 AM -0500 1/9/04, Michal Wallace wrote: I changed my compiler to call savetop before every function call, and that passes my tests but I'm having trouble visualizing why. Would I ever NOT want to call savetop before creating a continuation? Sure. The only reason to call savetop is if you wan

Re: [PATCH] Continuations now close over register stacks

2004-01-12 Thread Leopold Toetsch
Luke Palmer <[EMAIL PROTECTED]> wrote: > This patch re-implements the register backing stacks as PObjs (so they > can be garbage-collected), honors their COW flags, and adds them to the > interpreter context (where they should be, honest!). > As a healthy side-effect, it encapsulates their behavio

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Michal Wallace
On Fri, 9 Jan 2004, Luke Palmer wrote: > Very rarely would you not savetop before creating a *real* continuation. > But again, very rarely would you actually create a *real* continuation > (depending on your language). RetContinuations are almost always a > better choice for traditional languages

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Michal Wallace
On Fri, 9 Jan 2004, Leopold Toetsch wrote: > Michal Wallace <[EMAIL PROTECTED]> wrote: > > > newsub $P1, .Continuation, done > > For returning just use a .RetContinuation. Or still better, just omit > $P1 totally here: > > > .pcc_call $P0, $P1 Aha! I like that even better. :) Thanks! Sin

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Luke Palmer
Michal Wallace writes: > On Thu, 8 Jan 2004, Luke Palmer wrote: > > .sub __main__ > > newsub $P0, .Closure, _func > > savetop > > newsub $P0, .Continuation, done > > > > So the restoretop after the invoke has something to pop (and so your > > register state isn't screwed up when you get

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Leopold Toetsch
Michal Wallace <[EMAIL PROTECTED]> wrote: > newsub $P1, .Continuation, done For returning just use a .RetContinuation. Or still better, just omit $P1 totally here: > .pcc_call $P0, $P1 leo

Re: [PATCH] Continuations now close over register stacks

2004-01-09 Thread Leopold Toetsch
Luke Palmer <[EMAIL PROTECTED]> wrote: > .sub __main__ > newsub $P0, .Closure, _func > savetop No - not for plain subroutines/closures. > Or you could do as PCC does and use a .RetContinuation, which doesn't > close over the stacks, when you don't actually need a full continuation. Yep.

Re: [PATCH] Continuations now close over register stacks

2004-01-08 Thread Michal Wallace
On Thu, 8 Jan 2004, Luke Palmer wrote: > @pcc_sub_call_4: > set P0, P17 > set P1, P16 > set I0, 0 > set I1, 0 > set I2, 0 > set I3, -2 > updatecc > savetop > invoke > done: > restoretop > set P16, P5 > > When t

Re: [PATCH] Continuations now close over register stacks

2004-01-08 Thread Luke Palmer
Michal Wallace writes: > Luke Palmer wrote: > > > This patch re-implements the register backing stacks as PObjs (so > > they can be garbage-collected), honors their COW flags, and adds > > them to the interpreter context (where they should be, honest!). > > > > As a healthy side-effect, it encapsu

re: [PATCH] Continuations now close over register stacks

2004-01-08 Thread Michal Wallace
Luke Palmer wrote: > This patch re-implements the register backing stacks as PObjs (so > they can be garbage-collected), honors their COW flags, and adds > them to the interpreter context (where they should be, honest!). > > As a healthy side-effect, it encapsulates their behavior nicely into >

[PATCH] Continuations now close over register stacks

2004-01-07 Thread Luke Palmer
This patch re-implements the register backing stacks as PObjs (so they can be garbage-collected), honors their COW flags, and adds them to the interpreter context (where they should be, honest!). As a healthy side-effect, it encapsulates their behavior nicely into register.c, when before their gut