Commit 3c5cd3c3 authored by Robert Goldman's avatar Robert Goldman
Browse files

Remove optimization-settings variables, functions and macros.

Remove GET-OPTIMIZATION-SETTINGS, PROCLAIM-OPTIMIZATION-SETTINGS, and
WITH-OPTIMIZATION-SETTINGS.  Also remove *OPTIMIZATION-SETTINGS*
and *PREVIOUS-OPTIMIZATION-SETTINGS*.

When I added tests for these in an attempt to fix issue !148, I found
that these had never worked, and were nowhere exercised.

Experimenting with removing them -- this might not work in upgrade.
parent ce57f7c9
Loading
Loading
Loading
Loading
+63 −11
Changes for test/test-utilities.script: 63 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -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))
+7 −2
Changes for uiop/lisp-build.lisp: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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")