mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MIT-Scheme-devel] R7RS and values.


From: Taylor R Campbell
Subject: Re: [MIT-Scheme-devel] R7RS and values.
Date: Thu, 3 Nov 2016 18:36:24 +0000

   Date: Thu, 3 Nov 2016 11:28:18 -0700
   From: Matt Birkholz <address@hidden>
   
   > From: Taylor R Campbell <address@hidden>
   > Date: Thu, 3 Nov 2016 16:10:34 +0000
   > 
   > and thereby avoid the closure altogether.  That's what the integration
   > you're deleting did.
   
   I see.  You assume values is integrated into the producer and the
   producer into the call-with-values form, an assumption that may often
   hold true in hotspots.  Or are you saying you know this is the case in
   tests/check.scm, thus the poor showing there?

I'm hypothesizing that scenario.  I haven't confirmed it.

It would be worthwhile to confirm what the change in performance comes
from.  20% is a huge change -- bigger, perhaps, than I saw when fixing
the static branch prediction of every procedure body's interrupt
check.  Did anything other than paths involving CALL-WITH-VALUES and
VALUES change?
   
   I might be breaking things (again!).  While I've removed our
   restriction on VALUES (that it and only it return to CALL-WITH-
   VALUES), I have also removed an "extension" that allowed e.g. cleanup-
   noop-nodes to pass along multiple values as if they were one.  It was
   not a documented extension, yet losing it will break unwary code.
   Perhaps just a mention in the release notes?
   
It has long been a bug and it's why I introduced BEGIN0, so that we
could prepare code to do the right thing before making the right thing
the only thing that works.

I would strongly advise that you make multi-value returns to
single-value continuations report an error.  Otherwise, you are
quietly changing the semantics of who knows how many continuations.

   +(define-integrable (apply-values transmitter receiver)
   +  (transmitter receiver))
   +
   +(define-integrable (return-3 v0 v1 v2)
   +  (lambda (receiver)
   +    (receiver v0 v1 v2)))
   address@hidden example
   +
   +With the above definitions, a form like
   +
   address@hidden
   +(apply-values (lambda () (return-3 1 2 3))
   +              (lambda (a b c)
   +                (foo a b)
   +                c))

Extra lambda here, or missing parens in APPLY-VALUES.  Either you need

(define-integrable (apply-values transmitter receiver)
  ((transmitter) receiver))

or the example should be

(apply-values (return-3 1 2 3) (lambda (a b c) ...)).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]