X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftarget-package.lisp;h=eff57513b56e3208daa281b057faf9a30e86ffc3;hb=6753b552e912fae737ef2ee2b9fbc59c265ea941;hp=ccaa5bbe8c0b2da277ae83b291544f08f6ae93cf;hpb=9152e162ab62d7027a4403fb9b461c31847649a2;p=sbcl.git diff --git a/src/code/target-package.lisp b/src/code/target-package.lisp index ccaa5bb..eff5751 100644 --- a/src/code/target-package.lisp +++ b/src/code/target-package.lisp @@ -61,9 +61,6 @@ (declare (function function)) ;; 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-graph-lock*) (funcall function))) @@ -75,7 +72,7 @@ (defmacro with-package-names ((names &key) &body body) `(let ((,names *package-names*)) - (with-locked-hash-table (,names) + (with-locked-system-table (,names) ,@body))) ;;;; PACKAGE-HASHTABLE stuff @@ -599,7 +596,7 @@ implementation it is ~S." *default-package-use-list*) (cerror "Clobber existing package." "A package named ~S already exists" name) (setf clobber t)) - (with-packages () + (with-package-graph () ;; Check for race, signal the error outside the lock. (when (and (not clobber) (find-package name)) (go :restart)) @@ -779,7 +776,7 @@ implementation it is ~S." *default-package-use-list*) ;;; If the symbol named by the first LENGTH characters of NAME doesn't exist, ;;; then create it, special-casing the keyword package. -(defun intern* (name length package) +(defun intern* (name length package &key no-copy) (declare (simple-string name)) (multiple-value-bind (symbol where) (find-symbol* name length package) (cond (where @@ -793,7 +790,18 @@ implementation it is ~S." *default-package-use-list*) (setf (values symbol where) (find-symbol* name length package)) (if where (values symbol where) - (let ((symbol-name (subseq name 0 length))) + (let ((symbol-name (cond (no-copy + (aver (= (length name) length)) + name) + (t + ;; This so that SUBSEQ is inlined, + ;; because we need it fixed for cold init. + (string-dispatch + ((simple-array base-char (*)) + (simple-array character (*))) + name + (declare (optimize speed)) + (subseq name 0 length)))))) (with-single-package-locked-error (:package package "interning ~A" symbol-name) (let ((symbol (make-symbol symbol-name))) @@ -967,8 +975,8 @@ uninterned." (remove symbol shadowing-symbols))) (multiple-value-bind (s w) (find-symbol name package) - (declare (ignore s)) - (cond ((or (eq w :internal) (eq w :external)) + (cond ((not (eq symbol s)) nil) + ((or (eq w :internal) (eq w :external)) (nuke-symbol (if (eq w :internal) (package-internal-symbols package) (package-external-symbols package))