1.0.14.2: XREF needs to account for the last node of a block as well
[sbcl.git] / src / compiler / xref.lisp
index 40c0d37..48d2a54 100644 (file)
     (return-from record-component-xrefs))
   (do ((block (block-next (component-head component)) (block-next block)))
       ((null (block-next block)))
-    (let* ((this-cont (block-start block))
-           (last (block-last block)))
+    (let ((start (block-start block)))
       (flet ((handle-node (functional)
                ;; Record xref information for all nodes in the block.
                ;; Note that this code can get executed several times
                ;; for the same block, if the functional is referenced
                ;; from multiple XEPs.
-               (loop for node = (ctran-next this-cont) then (ctran-next (node-next node))
-                     until (eq node last)
+               (loop for ctran = start then (node-next node)
+                     while ctran
+                     for node = (ctran-next ctran)
                      do (record-node-xrefs node functional))
                ;; Properly record the deferred macroexpansion information
                ;; that's been stored in the block.
 (defun record-node-xrefs (node context)
   (declare (type node node))
   (etypecase node
-    ((or creturn cif entry combination mv-combination cast))
+    ((or creturn cif entry mv-combination cast exit))
+    (combination
+     ;; Record references to globals made using SYMBOL-VALUE.
+     (let ((fun (principal-lvar-use (combination-fun node)))
+           (arg (car (combination-args node))))
+       (when (and (ref-p fun) (eq 'symbol-value (leaf-%source-name (ref-leaf fun)))
+                  (constant-lvar-p arg) (symbolp (lvar-value arg)))
+         (record-xref :references (lvar-value arg) context node nil))))
     (ref
      (let ((leaf (ref-leaf node)))
        (typecase leaf