[slime-cvs] CVS update: slime/swank-source-path-parser.lisp

Luke Gorrie lgorrie at common-lisp.net
Fri Aug 13 20:32:34 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv2721

Modified Files:
	swank-source-path-parser.lisp 
Log Message:
Removed caching of readtables and the source-map hashtable. Fresh
creation is ultra-cheap (<1ms).
The caching didn't handle modifications to readtables and generally
made me feel uneasy while tracking down an obscure bug in a reader
macro.

The cached source-map hashtable also wasn't thread-safe (ho hum).

Date: Fri Aug 13 13:32:33 2004
Author: lgorrie

Index: slime/swank-source-path-parser.lisp
diff -u slime/swank-source-path-parser.lisp:1.6 slime/swank-source-path-parser.lisp:1.7
--- slime/swank-source-path-parser.lisp:1.6	Sun Jun 27 08:03:18 2004
+++ slime/swank-source-path-parser.lisp	Fri Aug 13 13:32:33 2004
@@ -114,30 +114,17 @@
 				 term tab)))))
     tab))
 
-(defun make-source-map ()
-  (make-hash-table :test #'eq))
-
-(defvar *source-map* (make-source-map)
+(defvar *source-map* nil
   "The hashtable table used for source position recording.")
 
-(defvar *recording-readtable-cache* '()
-  "An alist of (READTABLE . RECORDING-READTABLE) pairs.")
-
-(defun lookup-recording-readtable (readtable)
-  "Find a cached or create a new recording readtable for READTABLE."
-  (or (cdr (assoc readtable *recording-readtable-cache*))
-      (let ((table (make-source-recording-readtable readtable *source-map*)))
-	(push (cons readtable table) *recording-readtable-cache*)
-	table)))
-			
 (defun read-and-record-source-map (stream)
   "Read the next object from STREAM.
 Return the object together with a hashtable that maps
 subexpressions of the object to stream positions."
-  (let ((*readtable* (lookup-recording-readtable *readtable*)))
-    (clrhash *source-map*)
+  (let* ((*source-map* (make-hash-table :test #'eq))
+         (*readtable* (make-source-recording-readtable *readtable* *source-map*)))
     (values (read stream) *source-map*)))
-  
+
 (defun source-path-stream-position (path stream)
   "Search the source-path PATH in STREAM and return its position."
   (destructuring-bind (tlf-number . path) path





More information about the slime-cvs mailing list