From: Andy Wingo <wingo@pobox.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-devel <guile-devel@gnu.org>,
Neil Jerram <neil@ossau.uklinux.net>, Daniel Kraft <d@domob.eu>,
Ken Raeburn <raeburn@raeburn.org>
Subject: Re: Elisp lexical-let
Date: Thu, 23 Jul 2009 22:53:22 +0200 [thread overview]
Message-ID: <m33a8ni0jh.fsf@pobox.com> (raw)
In-Reply-To: <20090723161313.GA1405@fibril.netris.org> (Mark H. Weaver's message of "Thu, 23 Jul 2009 12:13:13 -0400")
Hi,
Just for the record :)
On Thu 23 Jul 2009 18:13, Mark H Weaver <mhw@netris.org> writes:
> On Thu, Jul 23, 2009 at 05:24:30PM +0200, Marijn Schouten (hkBst) wrote:
>> For the calls above all the dynamic accesses can be determined statically.
>> Lexical accesses can always be determined statically. Thus all accesses in this
>> example can be determined statically and can be compiled to a location
>> dereference (either read or write). Nothing in the semantics is inherently
>> inefficient.
>
> There is at least one inherent loss of efficiency with the semantics
> you propose: with a lexical-let binding, the compiler can determine
> statically whether the variable is non-mutable, because the only place
> it could possibly be set! is within the lexical scope. Non-mutable
> variables can safely be inlined, an especially important optimization,
> especially if the value is a procedure.
Guile does detect this. The useful optimization is that variables that
are never set! can be allocated on the stack, and if they're closed
over, they can simply be copied.
> Also, with lexical-let, the compiler knows statically the entire set
> of references, which can be helpful with many analyses, for example
> whether continuations or closures can "escape" a particular scope,
> whether a particular continuation might be invoked more than once,
> etc.
This is a more tricky optimization :)
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2009-07-23 20:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-21 19:48 Elisp lexical-let Daniel Kraft
2009-07-21 21:46 ` Ken Raeburn
2009-07-22 9:11 ` Daniel Kraft
2009-07-22 13:00 ` Marijn Schouten (hkBst)
2009-07-22 19:24 ` Daniel Kraft
2009-07-23 15:24 ` Marijn Schouten (hkBst)
2009-07-23 16:13 ` Mark H Weaver
2009-07-23 20:53 ` Andy Wingo [this message]
2009-07-23 17:05 ` Daniel Kraft
2009-07-24 11:09 ` Marijn Schouten (hkBst)
2009-07-22 20:50 ` Ken Raeburn
2009-07-23 10:47 ` Daniel Kraft
2009-07-23 20:56 ` Andy Wingo
2009-07-24 6:50 ` Daniel Kraft
2009-07-23 20:49 ` Andy Wingo
2009-07-23 22:39 ` Andy Wingo
2009-07-24 7:08 ` Daniel Kraft
2009-07-24 11:42 ` Andy Wingo
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=m33a8ni0jh.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=d@domob.eu \
--cc=guile-devel@gnu.org \
--cc=mhw@netris.org \
--cc=neil@ossau.uklinux.net \
--cc=raeburn@raeburn.org \
/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).