guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Identities to Peval


From: Andy Wingo
Subject: Re: Adding Identities to Peval
Date: Fri, 17 Feb 2012 09:13:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hi Noah,

On Fri 17 Feb 2012 03:22, Noah Lavine <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]