X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fearly-source-location.lisp;h=57af0a7e99ceb4659899cb10d4fc15e81f51264d;hb=625c9493a8a7b5186144d21302437cf4f4f3571c;hp=022af85a17f697736f539c72f7cad3a618cdb39a;hpb=31f072311935e32751508ecf824905c6b58a1d95;p=sbcl.git diff --git a/src/code/early-source-location.lisp b/src/code/early-source-location.lisp index 022af85..57af0a7 100644 --- a/src/code/early-source-location.lisp +++ b/src/code/early-source-location.lisp @@ -12,10 +12,18 @@ (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) @@ -24,11 +32,12 @@ (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