0.7.8.7:
[sbcl.git] / src / compiler / target-main.lisp
index 2b53bd4..23bfb23 100644 (file)
          (error "can't find a definition for ~S" definition-designator))
        definition)))
 
-;;; Find the function that is being compiled by COMPILE and bash its
-;;; name to NAME. We also substitute for any references to name so
-;;; that recursive calls will be compiled direct. LAMBDA is the
-;;; top-level lambda for the compilation. A REF for the real function
-;;; is the only thing in the top-level lambda other than the bind and
-;;; return, so it isn't too hard to find.
-(defun compile-fix-function-name (lambda name)
-  (declare (type clambda lambda) (type (or symbol cons) name))
-  (when name
-    (let ((fun (ref-leaf
-               (continuation-next
-                (node-cont (lambda-bind lambda))))))
-      (setf (leaf-name fun) name)
-      (let ((old (gethash name *free-functions*)))
-       (when old (substitute-leaf fun old)))
-      name)))
-
 ;;; Handle the nontrivial case of CL:COMPILE.
 (defun actually-compile (name definition)
   (with-compilation-values
             (*lexenv* (make-null-lexenv))
             (form (get-lambda-to-compile definition))
             (*source-info* (make-lisp-source-info form))
-            (*top-level-lambdas* ())
+            (*toplevel-lambdas* ())
             (*block-compile* nil)
             (*compiler-error-bailout*
-             #'(lambda ()
-                 (compiler-mumble
-                  "~2&fatal error, aborting compilation~%")
-                 (return-from actually-compile (values nil t nil))))
+             (lambda ()
+               (compiler-mumble
+                "~2&fatal error, aborting compilation~%")
+               (return-from actually-compile (values nil t nil))))
             (*current-path* nil)
             (*last-source-context* nil)
             (*last-original-source* nil)
@@ -93,7 +76,8 @@
                  :name name
                  :path '(original-source-start 0 0))))))
 
-(defun compile (name &optional (definition (fdefinition name)))
+(defun compile (name &optional (definition (or (macro-function name)
+                                              (fdefinition name))))
   #!+sb-doc
   "Coerce DEFINITION (by default, the function whose name is NAME)
   to a compiled function, returning (VALUES THING WARNINGS-P FAILURE-P),
          (values definition nil nil)
          (actually-compile name definition))
     (cond (name
-          (if (macro-function name)
+          (if (and (symbolp name)
+                    (macro-function name))
               (setf (macro-function name) compiled-definition)
               (setf (fdefinition name) compiled-definition))
           (values name warnings-p failure-p))