Simplify flo:update-environment!.
authorTaylor R Campbell <campbell@mumble.net>
Sat, 24 Aug 2019 04:32:50 +0000 (04:32 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Sat, 24 Aug 2019 04:41:04 +0000 (04:41 +0000)
Caller is interested in exceptions afterward, so it is not sensible
to deregister interest in the floating-point environment afterward.
If you really want that, surround it in flo:preserving-environment.

src/runtime/floenv.scm

index e24656d0c147c77aaa2c98346863b0fa04329aed..db188d25f2aea811283d2d5d01d6e42861cb6f71 100644 (file)
@@ -134,19 +134,9 @@ USA.
       ((ucode-primitive set-float-environment 1) fp-env)))
 
 (define (flo:update-environment! fp-env)
-  ;; Prevent thread-switching between when we notify the thread
-  ;; scheduler that the environment has changed and when we actually
-  ;; trigger the update, which must happen when the machine is in the
-  ;; *old* environment.
-  ;;
-  ;; XXX We could just disable preemption, but we'd have to do that
-  ;; in DYNAMIC-WIND in case UPDATE-FLOAT-ENVIRONMENT signals an
-  ;; error, and DYNAMIC-WIND is super-expensive.
-  (without-interrupts
-   (lambda ()
-     (set-thread-float-environment! (current-thread) (if fp-env #t #f))
-     ((ucode-primitive update-float-environment 1)
-      (or fp-env default-environment)))))
+  (use-floating-point-environment!)
+  ((ucode-primitive update-float-environment 1)
+   (or fp-env default-environment)))
 
 (define default-environment)