Delimited Continuations in PyPy?
I recently came across this paper: https://www.microsoft.com/en-us/research/publication/implementing-algebraic-... The gist is that they use setjmp/longjmp to create delimited continuations in compliant C99. It seems like this method is fairly close to what PyPy already does with stacklets. Any reason why this couldn't be ported to PyPy? Of course there'd have to be some sort of stack integration as with stacklets, but it seems that that mostly boils down to making sure the GC has a way to trace the bits of the stack contained in the continuations. I'm considering trying my hand at using their library via rffi, and copying what I need from _stacklet_shadowstack.py. But perhaps there's something I'm missing that makes this a no-go from the start. Thanks, Timothy Baldridge
Hi Timothy, On 4 August 2017 at 01:08, Timothy Baldridge <tbaldridge@gmail.com> wrote:
It seems like this method is fairly close to what PyPy already does with stacklets. Any reason why this couldn't be ported to PyPy?
My first reaction is that this *is* stacklets. Can you describe in two words what there is more? A bientôt, Armin.
One may choose to invoke a continuation multiple times. Therefore, wouldn't continuations require forkable stacklets? Which appear to be unimplelemented:
/* stacklet_handle _stacklet_switch_to_copy(stacklet_handle) --- later */
https://bitbucket.org/pypy/pypy/annotate/5ef9bb870cd2af8df10d9394ca7b8cd4bed3fd15/rpython/translator/c/src/stacklet/stacklet.h?at=default&fileviewer=file-view-default#stacklet.h-55 -- Sent from: http://pypy.1116445.n5.nabble.com/
Hi, On 15 December 2017 at 07:47, cristipp <cristipp@gmail.com> wrote:
One may choose to invoke a continuation multiple times. Therefore, wouldn't continuations require forkable stacklets?
Answered on https://bitbucket.org/pypy/pypy/issues/2710/call-cc-delimited-continuations-.... Armin
participants (3)
-
Armin Rigo
-
cristipp
-
Timothy Baldridge