Skip to content
Snippets Groups Projects
Commit 6fb693a0 authored by Robert Goldman's avatar Robert Goldman
Browse files

Remove `with-optimization-settings`.

This macro is incorrectly implemented and, to date, unused.  So
I am removing it from UIOP.
parent f2ded940
No related branches found
No related tags found
No related merge requests found
......@@ -516,17 +516,69 @@
(assert-equal (multiple-value-list (gethash 3 h 4)) '(nil t))
(assert-equal (multiple-value-list (ensure-gethash 3 h 5)) '(nil t)))
(DBG :optimization-settings)
#-(or ecl-bytecmp gcl mkcl)
(loop :with settings = (get-optimization-settings)
:for i :from 0 :to 3 :do
(with-optimization-settings (`((speed ,i) (space ,i) (safety ,i) (debug ,i)))
(let ((s (get-optimization-settings)))
(loop :for q :in '(speed space safety debug) :do
#+mkcl (DBG :os i q s (assoc q s))
(assert-equal i (second (assoc q s))))))
;;; The order does not seem to be significant, should better test that all values are the same
(assert-equal (get-optimization-settings) settings))
;; (DBG :optimization-settings)
;; #-(or ecl-bytecmp gcl mkcl)
;; (loop :with settings = (get-optimization-settings)
;; :for i :from 0 :to 3 :do
;; (with-optimization-settings (`((speed ,i) (space ,i) (safety ,i) (debug ,i)))
;; (let ((s (get-optimization-settings)))
;; (loop :for q :in '(speed space safety debug) :do
;; #+mkcl (DBG :os i q s (assoc q s))
;; (assert-equal i (second (assoc q s))))))
;; ;;; The order does not seem to be significant, should better test that all values are the same
;; (assert-equal (get-optimization-settings) settings))
;; (let* ((new-optimization-settings
;; ;; pick something stupid, so likely to be distinct
;; '((SPEED 3) (SPACE 1) (SAFETY 2) (DEBUG 3) (COMPILATION-SPEED 3)))
;; (uiop:*optimization-settings* new-optimization-settings)
;; (expanded (macroexpand-1 '(uiop:with-optimization-settings (foo)))))
;; (assert-equal
;; ;; EXPECTED VALUE
;; #+ (or allegro clasp clisp)
;; (let* ((template
;; (let ((previous-settings (gensym "PREVIOUS-SETTINGS"))
;; (reset-settings (gensym "RESET-SETTINGS")))
;; `(let* ((,previous-settings (get-optimization-settings))
;; (,reset-settings #+clasp (reverse ,previous-settings) #-clasp ,previous-settings))
;; (proclaim '(optimize ,@new-optimization-settings))
;; (unwind-protect (progn (foo))
;; (proclaim '(optimize ,@reset-settings))))))
;; (previous-settings-var
;; (first ;previous-settings varname
;; (first ; previous-settings-binding
;; (second template))) ; let-bindings block
;; )
;; (reset-settings-var
;; (first ; varname
;; (second ; reset-settings-binding
;; (second template))) ; let-bindings block
;; ))
;; (subst 'previous-settings previous-settings-var
;; (subst 'reset-settings reset-settings-var
;; template))))
;; #-(or allegro clasp clisp)
;; `(let ,(loop :for v :in +optimization-variables+ :collect `(,v ,v))
;; (proclaim '(optimize ,@new-optimization-settings))
;; (foo))
;; ;; ACTUAL COMPUTED VALUE
;; #-(or allegro clasp clisp)
;; expanded
;; #+ (or allegro clasp clisp)
;; (let ((previous-settings-var
;; (first ;previous-settings varname
;; (first ; previous-settings-binding
;; (second expanded))) ; let-bindings block
;; )
;; (reset-settings-var
;; (first ; varname
;; (second ; reset-settings-binding
;; (second expanded))) ; let-bindings block
;; ))
;; (subst 'previous-settings previous-settings-var
;; (subst 'reset-settings reset-settings-var
;; expanded))))
(DBG :standard-case-symbol-name)
(if (or #+allegro (eq excl:*current-case-mode* :case-sensitive-lower))
......
......@@ -9,7 +9,8 @@
;; Variables
#:*compile-file-warnings-behaviour* #:*compile-file-failure-behaviour*
#:*output-translation-function*
#:*optimization-settings* #:*previous-optimization-settings*
;; the following dropped because unnecessary.
;; #:*optimization-settings* #:*previous-optimization-settings*
#:*base-build-directory*
#:compile-condition #:compile-file-error #:compile-warned-error #:compile-failed-error
#:compile-warned-warning #:compile-failed-warning
......@@ -19,7 +20,10 @@
;; Types
#+sbcl #:sb-grovel-unknown-constant-condition
;; Functions & Macros
#:get-optimization-settings #:proclaim-optimization-settings #:with-optimization-settings
;; the following three removed from UIOP because they have bugs, it's
;; easier to remove tham than to fix them, and they could never have been
;; used successfully in the wild. [2023/12/11:rpg]
;; #:get-optimization-settings #:proclaim-optimization-settings #:with-optimization-settings
#:call-with-muffled-compiler-conditions #:with-muffled-compiler-conditions
#:call-with-muffled-loader-conditions #:with-muffled-loader-conditions
#:reify-simple-sexp #:unreify-simple-sexp
......@@ -54,6 +58,7 @@ what more while the input-file is shortened if possible to ENOUGH-PATHNAME relat
This can help you produce more deterministic output for FASLs."))
;;; Optimization settings
#+ignore
(with-upgradability ()
(defvar *optimization-settings* nil
"Optimization settings to be used by PROCLAIM-OPTIMIZATION-SETTINGS")
......@@ -111,7 +116,7 @@ This can help you produce more deterministic output for FASLs."))
(proclaim `(optimize ,@,reset-settings)))))
#-(or allegro clasp clisp)
`(let ,(loop :for v :in +optimization-variables+ :collect `(,v ,v))
,@(when settings `((proclaim `(optimize ,@,settings))))
,@(when settings `((proclaim '(optimize ,@settings))))
,@body)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment