This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Full continuations with heap-based program stack?
- From: Denis Washington <denisw at online dot de>
- To: kawa at sourceware dot org
- Date: Sun, 11 Sep 2011 20:02:02 +0200
- Subject: Full continuations with heap-based program stack?
Hi,
I am looking for a Java-based Scheme implementation as scripting
language for a personal project of mine, and I came across Kawa. (Thanks
for those who have created and are contributing to this gem!) However,
the fact that it doesn't support full support for first-class
continuations is a showstopper for me because this is a feature that I
specifically need. (The Scheme scripts would be used to direct actors in
a game and should allow for commands such as "animate-and-wait" which
pass a continuation to the main loop and stop the script until the
animation is completed, in which case the continuation is invoked.)
I understand that the JVM does not have any support for continuations
and does also not allow to introspect the program stack. So I guess the
only way to support full first-class continuations in Kawa would be to
move the complete program stack used by Scheme code onto the heap. This
would probably also make it possible to support full tail-call
elimination, as the stack would then be fully introspectable.
Given that the JVM does is not able support these essential Scheme
features, and that this will probably not change soon (if ever, let
alone for non-openjdk based VMs such as Dalvik), such an approach might
well be appropiate for implementation within Kawa. However, it seems as
if this change would have a rather big performance impact, so maybe it
would be a better idea to make this behavior optional for those
applications where full continuation and tail call support is not required.
Is there a possibility that something like this could be implemented in
Kawa? Is there maybe someone actually working on it? If not, I could
help to implement this, though I don't know anything about the Kawa code
base currently.
Regards,
Denis Washington