From 4f24a2734e4c714c0ede097770f9859b8f8c0d5c Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Sat, 16 Mar 2013 16:09:03 +0400 Subject: [PATCH] Reduce consing for find-package. Don't use return-from inside restart-case, it causes consing even when the branch with restart-case is not taken. --- src/code/target-package.lisp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/code/target-package.lisp b/src/code/target-package.lisp index fd1dffe..7a06e73 100644 --- a/src/code/target-package.lisp +++ b/src/code/target-package.lisp @@ -579,19 +579,18 @@ REMOVE-PACKAGE-LOCAL-NICKNAME, and the DEFPACKAGE option :LOCAL-NICKNAMES." (nicknamed (when nicknames (cdr (assoc string nicknames :test #'string=)))) (packageoid (or nicknamed (gethash string *package-names*)))) - (when (and (null packageoid) - (not *in-package-init*) ; KLUDGE - (let ((mismatch (mismatch "SB!" string))) - (and mismatch (= mismatch 3)))) - (restart-case - (signal 'bootstrap-package-not-found :name string) - (debootstrap-package () - (return-from find-package-using-package + (if (and (null packageoid) + (not *in-package-init*) ; KLUDGE + (let ((mismatch (mismatch "SB!" string))) + (and mismatch (= mismatch 3)))) + (restart-case + (signal 'bootstrap-package-not-found :name string) + (debootstrap-package () (if (string= string "SB!XC") (find-package "COMMON-LISP") (find-package - (substitute #\- #\! string :count 1))))))) - packageoid))) + (substitute #\- #\! string :count 1))))) + packageoid)))) (typecase package-designator (package package-designator) (symbol (find-package-from-string (symbol-name package-designator))) -- 1.7.10.4