Commit ed5fdc52 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Tweak previous get-optimization-settings. Tests included.

parent f2298f1e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -312,3 +312,12 @@
  (assert-equal (multiple-value-list (ensure-gethash 3 h nil)) '(nil nil))
  (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 allegro ecl-bytecmp gcl mkcl)
(loop :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)))))))
+7 −5
Original line number Diff line number Diff line
@@ -62,12 +62,12 @@ This can help you produce more deterministic output for FASLs."))
    "Optimization settings saved by PROCLAIM-OPTIMIZATION-SETTINGS")
  (defparameter +optimization-variables+
    ;; TODO: allegro genera corman mcl
    (or #+(or abcl xcl) '(system::*speed* c::*space* c::*safety* c::*debug*)
        #+clisp '(system::*optimize*)
    (or #+(or abcl xcl) '(system::*speed* system::*space* system::*safety* system::*debug*)
        #+clisp '() ;; system::*optimize* is a constant hash-table! (with non-constant contents)
        #+clozure '(ccl::*nx-speed* ccl::*nx-space* ccl::*nx-safety*
                    ccl::*nx-debug* ccl::*nx-cspeed*)
        #+(or cmu scl) '(c::*default-cookie*)
        #+ecl '(c::*speed* c::*space* c::*safety* c::*debug*)
        #+ecl (unless (use-ecl-byte-compiler-p) '(c::*speed* c::*space* c::*safety* c::*debug*))
        #+gcl '(compiler::*speed* compiler::*space* compiler::*compiler-new-safety* compiler::*debug*)
        #+lispworks '(compiler::*optimization-level*)
        #+mkcl '(si::*speed* si::*space* si::*safety* si::*debug*)
@@ -81,10 +81,12 @@ This can help you produce more deterministic output for FASLs."))
    #+(or abcl clisp cmu ecl lispworks mkcl sbcl scl xcl)
    (let ((settings '(speed space safety debug compilation-speed #+(or cmu scl) c::brevity)))
      #.`(loop :for x :in settings
               ,@(or #+(or abcl ecl gcl mkcl xcl) '(:for v :in *optimization-variables*))
               ,@(or #+(or abcl ecl gcl mkcl xcl) '(:for v :in +optimization-variables+))
               :for y = (or #+clisp (gethash x system::*optimize*)
                            #+(or abcl ecl mkcl xcl) (symbol-value v)
                            #+(or cmu scl) (slot-value c::*default-cookie* x)
                            #+(or cmu scl) (slot-value c::*default-cookie*
                                                       (case x (compilation-speed 'c::cspeed)
                                                             (otherwise x)))
                            #+lispworks (slot-value compiler::*optimization-level* x)
                            #+sbcl (cdr (assoc x sb-c::*policy*)))
               :when y :collect (list x y))))