0.7.9.65:
[sbcl.git] / src / code / package.lisp
index 7c6fc3b..9d47baf 100644 (file)
 (sb!xc:defstruct (package-hashtable (:constructor %make-package-hashtable ())
                                    (:copier nil))
   ;; The g-vector of symbols.
-  ;; FIXME: could just be type SIMPLE-VECTOR, with REQUIRED-ARG
+  ;; FIXME: could just be type SIMPLE-VECTOR, with (MISSING-ARG) default
   (table nil :type (or simple-vector null))
   ;; The i-vector of pname hash values.
-  ;; FIXME: could just be type HASH-VECTOR, with REQUIRED-ARG
+  ;; FIXME: could just be type HASH-VECTOR, with (MISSING-ARG) default
   (hash nil :type (or hash-vector null))
   ;; The total number of entries allowed before resizing.
   ;;
@@ -56,8 +56,9 @@
 ;;; KLUDGE: We use DEF!STRUCT to define this not because we need to
 ;;; manipulate target package objects on the cross-compilation host,
 ;;; but only because its MAKE-LOAD-FORM function needs to be hooked
-;;; into the pre-CLOS DEF!STRUCT MAKE-LOAD-FORM system. The DEF!STRUCT
-;;; side-effect of defining a new PACKAGE type on the
+;;; into the pre-CLOS DEF!STRUCT MAKE-LOAD-FORM system so that we can
+;;; compile things like IN-PACKAGE in warm init before CLOS is set up.
+;;; The DEF!STRUCT side effect of defining a new PACKAGE type on the
 ;;; cross-compilation host is just a nuisance, and in order to avoid
 ;;; breaking the cross-compilation host, we need to work around it
 ;;; around by putting the new PACKAGE type (and the PACKAGEP predicate
   "DO-SYMBOLS (VAR [PACKAGE [RESULT-FORM]]) {DECLARATION}* {TAG | FORM}*
    Executes the FORMs at least once for each symbol accessible in the given
    PACKAGE with VAR bound to the current symbol."
-  (multiple-value-bind (body decls) body-decls
+  (multiple-value-bind (body decls) (parse-body body-decls nil)
     (let ((flet-name (gensym "DO-SYMBOLS-")))
       `(block nil
         (flet ((,flet-name (,var)
         (inherited-symbol-p (gensym))
         (BLOCK (gensym)))
     `(let* ((,these-packages ,package-list)
-           (,packages `,(mapcar #'(lambda (package)
-                                    (if (packagep package)
-                                        package
-                                        (find-package package)))
+           (,packages `,(mapcar (lambda (package)
+                                  (if (packagep package)
+                                      package
+                                      ;; Maybe FIND-PACKAGE-OR-DIE?
+                                      (or (find-package package)
+                                          (error 'simple-package-error
+                                                 ;; could be a character
+                                                 :name (string package)
+                                                 :format-control "~@<~S does not name a package ~:>"
+                                                 :format-arguments (list package)))))
                                 (if (consp ,these-packages)
                                     ,these-packages
                                     (list ,these-packages))))
            `(setf ,package-use-list (package-%use-list (car ,packages)))
            `(declare (ignore ,package-use-list)))
        (macrolet ((,init-macro (next-kind)
+        (declare (optimize (inhibit-warnings 3)))
         (let ((symbols (gensym)))
           `(progn
              (setf ,',kind ,next-kind)
                                    (car ,',packages))))
                     (when ,symbols
                       (setf ,',vector (package-hashtable-table ,symbols))
-                      (setf ,',hash-vector (package-hashtable-hash ,symbols)))))
+                      (setf ,',hash-vector
+                            (package-hashtable-hash ,symbols)))))
                 (:external
                  `(let ((,symbols (package-external-symbols
                                    (car ,',packages))))
           (flet ((,real-symbol-p (number)
                    (> number 1)))
             (macrolet ((,mname ()
+             (declare (optimize (inhibit-warnings 3)))
              `(block ,',BLOCK
                 (loop
                   (case ,',kind