Raymond Toy pushed to branch issue-355-solaris-x86-fp-trap-handler at cmucl / cmucl
Commits: 6e8d4939 by Raymond Toy at 2024-08-28T07:32:02-07:00 Oops. Change `case` to `cond`
Forgot that `case` works with symbols, not numbers. Use `cond` instead.
Also enable the debugging print, for now.
- - - - - 72af1c16 by Raymond Toy at 2024-08-28T08:38:53-07:00 For Solaris/x86, just use the sse2 mode bits.
Do the same as darwin and only use the sse2 mode bits when setting and getting the floating point modes.
This takes care of the case when trying to restart after doing `(* 1d300 1d300)`. This used to signal the overflow again. Now it doesn't.
- - - - - 90b41bd3 by Raymond Toy at 2024-08-28T08:44:46-07:00 Fix a reader-conditional and add comments.
Also comment out debugging prints.
- - - - -
1 changed file:
- src/code/float-trap.lisp
Changes:
===================================== src/code/float-trap.lisp ===================================== @@ -92,7 +92,7 @@ (setf (x87-floating-point-modes) x87-modes))) )
-#+(and sse2 (not darwin)) +#+(and sse2 (not (or solaris darwin))) (progn (defun floating-point-modes () ;; Combine the modes from the FPU and SSE2 units. Since the sse @@ -126,7 +126,10 @@ new-mode) )
-#+(and sse2 darwin) +;; For Darwin and Solaris/x86, only diddle the SSE2 mode bits. Darwin +;; doesn't use x87. Not sure about Solaris/x86, but this works better +;; than mixing the x87 and sse2 mode bits. +#+(and sse2 (or solaris darwin)) (progn (defun floating-point-modes () ;; Get just the SSE2 mode bits. @@ -456,6 +459,9 @@ (defconstant +fpe-fltden+ 9 "Signal code for FP denormalize"))
+;; SIGFPE handler for Solaris/x86. For this OS, the CODE contains the +;; information about what caused the SIGFPE signal, so use that to +;; determine the reason for the SIGFPE. #+(and solaris x86) (defun sigfpe-handler (signal code scp) (declare (ignore signal) @@ -477,28 +483,28 @@ ;; from the signal handler so the sigcontext is never restored. ;; This means we need to restore the fpu state ourselves. (unwind-protect - (case code - (+fpe-fltdiv+ + (cond + ((= code +fpe-fltdiv+) (error 'division-by-zero :operation fop :operands operands)) - (+fpe-fltovf+ + ((= code +fpe-fltovf+) (error 'floating-point-overflow :operation fop :operands operands)) - (+fpe-fltund+ + ((= code +fpe-fltund+) (error 'floating-point-underflow :operation fop :operands operands)) - (+fpe-fltres+ + ((= code +fpe-fltres+) (error 'floating-point-inexact :operation fop :operands operands)) - (+fpe-fltinv+ + ((= code +fpe-fltinv+) (error 'floating-point-invalid-operation :operation fop :operands operands)) - (+fpe-fltden+ + ((= code +fpe-fltden+) (error 'floating-point-denormal-operand :operation fop :operands operands))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/f5f65ff51a6afb81fd5c971...