0.pre7.126:
[sbcl.git] / src / compiler / generic / genesis.lisp
index 3204827..5b8b0a7 100644 (file)
@@ -12,7 +12,7 @@
 ;;;; for !COLD-INIT to be called at cold load time. !COLD-INIT is
 ;;;; responsible for explicitly initializing anything which has to be
 ;;;; initialized early before it transfers control to the ordinary
-;;;; top-level forms.
+;;;; top level forms.
 ;;;;
 ;;;; (In CMU CL, and in SBCL as of 0.6.9 anyway, functions not defined
 ;;;; by DEFUN aren't set up specially by GENESIS. In particular,
 (defstruct (gspace (:constructor %make-gspace)
                   (:copier nil))
   ;; name and identifier for this GSPACE
-  (name (required-argument) :type symbol :read-only t)
-  (identifier (required-argument) :type fixnum :read-only t)
+  (name (missing-arg) :type symbol :read-only t)
+  (identifier (missing-arg) :type fixnum :read-only t)
   ;; the word address where the data will be loaded
-  (word-address (required-argument) :type unsigned-byte :read-only t)
+  (word-address (missing-arg) :type unsigned-byte :read-only t)
   ;; the data themselves. (Note that in CMU CL this was a pair
   ;; of fields SAP and WORDS-ALLOCATED, but that wasn't very portable.)
   (bytes (make-array target-space-alignment :element-type '(unsigned-byte 8))
                                     (ash (descriptor-low des)
                                          (- 1 sb!vm:n-lowtag-bits)))))
               (format stream
-                      "for fixnum: ~D"
+                      "for fixnum: ~W"
                       (if (> unsigned #x1FFFFFFF)
                           (- unsigned #x40000000)
                           unsigned))))
 (defun make-fixnum-descriptor (num)
   (when (>= (integer-length num)
            (1+ (- sb!vm:n-word-bits sb!vm:n-lowtag-bits)))
-    (error "~D is too big for a fixnum." num))
+    (error "~W is too big for a fixnum." num))
   (make-random-descriptor (ash num (1- sb!vm:n-lowtag-bits))))
 
 (defun make-other-immediate-descriptor (data type)
        ((> index words)
         (unless (zerop (integer-length remainder))
           ;; FIXME: Shouldn't this be a fatal error?
-          (warn "~D words of ~D were written, but ~D bits were left over."
+          (warn "~W words of ~W were written, but ~W bits were left over."
                 words n remainder)))
       (let ((word (ldb (byte sb!vm:n-word-bits 0) remainder)))
        (write-wordindexed handle index
                              (descriptor-low *nil-descriptor*))))
        (unless (= offset-wanted offset-found)
          ;; FIXME: should be fatal
-         (warn "Offset from ~S to ~S is ~D, not ~D"
+         (warn "Offset from ~S to ~S is ~W, not ~W"
                symbol
                nil
                offset-found
 ;;; intern it.
 (defun finish-symbols ()
 
-  ;; FIXME: Why use SETQ (setting symbol value) instead of just using
-  ;; the function values for these things?? I.e. why do we need this
-  ;; section at all? Is it because all the FDEFINITION stuff gets in
-  ;; the way of reading function values and is too hairy to rely on at
-  ;; cold boot? FIXME: Most of these are in *STATIC-SYMBOLS* in
-  ;; parms.lisp, but %HANDLE-FUN-END-BREAKPOINT is not. Why?
-  ;; Explain.
+  ;; I think the point of setting these functions into SYMBOL-VALUEs
+  ;; here, instead of using SYMBOL-FUNCTION, is that in CMU CL
+  ;; SYMBOL-FUNCTION reduces to FDEFINITION, which is a pretty
+  ;; hairy operation (involving globaldb.lisp etc.) which we don't
+  ;; want to invoke early in cold init. -- WHN 2001-12-05
+  ;;
+  ;; FIXME: So OK, that's a reasonable reason to do something weird like
+  ;; this, but this is still a weird thing to do, and we should change
+  ;; the names to highlight that something weird is going on. Perhaps
+  ;; *MAYBE-GC-FUN*, *INTERNAL-ERROR-FUN*, *HANDLE-BREAKPOINT-FUN*,
+  ;; and *HANDLE-FUN-END-BREAKPOINT-FUN*...
   (macrolet ((frob (symbol)
               `(cold-set ',symbol
                          (cold-fdefinition-object (cold-intern ',symbol)))))
                    (warm-symbol cadr-des))))
           (#.sb!vm:other-pointer-lowtag
            (warm-symbol des)))))
-    (unless (legal-function-name-p result)
+    (unless (legal-fun-name-p result)
       (error "not a legal function name: ~S" result))
     result))
 
                                   sb!vm:word-shift))))
                         (#.sb!vm:closure-header-widetag
                          (make-random-descriptor
-                          (cold-foreign-symbol-address-as-integer "closure_tramp")))))
+                          (cold-foreign-symbol-address-as-integer
+                           "closure_tramp")))))
     fdefn))
 
 (defun initialize-static-fns ()
   (let ((*cold-fdefn-gspace* *static*))
-    (dolist (sym sb!vm:*static-functions*)
+    (dolist (sym sb!vm:*static-funs*)
       (let* ((fdefn (cold-fdefinition-object (cold-intern sym)))
             (offset (- (+ (- (descriptor-low fdefn)
                              sb!vm:other-pointer-lowtag)
                           (* sb!vm:fdefn-raw-addr-slot sb!vm:n-word-bytes))
                        (descriptor-low *nil-descriptor*)))
-            (desired (sb!vm:static-function-offset sym)))
+            (desired (sb!vm:static-fun-offset sym)))
        (unless (= offset desired)
          ;; FIXME: should be fatal
-         (warn "Offset from FDEFN ~S to ~S is ~D, not ~D."
+         (warn "Offset from FDEFN ~S to ~S is ~W, not ~W."
                sym nil offset desired))))))
 
 (defun list-all-fdefn-objects ()
   (let ((result *nil-descriptor*))
-    (maphash #'(lambda (key value)
-                (declare (ignore key))
-                (cold-push value result))
+    (maphash (lambda (key value)
+              (declare (ignore key))
+              (cold-push value result))
             *cold-fdefn-objects*)
     result))
 \f
                 (8 sb!vm:simple-array-unsigned-byte-8-widetag)
                 (16 sb!vm:simple-array-unsigned-byte-16-widetag)
                 (32 sb!vm:simple-array-unsigned-byte-32-widetag)
-                (t (error "losing element size: ~D" sizebits))))
+                (t (error "losing element size: ~W" sizebits))))
         (result (allocate-vector-object *dynamic* sizebits len type))
         (start (+ (descriptor-byte-offset result)
                   (ash sb!vm:vector-data-offset sb!vm:word-shift)))
         #!+sb-show
         (when *show-pre-fixup-code-p*
           (format *trace-output*
-                  "~&/raw code from code-fop ~D ~D:~%"
+                  "~&/raw code from code-fop ~W ~W:~%"
                   nconst
                   code-size)
           (do ((i start (+ i sb!vm:n-word-bytes)))
            (maybe-record-with-translated-name '("-START" "-END") 6)))))
     (setf constants
          (sort constants
-               #'(lambda (const1 const2)
-                   (if (= (second const1) (second const2))
+               (lambda (const1 const2)
+                 (if (= (second const1) (second const2))
                      (< (third const1) (third const2))
                      (< (second const1) (second const2))))))
     (let ((prev-priority (second (car constants))))
 
   ;; writing primitive object layouts
   (let ((structs (sort (copy-list sb!vm:*primitive-objects*) #'string<
-                      :key #'(lambda (obj)
-                               (symbol-name
-                                (sb!vm:primitive-object-name obj))))))
+                      :key (lambda (obj)
+                             (symbol-name
+                              (sb!vm:primitive-object-name obj))))))
     (format t "#ifndef LANGUAGE_ASSEMBLY~2%")
     (format t "#define LISPOBJ(x) ((lispobj)x)~2%")
     (dolist (obj structs)
     ;; in #define statements.
     (format t "#define ~A LISPOBJ(0x~X)~%"
            (nsubstitute #\_ #\-
-                        (remove-if #'(lambda (char)
-                                       (member char '(#\% #\* #\. #\!)))
+                        (remove-if (lambda (char)
+                                     (member char '(#\% #\* #\. #\!)))
                                    (symbol-name symbol)))
            (if *static*                ; if we ran GENESIS
              ;; We actually ran GENESIS, use the real value.
       (format t "#X~8,'0X: ~S~%" (cdr routine) (car routine)))
     (let ((funs nil)
          (undefs nil))
-      (maphash #'(lambda (name fdefn)
-                  (let ((fun (read-wordindexed fdefn
-                                               sb!vm:fdefn-fun-slot)))
-                    (if (= (descriptor-bits fun)
-                           (descriptor-bits *nil-descriptor*))
-                        (push name undefs)
-                        (let ((addr (read-wordindexed
-                                     fdefn sb!vm:fdefn-raw-addr-slot)))
-                          (push (cons name (descriptor-bits addr))
-                                funs)))))
+      (maphash (lambda (name fdefn)
+                (let ((fun (read-wordindexed fdefn
+                                             sb!vm:fdefn-fun-slot)))
+                  (if (= (descriptor-bits fun)
+                         (descriptor-bits *nil-descriptor*))
+                      (push name undefs)
+                      (let ((addr (read-wordindexed
+                                   fdefn sb!vm:fdefn-raw-addr-slot)))
+                        (push (cons name (descriptor-bits addr))
+                              funs)))))
               *cold-fdefn-objects*)
       (format t "~%~|~%initially defined functions:~2%")
       (setf funs (sort funs #'< :key #'cdr))
@@ -2705,26 +2710,16 @@ that they were called before the out-of-line definition is installed,
 as is fairly common for structure accessors.)
 initially undefined function references:~2%")
 
-      (setf undefs (sort undefs #'string< :key #'function-name-block-name))
+      (setf undefs (sort undefs #'string< :key #'fun-name-block-name))
       (dolist (name undefs)
-        (format t "~S" name)
-       ;; FIXME: This ACCESSOR-FOR stuff should go away when the
-       ;; code has stabilized. (It's only here to help me
-       ;; categorize the flood of undefined functions caused by
-       ;; completely rewriting the bootstrap process. Hopefully any
-       ;; future maintainers will mostly have small numbers of
-       ;; undefined functions..)
-       (let ((accessor-for (info :function :accessor-for name)))
-         (when accessor-for
-           (format t " (accessor for ~S)" accessor-for)))
-       (format t "~%")))
+        (format t "~S~%" name)))
 
     (format t "~%~|~%layout names:~2%")
     (collect ((stuff))
-      (maphash #'(lambda (name gorp)
-                   (declare (ignore name))
-                   (stuff (cons (descriptor-bits (car gorp))
-                                (cdr gorp))))
+      (maphash (lambda (name gorp)
+                 (declare (ignore name))
+                 (stuff (cons (descriptor-bits (car gorp))
+                              (cdr gorp))))
                *cold-layouts*)
       (dolist (x (sort (stuff) #'< :key #'car))
         (apply #'format t "~8,'0X: ~S[~D]~%~10T~S~%" x))))