unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Noah Lavine <noah.b.lavine@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Adding Identities to Peval
Date: Fri, 17 Feb 2012 09:13:56 +0100	[thread overview]
Message-ID: <87zkchop17.fsf@pobox.com> (raw)
In-Reply-To: <CA+U71=O64xETrhVtC0QHCb2SJE51YsaSXjwpcPyAeDZ7PrS2_A@mail.gmail.com> (Noah Lavine's message of "Thu, 16 Feb 2012 21:22:02 -0500")

Hi Noah,

On Fri 17 Feb 2012 03:22, Noah Lavine <noah.b.lavine@gmail.com> writes:

>>> (let* ((x (random))
>>>        (y (list x))
>>>        (z (car y))
>>>   (eq? x z))
>>
> To make sure I understand, in the x-y-z example, psyntax would produce
> different gensyms for x and z, but peval could merge them later on,
> right?

When processing `z' for value, it should reduce to `x'.  The strategy is
to do computation at compile time -- if at compile time, `z' can reduce
to `x', peval will do it.  But there is no global "give me all the
things that are equal to x" procedure.

> In that case, peval would maintain the invariant "if two values must
> always be the same, they have the same gensym". Correct?

More like the other way around!  If one identifier partially evaluates
to another, then they will have the same gensym, and therefore are the
same identifier.

>> This is related to range analysis.  But, it's also something that's
>> easier to do with an explicit notion of control flow (i.e. a CPS IR).
>
> Yes, I think you're right. I would be very interested in working on a
> CPS IR, but I remember you had a blog post a couple months ago where
> you said you weren't sure if CPS or ANF was better for Guile. What do
> you think about intermediate representations now?

I have no idea :-) I am a little hesitant to move to either one right
now, because our stack machine penalizes named temporaries, and with CPS
(or ANF -- which is closer to what we have, but without the advantage of
treating control flow on a first-class level) you would get a lot more
named temporaries.  But my uncertainty is also because I don't know what
it would make the compiler look like.  Would it simplify things or would
it add complication?  I don't know.

But, writing a pass to turn tree-il into some CPS language would be a
really interesting step in any case.  If you wanted to work on that, I'm
sure it would be instructive to us all.

My humble thoughts :)

Cheers,

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2012-02-17  8:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16  1:29 Adding Identities to Peval Noah Lavine
2012-02-16  2:32 ` Mark H Weaver
2012-02-16  6:00 ` David Kastrup
2012-02-16  6:39   ` David Kastrup
2012-02-16  8:14     ` David Kastrup
2012-02-16  9:36 ` Andy Wingo
2012-02-16 13:18   ` Noah Lavine
2012-02-16 15:06     ` Andy Wingo
2012-02-16 17:33       ` Andy Wingo
2012-02-17  2:22       ` Noah Lavine
2012-02-17  8:13         ` Andy Wingo [this message]
2012-02-18 16:20           ` Noah Lavine
2012-02-19  9:53             ` Andy Wingo
2012-02-20 20:25               ` Noah Lavine

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

  List information: https://www.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=87zkchop17.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=noah.b.lavine@gmail.com \
    /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).