unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: William ML Leslie <william.leslie.ttg@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: CPS Update
Date: Tue, 26 Feb 2013 05:24:40 -0500	[thread overview]
Message-ID: <87obf71ifr.fsf@tines.lan> (raw)
In-Reply-To: <CAHgd1hHg8P--0RfHmO7Bt9LKBFC-LGqH128vA40zCcDyeHb=FQ@mail.gmail.com> (William ML Leslie's message of "Mon, 25 Feb 2013 15:54:57 +1100")

Hi William,

William ML Leslie <william.leslie.ttg@gmail.com> writes:
> On 23 February 2013 18:49, Mark H Weaver <mhw@netris.org> wrote:
>> William ML Leslie <william.leslie.ttg@gmail.com> writes:
>>> Recompiling every procedure that uses + when somebody binds it means
>>> compiling a lot of code that probably isn't going to be used.  More
>>> likely, if + has been inlined here, the compiler will have to emit a
>>> guard that checks inlining assumptions as the start of the let body.
>>
>> I'm afraid this isn't good enough.  Even if one ignores the possibility
>> of multiple threads, checks would have to be added not just at the start
>> of each let body, but also upon return from every procedure that might
>> rebind '+' or capture its continuation.  This includes all procedures
>> accessed through toplevel/module bindings.
>
> Not each let body, the let body in the example code.

Ah, sorry, I misunderstood you.

> Specifically, a guard needs to be placed whenever code with
> undetermined effect happens-before a 'call' to an inlined function.

Yes.  Thank you for expressing it much more clearly than I had.  I would
further refine it to "a guard needs to be placed whenever code that
might mutate an inlined variable happens-before the inlined variable
would have been referenced."

> That we are talking about happens-before means the possibility of
> runtime invalidation of code is limited not only by calls to functions
> of unknown effect, but also by usages of the variable.

You bring up an important point: that a happens-before relation can be
composed of an arbitrarily long chain of other relations.  This requires
more careful study.

>> Therefore, I repeat my initial assertion that this is a can of worms.
>
> Except that most dynamic compilers for imperative languages already do
> this (because it's a pretty common thing to need to do).

I didn't realize that this technique was so commonly implemented.
Nonetheless, I worry that this technique may not perform as well for
Scheme as for other languages.  The reason is that in Scheme, calls to
procedures of unknown effect are vastly more common than in other
languages, at least for Schemes that allow arbitrary variables such as
'+' to be mutated.

Thanks for your insights.

     Regards,
       Mark



  reply	other threads:[~2013-02-26 10:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-16  0:53 CPS Update Noah Lavine
2013-02-16  7:39 ` Stefan Israelsson Tampe
2013-02-16 16:29   ` Noah Lavine
2013-02-16 19:14     ` Mark H Weaver
2013-02-16 19:36       ` Noah Lavine
2013-02-16 21:18         ` Mark H Weaver
2013-02-19 15:51           ` Noah Lavine
2013-02-19 16:21             ` Mark H Weaver
2013-02-22  8:25               ` William ML Leslie
2013-02-23  7:49                 ` Mark H Weaver
2013-02-25  4:54                   ` William ML Leslie
2013-02-26 10:24                     ` Mark H Weaver [this message]
2013-02-19 17:29     ` Stefan Israelsson Tampe
2013-03-08 22:57 ` Noah Lavine
2013-03-09  8:31   ` Andy Wingo
2013-04-03 20:50     ` Noah Lavine

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=87obf71ifr.fsf@tines.lan \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    --cc=william.leslie.ttg@gmail.com \
    /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).