From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: CPS thoughts Date: Wed, 22 May 2013 00:33:00 -0400 Message-ID: References: <87ppwl9zgi.fsf@pobox.com> <87a9no86bl.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec54861aac7b2d904dd4710e4 X-Trace: ger.gmane.org 1369197208 19435 80.91.229.3 (22 May 2013 04:33:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 May 2013 04:33:28 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed May 22 06:33:27 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uf0jv-0004Dq-07 for guile-devel@m.gmane.org; Wed, 22 May 2013 06:33:27 +0200 Original-Received: from localhost ([::1]:54609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf0ju-0003Ft-IZ for guile-devel@m.gmane.org; Wed, 22 May 2013 00:33:26 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf0jq-0003Fm-Qk for guile-devel@gnu.org; Wed, 22 May 2013 00:33:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uf0jp-0006VT-CZ for guile-devel@gnu.org; Wed, 22 May 2013 00:33:22 -0400 Original-Received: from mail-vc0-f178.google.com ([209.85.220.178]:45907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf0jp-0006UR-7J for guile-devel@gnu.org; Wed, 22 May 2013 00:33:21 -0400 Original-Received: by mail-vc0-f178.google.com with SMTP id id13so998549vcb.23 for ; Tue, 21 May 2013 21:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=7dqwEagDfyxk9Ev1lJMzq9/a5ldN8iZvCwC/EOuUQiY=; b=XnzzruTzLM/34skTYl7ZMDXFERGkZVX6SADVQQ5W9J6LZ4zPGS4DOr8nnDPNzqdBbJ ighmbOs9kHV54Nq3awjEDWPhXnWj/oQU7cHjlJnHDZ6JS85cpBj2ZWnP1cOAoOhMsx5b gg8WpRH98JRzrULjsG1lZ+iM3AjO6wGgQ84CtzQIO3D+UUaQbwjaHOTloxTEfYZcm/0d xHHsHaZnMfhbZqTTF5GIPe4QpfBLeNKI3mhwK2k4QBAXxbZMXdmgzAu5nRCaR/kEh1rI iWsjO/BhMU3vvrVwqJ7oB12ZP44zH8//WtYY3SDesBdtQqMTfiiRCVGwfSaKiyBAByDa NpTQ== X-Received: by 10.52.110.133 with SMTP id ia5mr1844894vdb.129.1369197200767; Tue, 21 May 2013 21:33:20 -0700 (PDT) Original-Received: by 10.58.112.166 with HTTP; Tue, 21 May 2013 21:33:00 -0700 (PDT) In-Reply-To: <87a9no86bl.fsf@pobox.com> X-Google-Sender-Auth: INlvBeD86Jcx7JXXXHr8srmaSGw X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.178 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16405 Archived-At: --bcaec54861aac7b2d904dd4710e4 Content-Type: text/plain; charset=ISO-8859-1 Hello, On Tue, May 21, 2013 at 3:46 PM, Andy Wingo wrote: > You should have two names: the original ones and the gensyms that come > from tree-il. Creating new gensyms should happen when copying or > fabricating new nodes, as peval does, but in most cases you don't need > to do it, and in any case it can be tricky. > > I would take tree-il as the guide here. > I'll look at it, thanks. > I haven't handled source information yet, but to the CPS->RTL compiler > it will look like emitting special instructions, like the tree-il->glil > compiler emits nodes. > That sounds fairly simple to implement. > This is lambda-properties. You just pass them through, and add them to > the begin-program in the RTL. > Again, this seems relatively simple to do. > Note that wip-rtl-may-2013 and the RTL branches that are under review > for master are slightly different from the ones you have. Their > begin-program has a second argument, the procedure properties, and the > first argument is a label and not a name. They have begin-*-arity and > end-arity for marking arity information and performing arity prologues. > There are some slight changes to instructions but not much. OTOH they > do have some better type checking and a disassembler that works, so many > things should be easier ;) Compare the rtl.test there and your rtl.test > for details. > > > * Why is there no "let" that can bind functions? You don't always > > want > > to set up a recursive binding environment. > I think right now the Tree-IL->CPS compiler will turn (let ((f (lambda ...))) ...) into something like this: ((lambda (f-12345) .... let body here ....) (letrec ((f-func (lambda ... f's body here ...))) f-func)) (I'm not showing the continuation's name because it would make it even more complicated than it already is.) I agree that this is a crazy way to do it. It should detect this case and skip the extra steps. > Understood. However the question of language is fundamental for > enabling collaboration on this code. I would be very happy to see a CPS > language definition that could express all of Tree-IL. I don't think > this would take a lot of work -- it is perfectly acceptable to throw > "unimplemented" for those parts of the compiler that aren't there yet, > but the language itself should be adequately expressive. IMHO anyway. > > Do you think you will have time to do that over the next few days or so? > Apologies for the pressure, just that I would like to do some things in > this area and am not sure how best to do them :) > This is interesting - I had been adding to the language as I needed features, and not really thinking of it as an interface. But you might be right. I just started rebasing tonight, and I hope to work more on it in the next two days. But I don't want to be a blocker for your work - what are you trying to do? Thanks a lot, Noah --bcaec54861aac7b2d904dd4710e4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,

On Tue, May 21, 2013 at 3:46 PM, Andy Wingo <= ;wingo@pobox.com&g= t; wrote:
You should have two names: the original ones= and the gensyms that come
from tree-il. =A0Creating new gensyms should happen when copying or
fabricating new nodes, as peval does, but in most cases you don't need<= br> to do it, and in any case it can be tricky.

I would take tree-il as the guide here.

I'll look at it, thanks.
=A0
I haven't handled source information yet, but to the CPS->RTL compil= er
it will look like emitting special instructions, like the tree-il->glil<= br> compiler emits <glil-source> nodes.

That sounds fairly simple to implement.
=A0
This is lambda-properties. =A0You just pass them through, and add them to the begin-program in the RTL.

Again, th= is seems relatively simple to do.
=A0
Note that wip-rtl-may-2013 and the RTL branches that are under review
for master are slightly different from the ones you have. =A0Their
begin-program has a second argument, the procedure properties, and the
first argument is a label and not a name. =A0They have begin-*-arity and end-arity for marking arity information and performing arity prologues.
There are some slight changes to instructions but not much. =A0OTOH they do have some better type checking and a disassembler that works, so many things should be easier ;) Compare the rtl.test there and your rtl.test
for details.

> =A0 =A0 =A0 * Why is there no "let" that can bind functions?= =A0You don't always
> =A0 =A0 want
> =A0 =A0 =A0 =A0to set up a recursive binding environment.

I think right now the Tree-IL->CPS compile= r will turn (let ((f (lambda ...))) ...) into something like this:

<= /div>
((lambda (f-12345)
=A0 .... let body here ....)
=A0(letrec ((f-func (lambda ... f's body here ...))) f-func))
=
(I'm not showing the continuation's name because it = would make it even more complicated than it already is.)

I agree that this is a crazy way to do it. It should detect = this case and skip the extra steps.
=A0
Understood. =A0However the question of language is fundamental for
enabling collaboration on this code. =A0I would be very happy to see a CPS<= br> language definition that could express all of Tree-IL. =A0I don't think=
this would take a lot of work -- it is perfectly acceptable to throw
"unimplemented" for those parts of the compiler that aren't t= here yet,
but the language itself should be adequately expressive. =A0IMHO anyway.
Do you think you will have time to do that over the next few days or so? Apologies for the pressure, just that I would like to do some things in
this area and am not sure how best to do them :)

<= /div>
This is interesting - I had been adding to the language as I need= ed features, and not really thinking of it as an interface. But you might b= e right. I just started rebasing tonight, and I hope to work more on it in = the next two days. But I don't want to be a blocker for your work - wha= t are you trying to do?
=A0
Thanks a lot,
Noah

--bcaec54861aac7b2d904dd4710e4--