public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: kawa@sourceware.org
Subject: Re: First-class continuations in Kawa
Date: Sat, 1 May 2021 13:38:28 -0700	[thread overview]
Message-ID: <11feb74b-49fa-3fbd-213d-7d939dccfb1a@bothner.com> (raw)
In-Reply-To: <23585.1619896007@localhost>

It is indeed a shame that this has been languishing so long.
However, we need someone to drive it - not me.

It is not just a matter of merging in the code.  We need someone who is
willing to study and understand the code, test it (including writing testcases),
and measure the performance.

The implementation is I believe functional (conceptually - things may have
broken over the years), but I suspect it is not very efficient.  Still,
if it works correctly (which requires testing by someone who understands
continuations better than I do), one can always work on performance later.

There is some old code dependent on the usingSPSStyle method that could
potentially be more efficient.  It is based on using the JVM tableswitch
instruction, so it might be more efficient - at least worth studying for ideas.

On the other hand, using MethodHandle to call all the stub procedures
that result from CPS conversion might be better style, and would probably
be more elegant and fit better with the existing framework:
Basically have CALL_WITH_CONTINUATIONS build on the CALL_WITH_TAILCALLS
framework. which uses MethodHandles.

Basically, I'm hoping for someone willing who understands and wants to
use continuations, and who is willling to put in the time to understand
the callcc branch, how CALL_WITH_TAILCALLS uses MethodHandles, the JVM,
and the ideas behind old commented-out usingSPSStyle code.

That's a tall order - but you would learn a lot!

Using Project Loom would almost certainly be more efficient and
simpler to code - but I think it will take a long time before Loom
is useful to us.  My impression is Loom is focusing initially on low-overhead
threads ("fibers"), which can use useful for some call/cc use-cases
(such as co-routines and "async" programing - or more generally "single-use"
continuations).  Delimited continuations may take longer - and even
for low-overhead threads I haven't seen any timeframe.

> Or would there be some
> compatibility issues with other JVM languages and libraries?

I suspect if you create a continuation, call some Java methods
(or Kawa code that has not been compiled with the necessary switches),
and then invoke the continuation, I doubt it will work, at least in general.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

  reply	other threads:[~2021-05-01 20:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20  0:49 Duncan Mak
2018-01-20  6:47 ` Per Bothner
2018-01-20 16:07   ` Duncan Mak
2018-01-20 23:20     ` Andrea Bernardini
2018-02-21  0:21       ` Andrea Bernardini
2018-02-22  0:38         ` Duncan Mak
2021-05-01 16:15           ` Duncan Mak
2021-05-01 18:45             ` Arvydas Silanskas
2021-05-01 19:06               ` Sudarshan S Chawathe
2021-05-01 20:38                 ` Per Bothner [this message]
2021-06-09  9:04                   ` Arvydas Silanskas
2021-06-09 23:27                     ` Per Bothner
2021-08-08 14:29                       ` Arvydas Silanskas
2021-08-08 15:53                         ` Andrea Bernardini
2021-08-08 23:52                         ` Per Bothner
2021-08-09 19:41                           ` Per Bothner
2022-12-07 23:42                             ` Duncan Mak
2022-12-09 10:53                               ` Arvydas Silanskas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11feb74b-49fa-3fbd-213d-7d939dccfb1a@bothner.com \
    --to=per@bothner.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).