safe-for-space

Matthias Radestock <[email protected]>
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
There is a discussion going on in c.l.s. about "Proper Tail Recursion" 
that is related to the "space leaks" email I sent the other day.

SISC is properly tail recursive, but it's not safe-for-space. For it to 
be safe-for-space we'd need to ensure that when closures are created 
they only hang on to lexical references that they are referring to.

One way to achieve this is to copy these bindings into the new LE when a 
closure is created. Thus a closure's LE would no longer need to refer to 
the parent LE, allowing that to be gc-ed. This doesn't work when set! is 
used to mutate lexical bindings captured by closures. However, this can 
be detected by the compiler and resolved by boxing such lexical 
references. A new BoxedLexicalReferencExp would be emitted to access 
these lexicals.

I have no idea what the above would do to performance, but I think 
safe-for-spaceness would be a cool property to have, so it's worth a try.


Matthias.



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.