This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fast continuations


Hello,

Just an idea for fast continuations:

 1. When a continuation is created, the VM detachs the current stack
    and gives it to the continuation object.  Now this detached stack
    is *read only*.

 2. The VM creates a new stack and continues execution.  A PUSH will
    always use this new stack.  A POP will use the new stack if there
    are some objects, or the old read-only stack otherwise.

 3. Whenever a continuation is called, the VM uses these double stacks:
    one for work and one for read.

I haven't thought out details, but this approach seems fit for my VM
quite well.  I don't need to change the current stack mechanism.
Since there is no stack copying, there will be virtually no extra cost
with continuations, if it is carefully implemented.

However, I guess the real tricky part is not continuations but C
function calls...  It is easy for a VM to call C functions, but the
opposite is not true.  In order to catch a signal from C functions,
the VM has to carefully wrap around it.  And how could I call a
continuation from a C function?  Hmm, tricky...

-- Kei

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]