0.pre7.117:
[sbcl.git] / src / compiler / main.lisp
index 84e9f86..3f6b95e 100644 (file)
              (when (and warnings (> undefined-warning-count warn-count))
                (let ((more (- undefined-warning-count warn-count)))
                  (compiler-style-warning
-                  "~D more use~:P of undefined ~(~A~) ~S"
+                  "~W more use~:P of undefined ~(~A~) ~S"
                   more kind name))))))
        
        (dolist (kind '(:variable :function :type))
     (format *error-output* "~&")
     (pprint-logical-block (*error-output* nil :per-line-prefix "; ")
       (compiler-mumble "compilation unit ~:[finished~;aborted~]~
-                       ~[~:;~:*~&  caught ~D fatal ERROR condition~:P~]~
-                       ~[~:;~:*~&  caught ~D ERROR condition~:P~]~
-                       ~[~:;~:*~&  caught ~D WARNING condition~:P~]~
-                       ~[~:;~:*~&  caught ~D STYLE-WARNING condition~:P~]~
-                       ~[~:;~:*~&  printed ~D note~:P~]"
+                       ~[~:;~:*~&  caught ~W fatal ERROR condition~:P~]~
+                       ~[~:;~:*~&  caught ~W ERROR condition~:P~]~
+                       ~[~:;~:*~&  caught ~W WARNING condition~:P~]~
+                       ~[~:;~:*~&  caught ~W STYLE-WARNING condition~:P~]~
+                       ~[~:;~:*~&  printed ~W note~:P~]"
                       abort-p
                       *aborted-compilation-unit-count*
                       *compiler-error-count*
 ;;; Do all the IR1 phases for a non-top-level component.
 (defun ir1-phases (component)
   (declare (type component component))
+  (aver-live-component component)
   (let ((*constraint-number* 0)
        (loop-count 1)
         (*delayed-ir1-transforms* nil))
        (constraint-propagate component))
       (when (retry-delayed-ir1-transforms :constraint)
         (maybe-mumble "Rtran "))
-      ;; Delay the generation of type checks until the type
-      ;; constraints have had time to propagate, else the compiler can
-      ;; confuse itself.
-      (unless (and (or (component-reoptimize component)
-                      (component-reanalyze component)
-                      (component-new-funs component)
-                      (component-reanalyze-funs component))
-                  (< loop-count (- *reoptimize-after-type-check-max* 4)))
-        (maybe-mumble "type ")
-       (generate-type-checks component)
-       (unless (or (component-reoptimize component)
-                   (component-reanalyze component)
-                   (component-new-funs component)
-                   (component-reanalyze-funs component))
-         (return)))
+      (flet ((want-reoptimization-p ()
+              (or (component-reoptimize component)
+                  (component-reanalyze component)
+                  (component-new-funs component)
+                  (component-reanalyze-funs component))))
+       (unless (and (want-reoptimization-p)
+                    ;; We delay the generation of type checks until
+                    ;; the type constraints have had time to
+                    ;; propagate, else the compiler can confuse itself.
+                    (< loop-count (- *reoptimize-after-type-check-max* 4)))
+         (maybe-mumble "type ")
+         (generate-type-checks component)
+         (unless (want-reoptimization-p)
+           (return))))
       (when (>= loop-count *reoptimize-after-type-check-max*)
        (maybe-mumble "[reoptimize limit]")
        (event reoptimize-maxed-out)
              (null))))))
 
   ;; We're done, so don't bother keeping anything around.
-  (setf (component-info component) nil)
+  (setf (component-info component) :dead)
 
   (values))
 
       (:toplevel (return))
       (:external
        (unless (every (lambda (ref)
-                       (eq (block-component (node-block ref))
-                           component))
+                       (eq (node-component ref) component))
                      (leaf-refs fun))
         (return))))))
 
 (defun compile-component (component)
+
+  ;; miscellaneous sanity checks
+  ;;
+  ;; FIXME: These are basically pretty wimpy compared to the checks done
+  ;; by the old CHECK-IR1-CONSISTENCY code. It would be really nice to
+  ;; make those internal consistency checks work again and use them.
+  (aver-live-component component)
+  (do-blocks (block component)
+    (aver (eql (block-component block) component)))
+  (dolist (lambda (component-lambdas component))
+    ;; sanity check to prevent weirdness from propagating insidiously as
+    ;; far from its root cause as it did in bug 138: Make sure that
+    ;; thing-to-COMPONENT links are consistent.
+    (aver (eql (lambda-component lambda) component))
+    (aver (eql (node-component (lambda-bind lambda)) component)))
+
   (let* ((*component-being-compiled* component))
     (when sb!xc:*compile-print*
       (compiler-mumble "~&; compiling ~A: " (component-name component)))
                                    (delete-if #'here-p (basic-var-sets v))))))
                      x))
           (here-p (x)
-            (eq (block-component (node-block x)) component)))
+            (eq (node-component x) component)))
     (blast *free-variables*)
     (blast *free-functions*)
     (blast *constants*))
     (setf (component-name component)
          (debug-namify "~S initial component" name))
     (setf (component-kind component) :initial)
-    (let* ((locall-fun (ir1-convert-lambda definition
-                                          :debug-name (debug-namify
-                                                       "top level locall ~S"
-                                                       name)))
+    (let* ((locall-fun (ir1-convert-lambda
+                       definition
+                       :debug-name (debug-namify "top level local call ~S"
+                                                 name)))
            (fun (ir1-convert-lambda (make-xep-lambda-expression locall-fun)
                                    :source-name (or name '.anonymous.)
                                    :debug-name (unless name
   (let ((lambda (compile-load-time-stuff `(progn ,@forms) name nil)))
     (fasl-dump-toplevel-lambda-call lambda *compile-object*)))
 
-;;; Does the actual work of COMPILE-LOAD-TIME-VALUE or
-;;; COMPILE-MAKE-LOAD-FORM- INIT-FORMS.
+;;; Do the actual work of COMPILE-LOAD-TIME-VALUE or
+;;; COMPILE-MAKE-LOAD-FORM-INIT-FORMS.
 (defun compile-load-time-stuff (form name for-value)
   (with-ir1-namespace
    (let* ((*lexenv* (make-null-lexenv))
     (flet ((loser (start)
             (or (position-if (lambda (x)
                                (not (eq (component-kind
-                                         (block-component
-                                          (node-block
-                                           (lambda-bind x))))
+                                         (node-component (lambda-bind x)))
                                         :toplevel)))
                              lambdas
                              :start start)