From: Taylor R Campbell Date: Fri, 30 Nov 2018 07:59:04 +0000 (+0000) Subject: Don't futz with floenv if not in use. X-Git-Tag: mit-scheme-pucked-10.1.7~3^2~90 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=463e347fa399f3e3635dc17350727fe228727c28;p=mit-scheme.git Don't futz with floenv if not in use. Makes flo:raise-exceptions! kosher to use anywhere without incurring cost in threads that don't care. --- diff --git a/src/runtime/floenv.scm b/src/runtime/floenv.scm index d4d478ee3..37f8bab08 100644 --- a/src/runtime/floenv.scm +++ b/src/runtime/floenv.scm @@ -102,7 +102,10 @@ USA. ((ucode-primitive float-environment 0)) fp-env)))) -(define (use-floating-point-environment!) +(define-integrable (using-floating-point-environment?) + (and (thread-float-environment (current-thread)) #t)) + +(define-integrable (use-floating-point-environment!) (set-thread-float-environment! (current-thread) #t)) (define (flo:environment) @@ -243,12 +246,12 @@ USA. (flo:trappable-exceptions trappable-float-exceptions 0)) (define (flo:clear-exceptions! exceptions) - (use-floating-point-environment!) - ((ucode-primitive clear-float-exceptions 1) exceptions)) + (if (using-floating-point-environment?) + ((ucode-primitive clear-float-exceptions 1) exceptions))) (define (flo:raise-exceptions! exceptions) - (use-floating-point-environment!) - ((ucode-primitive raise-float-exceptions 1) exceptions)) + (if (using-floating-point-environment?) + ((ucode-primitive raise-float-exceptions 1) exceptions))) (define (flo:restore-exception-flags! fexcept exceptions) (use-floating-point-environment!)