diff --git a/asdf.asd b/asdf.asd
index d14349255b78c7f2da4fd941b2255e673d3fd06a..594b782bb80b219d11006faca7b11a4c34fdc669 100644
--- a/asdf.asd
+++ b/asdf.asd
@@ -75,7 +75,7 @@
   :licence "MIT"
   :description "Another System Definition Facility"
   :long-description "ASDF builds Common Lisp software organized into defined systems."
-  :version "3.1.0.108" ;; to be automatically updated by make bump-version
+  :version "3.1.0.111" ;; to be automatically updated by make bump-version
   :depends-on ()
   #+asdf3 :encoding #+asdf3 :utf-8
   :class #.(if (find-class 'package-system nil) 'package-system 'system)
diff --git a/header.lisp b/header.lisp
index 543e2b0324b970395ac44410cf1c54bea6b503df..c7a90825b31f7ed6114bedb3a6b4d18122bb3bd2 100644
--- a/header.lisp
+++ b/header.lisp
@@ -1,5 +1,5 @@
 ;;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp ; buffer-read-only: t; -*-
-;;; This is ASDF 3.1.0.108: Another System Definition Facility.
+;;; This is ASDF 3.1.0.111: Another System Definition Facility.
 ;;;
 ;;; Feedback, bug reports, and patches are all welcome:
 ;;; please mail to <asdf-devel@common-lisp.net>.
diff --git a/test/test-utilities.script b/test/test-utilities.script
index dae08789b5ec27aa65b9d9f759ec6e57d5e55c0e..3c5677f17fbbea13987992287dc5fea288c90ee9 100644
--- a/test/test-utilities.script
+++ b/test/test-utilities.script
@@ -312,3 +312,14 @@
   (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 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))))))
+        (assert-equal (get-optimization-settings) settings))
diff --git a/uiop/lisp-build.lisp b/uiop/lisp-build.lisp
index 350424896eaab24fee721468de070954583b91bb..6b105a4442a8b59932fcfb472e03a5eecbe34de0 100644
--- a/uiop/lisp-build.lisp
+++ b/uiop/lisp-build.lisp
@@ -62,29 +62,34 @@ 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*)
         #+sbcl '(sb-c::*policy*)))
   (defun get-optimization-settings ()
     "Get current compiler optimization settings, ready to PROCLAIM again"
-    #-(or abcl clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
+    #-(or abcl allegro clisp clozure cmu ecl lispworks mkcl sbcl scl xcl)
     (warn "~S does not support ~S. Please help me fix that."
           'get-optimization-settings (implementation-type))
-    #+clozure (ccl:declaration-information 'optimize nil)
-    #+(or abcl clisp cmu ecl lispworks mkcl sbcl scl xcl)
+    #+(or abcl allegro clisp clozure 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*))
-               :for y = (or #+clisp (gethash x system::*optimize*)
+      #.`(loop #+(or allegro clozure)
+               ,@'(:with info = #+allegro (sys:declaration-information 'optimize)
+                   #+clozure (ccl:declaration-information 'optimize nil))
+               :for x :in settings
+               ,@(or #+(or abcl ecl gcl mkcl xcl) '(:for v :in +optimization-variables+))
+               :for y = (or #+(or allegro clozure) (second (assoc x info)) ; normalize order
+                            #+clisp (gethash x system::*optimize* 1)
                             #+(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))))
@@ -95,6 +100,13 @@ This can help you produce more deterministic output for FASLs."))
       (unless (equal *previous-optimization-settings* settings)
         (setf *previous-optimization-settings* settings))))
   (defmacro with-optimization-settings ((&optional (settings *optimization-settings*)) &body body)
+    #+(or allegro clisp)
+    (let ((previous-settings (gensym "PREVIOUS-SETTINGS")))
+      `(let ((,previous-settings (get-optimization-settings)))
+         ,@(when settings `((proclaim `(optimize ,@,settings))))
+         (unwind-protect (progn ,@body)
+           (proclaim `(optimize ,@,previous-settings)))))
+    #-(or allegro clisp)
     `(let ,(loop :for v :in +optimization-variables+ :collect `(,v ,v))
        ,@(when settings `((proclaim `(optimize ,@,settings))))
        ,@body)))
diff --git a/upgrade.lisp b/upgrade.lisp
index b19cea08d3c662d1946f58601100fec6149afea0..9b9ea33e5111b4fe952e8d94f8ab3668fa7f9107 100644
--- a/upgrade.lisp
+++ b/upgrade.lisp
@@ -67,7 +67,7 @@ previously-loaded version of ASDF."
          ;; "3.4.5.67" would be a development version in the official branch, on top of 3.4.5.
          ;; "3.4.5.0.8" would be your eighth local modification of official release 3.4.5
          ;; "3.4.5.67.8" would be your eighth local modification of development version 3.4.5.67
-         (asdf-version "3.1.0.108")
+         (asdf-version "3.1.0.111")
          (existing-version (asdf-version)))
     (setf *asdf-version* asdf-version)
     (when (and existing-version (not (equal asdf-version existing-version)))
diff --git a/version.lisp-expr b/version.lisp-expr
index 409ab742649e7aebca459072b7936a501939d411..eda3f6c3aec09d61b02b6f44ffb0a0f3dc1a4d36 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -1,2 +1,2 @@
-"3.1.0.108"
+"3.1.0.111"