Implementing generators in Truffle

Timothy Baldridge tbaldridge at gmail.com
Mon May 5 23:31:34 UTC 2014


I'm mostly interested in this for creating cheap co-routines and/or
generators in languages. I have a fair amount of experience with RPython
and implementation of yield semantics in that language is rather straight
forward. From my reading of the Truffle documentation it didn't seem to be
so straightforward.

So I'd prefer to have true delimited continuations where a yield in one
function could bounce up through several frames (as exceptions do), but I
could settle for Python/C# style "within this method only" support.

Timothy


On Mon, May 5, 2014 at 4:17 PM, Thomas Wuerthinger <
thomas.wuerthinger at oracle.com> wrote:

> Timothy,
>
> We have currently no support for continuations in Truffle - it is however
> on the list of features we would like to add. Lukas Stadler (CC’d) has done
> some work on continuations in the context of HotSpot that we plan to port.
> Maybe you can provide us with some details on what kind of delimited
> continuation system would fit your needs.
>
> The ZipPy guys (e.g., Wei Zhang, CC’d) have done some work on optimizing
> generators in Truffle as they require high-performance generators for their
> Python implementation. Maybe they can share with you some of their
> experiences.
>
> - thomas
>
> On 05 May 2014, at 23:53, Timothy Baldridge <tbaldridge at gmail.com> wrote:
>
> > For a language I'm writing (based on Truffle) I would love to be able to
> > support yield at a language level. What's the best way to go about this?
> Am
> > I stuck implementing yield via state machines like C# does, or is there
> > some sort of delimited continuation system in Truffle?
> >
> > Thanks,
> >
> > Timothy
>
>


-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)


More information about the graal-dev mailing list