[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] External representation for continuations
From: |
Felix Winkelmann |
Subject: |
Re: [Chicken-users] External representation for continuations |
Date: |
Wed, 01 Sep 2004 12:14:51 +0200 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040208) |
Thomas Chust wrote:
Hello,
I've come across a paper about Kali Scheme and so I started wondering
whether it would be possible to create a sensible external
representation of continuations / threads in CHICKEN -- something you
could transmit over a network channel and use at the other side, at
least if the other side was running the same Scheme program.
Any good ideas are welcome!
Basically everything is possible... ;-)
I pondered about this quite a bit. Basic serialization of data is not
a big problem, but code is somewhat tricky. A closure (or continuation)
contains a code-pointer to some C routine. To properly serialize a closure,
the code-pointer would have to be converted into some unique id, which,
when deserialized back into a running process must be converted into
a code-pointer again (we can't just write the code-pointer directly:
in a process that deserializes a closure, the code-addresses may be at
completely different locations, or might even not be available, for
example if a library is not linked, which was used and referenced in
a serialized continuation/closure).
One possible solution would be to generate a function-table for each
compiled file that maps code-pointers to unique identifiers). On serialization
a code-pointer would be looked up in that table, the id written and on
deserialization the id is searched in all loaded/linked units/modules
and converted back into a code-pointer.
But serializing continuations is a tricky business: ports and foreign-
pointers have to handled specially and one has to make sure that a cont.
does not pull in the whole global environment.
cheers,
felix
- [Chicken-users] External representation for continuations, Thomas Chust, 2004/09/01
- RE: [Chicken-users] External representation for continuations, Jonah Beckford, 2004/09/01
- RE: [Chicken-users] External representation for continuations, Joerg F. Wittenberger, 2004/09/06
- RE: [Chicken-users] External representation for continuations, Jonah Beckford, 2004/09/06
- RE: [Chicken-users] External representation for continuations, Jonah Beckford, 2004/09/01