<div dir="ltr">Hi Marc,<div><br></div><div>Thank you very much for clarifying.</div><div><br></div><div>Three brief followup questions at the bottom (marked 1. 2. 3.).</div><div><br><div class="gmail_extra"><div class="gmail_quote">2017-09-18 23:55 GMT+08:00 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span>:</div><div class="gmail_quote">[..]</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_-4653600695868621402gmail-">> Also.. if I understand you right, there are cases when Gambit with auto-forcing enabled also would fail evaluating (abs (delay 0)) .<br><br></span>With --enable-auto-forcing, this case works only when abs is not inlined, in other words an actual function call to abs is performed (because the library definition correctly forces the argument).  This can be achieved in various ways, like (declare (not run-time-bindings abs)) or (declare (standard-bindings) (not inline-primitives abs)).<br><br>This needs to be fixed so that those declarations, which typically improve execution speed, can be used reliably in a system built with --enable-auto-forcing.<br></blockquote><div><br></div><div>Ahaa, so that is a limit that exists currently for --enable-auto-forcing . Thanks for pointing out!</div></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div>[..] </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Also, when using the default (declare (safe)) the compiler converts (car lst) into<br><br>    (if (##pair? lst) (##car lst) (car lst))<br><br>rather than the correct<br><br>    (let ((lst (##force lst)))<br>      (if (##pair? lst) (##car lst) (car lst)))</blockquote><div> </div><div>This was just another iteration of what you said already in the section above right?</div></div><div class="gmail_quote"><br></div><div class="gmail_quote"><div>[..]</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_-4653600695868621402gmail-">> > Would it be possible for me to disable this particular aspect of the auto-forcing, to get higher performance?<br>><br>> Currently auto-forcing only works in interpreted code.  So if your program does (f x) and (car y) and you compile that, then “f” will not be forced and “y” will not be forced if car is inlined, for example if you (declare (not safe)).  You can consider this a bug… to be fixed.<br><br></span>Actually this is not quite true… f will be forced in the call (f x) </blockquote><div><br></div><div>[also in compiled mode -  3. I interpret you to mean that here, that is correct, right?]</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">thanks to this definition in lib/_kernel.scm:<br><br>(define-prim (##apply-with-procedure-check oper args)<br>  (##declare (not interrupts-enabled))<br>  (macro-force-vars (oper)<br>    (if (##procedure? oper)<br>      (##apply oper args)<br>      (##raise-nonprocedure-operator<wbr>-exception oper args #f #f))))<br><span class="gmail-m_-4653600695868621402gmail-"><br></span></blockquote></div><div class="gmail_quote"><br></div><div class="gmail_quote">Wait, what does |##apply-with-procedure-check| actually do, in what situations is it invoked, is this run on all (f a1 a2 ...) with oper = f and args = (list a1 a2 ...) for any procedure call made anywhere, when compiling with (declare (safe))?</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">1. So if I just remove the |macro-force-vars| in there, |f| will not be forced in compiled mode?<br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">2. Just if it is possible, is there some easy way to make also |f| *not* be forced in compiled mode?</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Not forcing |f| ever, would be useful in situations where you use the auto-forcing only to force data structures but never any code.</div><div class="gmail_quote"><br></div><div class="gmail_quote">I hypothesize that this will provide significant speed increases.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Will test and benchmark following your next clarification.</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Thanks a lot!</div></div></div></div>