X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-package.lisp;h=01ed836da5c3cce40af70b9e4f4276737a9e2447;hb=a160917364f85b38dc0826a5e3dcef87e3c4c62c;hp=e92c43f41ac587dd1ac90d90ff54fff9ae20663c;hpb=56fd7d95cfadb61a353e8999111a0e2e6a94842b;p=sbcl.git diff --git a/src/code/target-package.lisp b/src/code/target-package.lisp index e92c43f..01ed836 100644 --- a/src/code/target-package.lisp +++ b/src/code/target-package.lisp @@ -51,10 +51,15 @@ (defvar *package-lock*) (!cold-init-forms - (setf *package-lock* (sb!thread::make-spinlock :name "Package Lock"))) + (setf *package-lock* (sb!thread:make-mutex :name "Package Lock"))) (defmacro with-packages ((&key) &body forms) - `(sb!thread::with-recursive-spinlock (*package-lock*) + ;; FIXME: Since name conflicts can be signalled while holding the + ;; mutex, user code can be run leading to lock ordering problems. + ;; + ;; This used to be a spinlock, but there it can be held for a long + ;; time while the debugger waits for user input. + `(sb!thread:with-recursive-lock (*package-lock*) ,@forms)) ;;; Make a package hashtable having a prime number of entries at least @@ -469,10 +474,10 @@ error if any of PACKAGES is not a valid package designator." `(let* ((,vec (package-hashtable-table ,table)) (,hash (package-hashtable-hash ,table)) (,len (length ,vec)) - (,h2 (1+ (the index (rem (the index ,sxhash) + (,h2 (1+ (the index (rem (the hash ,sxhash) (the index (- ,len 2))))))) (declare (type index ,len ,h2)) - (prog ((,index-var (rem (the index ,sxhash) ,len)) + (prog ((,index-var (rem (the hash ,sxhash) ,len)) ,symbol-var ,ehash) (declare (type (or index null) ,index-var)) LOOP @@ -503,7 +508,8 @@ error if any of PACKAGES is not a valid package designator." (let* ((length (length string)) (hash (%sxhash-simple-string string)) (ehash (entry-hash length hash))) - (declare (type index length hash)) + (declare (type index length) + (type hash hash)) (with-symbol (index symbol table string length hash ehash) (setf (aref (package-hashtable-hash table) index) 1) (setf (aref (package-hashtable-table table) index) nil) @@ -763,7 +769,7 @@ implementation it is ~S." *default-package-use-list*) (type index length)) (let* ((hash (%sxhash-simple-substring string length)) (ehash (entry-hash length hash))) - (declare (type index hash ehash)) + (declare (type hash hash ehash)) (with-symbol (found symbol (package-internal-symbols package) string length hash ehash) (when found @@ -802,7 +808,8 @@ implementation it is ~S." *default-package-use-list*) (let* ((length (length string)) (hash (%sxhash-simple-string string)) (ehash (entry-hash length hash))) - (declare (type index length hash)) + (declare (type index length) + (type hash hash)) (with-symbol (found symbol (package-external-symbols package) string length hash ehash) (values symbol found)))) @@ -883,7 +890,7 @@ implementation it is ~S." *default-package-use-list*) (if (eq package-symbol chosen-symbol) nil ; re-importing the same symbol (shadowing-import (list chosen-symbol) package)) - (shadowing-import chosen-symbol package))))))))) + (shadowing-import (list chosen-symbol) package))))))))) ;;; If we are uninterning a shadowing symbol, then a name conflict can ;;; result, otherwise just nuke the symbol.