From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by sourceware.org (Postfix) with ESMTPS id 84189385781A for ; Wed, 9 Jun 2021 09:04:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 84189385781A Received: by mail-lj1-x235.google.com with SMTP id z22so14767485ljh.8 for ; Wed, 09 Jun 2021 02:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G5pE91bCZib3LTBonJm3NTi3PSnhTa6N/pMKSh0ZmSc=; b=Q6x2wuEHDxhgA4lvghXZsvbph0OCTPyI0pWLi05ttsqWmfWuIaJiHT3WBYX2qyWbuG t9eFl3/uVvxWOFoQLs/7ZGME5t493FP4UVwjqos9+p+L+K5PHez4GbtvvGanWxIPnKVJ RLORArhr9r667hqQ3bhX65nJZliASLrkwSS9KovSmC0aTeTOV/F51d+ANmFb+qgtOM3f K888c4+BKcEP8q92DvPIJtuCByzDG9SvskSE0/ZnOf0OaJ9wsuerQtnb74RwTRGZ6Y5N V2QrtpB19astnNMHfQ5lLT7QGqzLJLsTP2WGaXNuIjJkBkEOsTvSxsKcHf41Vbh0Q3W6 53HA== X-Gm-Message-State: AOAM533cwZn4ZkPUPikuRoJH9GP+jcqXQt3Mp2dzb7CZjaHnLiTjfNKd HnEydcUXX8DpUUMrAzcIeQ6oQkwDeD75r1Qhm0DhIwP9 X-Google-Smtp-Source: ABdhPJzWqITdLaMjvGAntQrI/QCAgHXsgGz1CLFUD3cIMzr8njqyw13gIHSpb4cEzUqno0l+guI4Dj4evA8L0tw0+Xc= X-Received: by 2002:a2e:a315:: with SMTP id l21mr21623251lje.158.1623229472440; Wed, 09 Jun 2021 02:04:32 -0700 (PDT) MIME-Version: 1.0 References: <23585.1619896007@localhost> <11feb74b-49fa-3fbd-213d-7d939dccfb1a@bothner.com> In-Reply-To: <11feb74b-49fa-3fbd-213d-7d939dccfb1a@bothner.com> From: Arvydas Silanskas Date: Wed, 9 Jun 2021 12:04:22 +0300 Message-ID: Subject: Re: First-class continuations in Kawa To: Per Bothner Cc: kawa mailing list X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: kawa@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Kawa mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 09:04:35 -0000 Has anyone taken up on this? If not, I'll give it a try. 2021-05-02, sk, 00:50 Per Bothner ra=C5=A1=C4=97: > 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 hav= e > 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/ >