This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: continuation and multi-threading
- To: djurfeldt at nada dot kth dot se
- Subject: Re: continuation and multi-threading
- From: Miroslav Silovic <silovic at zesoi dot fer dot hr>
- Date: 02 Aug 2000 02:15:45 +0200
- Cc: Keisuke Nishida <kxn30 at po dot cwru dot edu>, guile at sourceware dot cygnus dot com
- References: <m3g0oqnjrp.fsf_-_@indy.STUDENT.CWRU.Edu> <m3d7jxa9gv.fsf@indy.STUDENT.CWRU.Edu> <p2tpunx85vu.fsf@bohne.zrz.tu-berlin.de> <m33dksvk8i.fsf@indy.STUDENT.CWRU.Edu> <200007311359.NAA00736@ruebe.zrz.tu-berlin.de> <AD4WUXvScB@khim.sch57.msk.ru> <m3wvi2m0pw.fsf@indy.STUDENT.CWRU.Edu> <87punux90c.fsf@piracy.red-bean.com> <m3ya2h1vk4.fsf@indy.STUDENT.CWRU.Edu> <873dkpwmw5.fsf@piracy.red-bean.com> <m3vgxlo5db.fsf@indy.STUDENT.CWRU.Edu> <xy73dkohlvy.fsf@mdj.nada.kth.se> <m3ittkpxav.fsf@indy.STUDENT.CWRU.Edu> <xy7ya2geoc2.fsf@mdj.nada.kth.se> <7e7la0ppzo.fsf@zesoi.fer.hr> <xy7u2d4d1y3.fsf@mdj.nada.kth.se>
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> Do you understand Keisuke's VM well enough to say that breaking the
> stack into frames would be a viable solution? (I ask this because I'm
> interested, not because I want to put you on slippery ground.)
>
> Can you describe the gain of doing this?
I don't understand his VM (after all, I haven't seen the source yet),
but the idea is rather general.
You split your VM stack into chunks - doesn't matter how, but function
call boundaries are the obvious borderlines. Then you can GC the
individual frames, and they don't have to be contiguous in memory.
Then you can do different things to avoid copying. For example, copy
the last frame, mark the other as read-only (possibly with a
timestamp) on a call/cc, and copy as needed. Or use CPS, don't -ever-
trully return from VM the functions, and use tail-recursion and gc to
clean up the frames.
The main advantage of frames is that they form a tree, which Scheme
execution model kinda expects (especially for the environments,
i.e. local variables).
Hmm, this reminds me, if the local variables are kept on the stack,
and that stack is copied, set! won't stick after invoking a
continuation (contrary to R5RS). So you must keep local variables in
frames anyway.
--
How to eff the ineffable?