oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.02k stars 185 forks source link

Fibers on Truffle - need some pointers #2731

Closed marad closed 2 years ago

marad commented 2 years ago

Hi guys! Great work with this Ruby implementation!

I've stumbled upon this post talking about fibers in TruffleRuby.

I'm creating a small language as an experiment and looking forward to implementing algebraic effects there. Having ability to suspend execution would really help here. Can you give me some pointers on how to achieve that?

I'd very much apreciate any help since, I'm kindof stuck with it right now.

nirvdrum commented 2 years ago

TruffleRuby has support for the Fiber API. Project Loom, mentioned in the linked post, made its way into Java 19 and that should improve TruffleRuby's Fiber performance. Do you have code that doesn't work with TruffleRuby today?

marad commented 2 years ago

Oh no, I guess I haven't been really clear.

I'm implementing a language based on Truffle and wanted to leverage the continuations to implement algebraic effects. Problem I have is that I don't really know how to achieve this using Truffle.

With TruffleRuby supporting Fibers this is probably achievable even without Project Loom, but I'm not sure how to do this. Do you have any hints?

nirvdrum commented 2 years ago

Ahh. The best place to get started is to look at our FiberNodes. You'll be able to navigate to everything of note from there. If you have further questions, it's probably best to hop on the GraalVM Slack workspace and join the #truffleruby or #truffle channels. We generally try to keep the issue tracker for bug reports.

eregon commented 2 years ago

Let's convert this to a discussion :)