1.0.30.8: redo the recent FP optimizations in a better way
[sbcl.git] / src / compiler / info-functions.lisp
index 293b123..e67f1a2 100644 (file)
@@ -226,11 +226,13 @@ return NIL. Can be set with SETF when ENV is NIL."
     (variable
      (typecase x
        (symbol (values (info :variable :documentation x)))))
+    ;; FUNCTION is not used at the momemnt, just here for symmetry.
     (function
      (cond ((functionp x)
             (%fun-doc x))
-           ((legal-fun-name-p x)
-            (values (info :function :documentation x)))))
+           ((and (legal-fun-name-p x) (fboundp x))
+            (%fun-doc (or (and (symbolp x) (macro-function x))
+                          (fdefinition x))))))
     (structure
      (typecase x
        (symbol (cond
@@ -259,8 +261,12 @@ return NIL. Can be set with SETF when ENV is NIL."
   (case doc-type
     (variable (setf (info :variable :documentation name) string))
     (function
-     (when (legal-fun-name-p name)
-       (setf (info :function :documentation name) string)))
+     ;; KLUDGE: FDEFINITION isn't ready early enough during cold-init, so
+     ;; special case for symbols.
+     (if (symbolp name)
+         (setf (%fun-doc (symbol-function name)) string)
+         (when (legal-fun-name-p name)
+           (setf (%fun-doc (fdefinition name)) string))))
     (structure (cond
                  ((eq (info :type :kind name) :instance)
                   (setf (info :type :documentation name) string))