<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>
Raymond Toy pushed to branch rtoy-15-handle-fpu-exceptions
at <a href="https://gitlab.common-lisp.net/cmucl/cmucl">cmucl / cmucl</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/da2ff74d54707ab52b4b61675ba5211673fbef3c">da2ff74d</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2016-01-10T14:13:10Z</i>
</div>
<pre class='commit-message'>Handle FPU exceptions better.

In sigfpe-handler, don't modify the modes; just use whatever they
are. (They should be the default values.)

In with-float-traps-*, actually just restore the floating-point mode
to the exact original mode instead of trying to mask things out.</pre>
</li>
</ul>
<h4>1 changed file:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/code/float-trap.lisp
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/commit/da2ff74d54707ab52b4b61675ba5211673fbef3c#diff-0'>
<strong>
src/code/float-trap.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/code/float-trap.lisp
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/code/float-trap.lisp
</span><span style="color: #aaaaaa">@@ -312,6 +312,8 @@
</span> ;;;
 ;;;    Signal the appropriate condition when we get a floating-point error.
 ;;;
<span style="color: #000000;background-color: #ddffdd">+#+nil
+(defvar *debug-sigfpe-handler* nil)
</span> (defun sigfpe-handler (signal code scp)
   (declare (ignore signal)
           (type system-area-pointer scp))
<span style="color: #aaaaaa">@@ -345,7 +347,7 @@
</span>        (alien:sap-alien scp (* unix:sigcontext)))
            new-modes))
 
<span style="color: #000000;background-color: #ffdddd">-    #+sse2
</span><span style="color: #000000;background-color: #ddffdd">+    #+nil
</span>     (let* ((new-modes modes)
           (new-exceptions (logandc2 (ldb float-exceptions-byte new-modes)
                                     traps)))
<span style="color: #aaaaaa">@@ -358,12 +360,13 @@
</span>       ;; in the sigcontext instead?  This however seems to do what we
       ;; want.
 
<span style="color: #000000;background-color: #ffdddd">-      (format *debug-io* "sigcontext modes: #x~4x (~A)~%"
-             modes (decode-floating-point-modes modes))
-      (format *debug-io* "current modes:    #x~4x (~A)~%"
-             (vm:floating-point-modes) (get-floating-point-modes))
-      (format *debug-io* "new  modes: #x~x (~A)~%"
-             new-modes (decode-floating-point-modes new-modes))
</span><span style="color: #000000;background-color: #ddffdd">+      (when *debug-sigfpe-handler*
+       (format *debug-io* "sigcontext modes: #x~4x (~A)~%"
+               modes (decode-floating-point-modes modes))
+       (format *debug-io* "current modes:    #x~4x (~A)~%"
+               (vm:floating-point-modes) (get-floating-point-modes))
+       (format *debug-io* "new  modes: #x~x (~A)~%"
+               new-modes (decode-floating-point-modes new-modes)))
</span>       #+nil
       (setf (vm:floating-point-modes) new-modes))
     
<span style="color: #aaaaaa">@@ -465,13 +468,20 @@
</span>                                        ,exception-mask)))
                          ,@body)
                     ;; Restore the original traps and exceptions.
<span style="color: #000000;background-color: #ddffdd">+                     (format *debug-io* "Saved fpu mode:   #x~4,'0x: ~S~%"
+                            ,orig-modes (decode-floating-point-modes ,orig-modes))
+                    (format *debug-io* "Current fpu mode: #x~4,'0x: ~S~%"
+                            (floating-point-modes) (get-floating-point-modes))
+                    #+nil
</span>                (setf (floating-point-modes)
                           (logior (logand ,orig-modes ,(logior traps exceptions))
<span style="color: #000000;background-color: #ffdddd">-                                   (logand (floating-point-modes)
</span><span style="color: #000000;background-color: #ddffdd">+                              (logand ,orig-modes
</span>                                      ,(logand trap-mask exception-mask)
                                           #+ppc
                                           ,invalid-mask
<span style="color: #000000;background-color: #ffdddd">-                                           #+mips ,(dpb 0 float-exceptions-byte #xffffffff))))))))))))
</span><span style="color: #000000;background-color: #ddffdd">+                                      #+mips ,(dpb 0 float-exceptions-byte #xffffffff))))
+                    (setf (floating-point-modes) ,orig-modes)
+                    ))))))))
</span> 
   ;; WITH-FLOAT-TRAPS-MASKED  --  Public
   (with-float-traps masked logand
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/da2ff74d54707ab52b4b61675ba5211673fbef3c">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.common-lisp.net.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.common-lisp.net/cmucl/cmucl/commit/da2ff74d54707ab52b4b61675ba5211673fbef3c"}}</script>
</p>
</div>
</body>
</html>