* CPS thoughts
@ 2013-05-20 20:19 Andy Wingo
2013-05-21 3:21 ` Noah Lavine
0 siblings, 1 reply; 6+ messages in thread
From: Andy Wingo @ 2013-05-20 20:19 UTC (permalink / raw)
To: noah.b.lavine; +Cc: guile-devel
Some first thoughts on the CPS language, just after having looked at
(language cps):
* Overall looking really good.
* License blocks are missing.
* Toplevel comments should be prefixed by ";;; " (three semicolons).
* Overview could go in the module commentary section.
* Missing distinction between original names and unique names.
* Missing source information.
* Missing procedure properties.
* Why is there no "let" that can bind functions? You don't always want
to set up a recursive binding environment.
* Lambdas are missing lambda* and case-lambda support.
What do you think about rebasing? wip-rtl-may-2013 is a good target
until wip-rtl goes into master.
Cheers,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CPS thoughts
2013-05-20 20:19 CPS thoughts Andy Wingo
@ 2013-05-21 3:21 ` Noah Lavine
2013-05-21 19:46 ` Andy Wingo
0 siblings, 1 reply; 6+ messages in thread
From: Noah Lavine @ 2013-05-21 3:21 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
[-- Attachment #1: Type: text/plain, Size: 1696 bytes --]
Hello,
Thanks for the review.
On Mon, May 20, 2013 at 4:19 PM, Andy Wingo <wingo@pobox.com> wrote:
> Some first thoughts on the CPS language, just after having looked at
> (language cps):
>
> * Overall looking really good.
>
Thanks! You may choose to retract that after you see the other files, of
course. :-)
> * License blocks are missing.
>
> * Toplevel comments should be prefixed by ";;; " (three semicolons).
>
> * Overview could go in the module commentary section.
>
These three should be simple to fix.
> * Missing distinction between original names and unique names.
>
Yes, I agree. I think it even reuses original names sometimes, which is not
good. I should just rename everything.
> * Missing source information.
>
The issue here is not that it's hard to pass source information through to
the compiler, but that I haven't figured out what to do with it when I have
it. I imagine that your ELF work has solved this problem.
> * Missing procedure properties.
>
Can you explain what you mean? Does the compiler need to handle procedure
properties specially?
> * Why is there no "let" that can bind functions? You don't always want
> to set up a recursive binding environment.
>
> * Lambdas are missing lambda* and case-lambda support.
>
With these two, it's just that I haven't implemented it yet. I'll try to do
it quickly, although I don't know how much time I'll have to work on it.
> What do you think about rebasing? wip-rtl-may-2013 is a good target
> until wip-rtl goes into master.
>
Sounds great! I think the compiler stuff is fairly separate from the RTL
stuff - when I've rebased it occasionally, it hasn't been a problem.
Best,
Noah
[-- Attachment #2: Type: text/html, Size: 3098 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CPS thoughts
2013-05-21 3:21 ` Noah Lavine
@ 2013-05-21 19:46 ` Andy Wingo
2013-05-22 4:33 ` Noah Lavine
0 siblings, 1 reply; 6+ messages in thread
From: Andy Wingo @ 2013-05-21 19:46 UTC (permalink / raw)
To: Noah Lavine; +Cc: guile-devel
On Tue 21 May 2013 05:21, Noah Lavine <noah.b.lavine@gmail.com> writes:
> * Missing distinction between original names and unique names.
>
>
> Yes, I agree. I think it even reuses original names sometimes, which is
> not good. I should just rename everything.
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.
> * Missing source information.
>
>
> The issue here is not that it's hard to pass source information through
> to the compiler, but that I haven't figured out what to do with it when
> I have it. I imagine that your ELF work has solved this problem.
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 <glil-source> nodes.
> * Missing procedure properties.
>
> Can you explain what you mean? Does the compiler need to handle
> procedure properties specially?
This is lambda-properties. You just pass them through, and add them to
the begin-program in the RTL.
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.
>
> * Lambdas are missing lambda* and case-lambda support.
>
> With these two, it's just that I haven't implemented it yet. I'll try to
> do it quickly, although I don't know how much time I'll have to work on
> it.
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 :)
> Sounds great! I think the compiler stuff is fairly separate from the RTL
> stuff - when I've rebased it occasionally, it hasn't been a problem.
Excellent :) Note the changes I mentioned above.
Cheers,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CPS thoughts
2013-05-21 19:46 ` Andy Wingo
@ 2013-05-22 4:33 ` Noah Lavine
2013-05-23 4:05 ` Noah Lavine
0 siblings, 1 reply; 6+ messages in thread
From: Noah Lavine @ 2013-05-22 4:33 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
[-- Attachment #1: Type: text/plain, Size: 2932 bytes --]
Hello,
On Tue, May 21, 2013 at 3:46 PM, Andy Wingo <wingo@pobox.com> 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 <glil-source> 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
[-- Attachment #2: Type: text/html, Size: 4195 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CPS thoughts
2013-05-22 4:33 ` Noah Lavine
@ 2013-05-23 4:05 ` Noah Lavine
2013-05-23 7:20 ` Andy Wingo
0 siblings, 1 reply; 6+ messages in thread
From: Noah Lavine @ 2013-05-23 4:05 UTC (permalink / raw)
To: Noah Lavine; +Cc: Andy Wingo, guile-devel
[-- Attachment #1: Type: text/plain, Size: 3334 bytes --]
An update: I just rebased wip-rtl-cps on top of wip-rtl-may-2013 and
pushed. The most interesting thing was how trivial it was: all I had to do
was make a one-line change in how I called `begin-program'.
Best,
Noah
On Wed, May 22, 2013 at 12:33 AM, Noah Lavine <noah.b.lavine@gmail.com>wrote:
> Hello,
>
> On Tue, May 21, 2013 at 3:46 PM, Andy Wingo <wingo@pobox.com> 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 <glil-source> 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
>
>
[-- Attachment #2: Type: text/html, Size: 4945 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: CPS thoughts
2013-05-23 4:05 ` Noah Lavine
@ 2013-05-23 7:20 ` Andy Wingo
0 siblings, 0 replies; 6+ messages in thread
From: Andy Wingo @ 2013-05-23 7:20 UTC (permalink / raw)
To: Noah Lavine; +Cc: guile-devel
On Thu 23 May 2013 06:05, Noah Lavine <noah.b.lavine@gmail.com> writes:
> An update: I just rebased wip-rtl-cps on top of wip-rtl-may-2013 and
> pushed. The most interesting thing was how trivial it was: all I had to
> do was make a one-line change in how I called `begin-program'.
Great, thank you! I'll take a look soon.
A
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-05-23 7:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 20:19 CPS thoughts Andy Wingo
2013-05-21 3:21 ` Noah Lavine
2013-05-21 19:46 ` Andy Wingo
2013-05-22 4:33 ` Noah Lavine
2013-05-23 4:05 ` Noah Lavine
2013-05-23 7:20 ` Andy Wingo
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).