1.1.13: will be tagged as "sbcl-1.1.13"
[sbcl.git] / src / code / early-source-location.lisp
index 022af85..57af0a7 100644 (file)
 
 (in-package "SB!C")
 
+;;; Used as the CDR of the code coverage instrumentation records
+;;; (instead of NIL) to ensure that any well-behaving user code will
+;;; not have constants EQUAL to that record. This avoids problems with
+;;; the records getting coalesced with non-record conses, which then
+;;; get mutated when the instrumentation runs. Note that it's
+;;; important for multiple records for the same location to be
+;;; coalesced. -- JES, 2008-01-02
+(defconstant +code-coverage-unmarked+ '%code-coverage-unmarked%)
+
 (defvar *source-location-thunks* nil)
 
-;; Should get called only in unusual circumstances. Normally handled
-;; by a compiler macro.
+;; Will be redefined in src/code/source-location.lisp.
 (defun source-location ()
   nil)
 
 (define-compiler-macro source-location ()
   (when (and (boundp '*source-info*)
              (symbol-value '*source-info*))
-    `(cons ,(make-file-info-namestring
-              *compile-file-pathname*
-              (source-info-file-info (symbol-value '*source-info*)))
-           ,(when (boundp '*current-path*)
-                  (source-path-tlf-number (symbol-value '*current-path*))))))
+    (let ((form `(cons ,(make-file-info-namestring
+                         *compile-file-pathname*
+                         (sb!c:get-toplevelish-file-info (symbol-value '*source-info*)))
+                       ,(when (boundp '*current-path*)
+                              (source-path-tlf-number (symbol-value '*current-path*))))))
+      form)))
 
 ;; If the whole source location tracking machinery has been loaded
 ;; (detected by the type of SOURCE-LOCATION), execute BODY. Otherwise