From: Rob Browning <rlb@defaultvalue.org>
Subject: expansion, memoization, and evaluation...
Date: Tue, 03 Dec 2002 20:41:47 -0600 [thread overview]
Message-ID: <87r8cyh5ec.fsf@raven.i.defaultvalue.org> (raw)
I thought it might be worthwhile if I made my support of Dirk's recent
work, and my current feelings about the related issues clear, though
I'm certainly ready and willing to change my position(s) if
appropriate.
ATM I'd really like to see guile make a clean separation between
stages of evaluation. Dirk has suggested perhaps four stages:
expansion (scheme->intermediate code)
compilation (intermediate->intermediate)
memoization-or-compilation (intermediate->{memoized,compiled})
execution
That arrangement seems like a pretty good initial goal, though I
realize that it may or may not end up being the "final arrangement".
ISTR that some people were concerned that having a separate expansion
stage might cause a performance loss. My current feeling is that
- if the performance hit is minimal, and will go away when we can
write/read pre-expanded (perhaps our first version of .scmc files
:>) code, then I'd be tempted to just ignore the loss. I feel
like the increased clarity of the process, and the potential for
optimizations/plugging in other compilers, etc. will be likely to
outweigh the loss.
Also note that if we have a point where it's easy to get access to
the post-expansion, but pre-memoization code, it becomes *much*
easier to add strong, offline compilation to guile. As an
example, my impression is that one of hobbit's biggest issues has
been dealing with macros (define-macro vs defmacro vs syncase).
If hobbit can be handed the pre-expanded code, it can completely
ignore macros.
- if the performance hit is not minimal, but if it's not all that
hard to add a #define SCM_I_BUILD_WITH_SEPARATE_EXPANSION_STEP,
then perhaps that would be a good approach for the short term --
you'd only enable that option if you were experimenting, if you
were a guile offline compiler, or if you had finally finished a
compiler whose performance improvements dwarfed the "separate step
performance loss".
Ideally we'll pick up more than enough performance improvements
elsewhere, given a cleaner infrastructure for people to hack on
(i.e. one that's approachable by more people) to outweigh the
performance loss that having separate evaluation stages might entail.
Another thing I'd like to suggest is that when considering things like
whether or not we should have unmemoization, first-class macros, etc.,
we consider how these things might affect an offline compiler. If
nothing else, we may not want to structure guile in such a way that we
provide mechanisms that preclude the code from ever being able to be
compiled offline. Part of the answer is to use eval-when (or
eval-case) appropriately.
Also, though we can structure guile's macros (and other things) to be
arbitrarily dynamic, that doesn't mean we should. Aside from the
performance costs involved, I feel like we ought to keep an eye on how
our choices affect both the comprehensibility of our implementation
and the scheme code that the end-user may write.
WRT macros, my general impression is that unless you are very clear
about the semantics of your macro system and your evaluation process,
and unless you're reasonably strict in what you allow, you're likely
to preclude much serious compilation because the compiler won't have
the assurances it needs in order to be able to make many substantial
optimizations. i.e. if you're not careful you can end up with the
compiler having to just convert
(foo bar baz)
into
(eval '(foo bar baz))
or similar, far more often than you'd like, because the compiler can't
be "sure enough" about foo, bar, or baz.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next reply other threads:[~2002-12-04 2:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-04 2:41 Rob Browning [this message]
2002-12-04 2:57 ` expansion, memoization, and evaluation Mikael Djurfeldt
2002-12-04 3:10 ` Rob Browning
2002-12-04 3:31 ` Mikael Djurfeldt
2002-12-04 4:07 ` Rob Browning
2002-12-04 7:07 ` Mikael Djurfeldt
2002-12-04 21:11 ` Rob Browning
2002-12-04 21:47 ` Mikael Djurfeldt
2002-12-05 0:07 ` Rob Browning
2002-12-05 16:27 ` Marius Vollmer
2002-12-05 17:07 ` Rob Browning
2002-12-04 8:09 ` klaus schilling
2002-12-04 10:55 ` Mikael Djurfeldt
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=87r8cyh5ec.fsf@raven.i.defaultvalue.org \
--to=rlb@defaultvalue.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).