aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-07-16 19:21:10 +0000
committerRichard M. Stallman2005-07-16 19:21:10 +0000
commitdc9c856d4f5460b738681e6cec70ff6bf3f60cde (patch)
treea59480e84ca822529897b4a93a0bb104c1f0f99e
parent4185451dc73f896dd31b4dd7d902b10110ab5dcc (diff)
downloademacs-dc9c856d4f5460b738681e6cec70ff6bf3f60cde.tar.gz
emacs-dc9c856d4f5460b738681e6cec70ff6bf3f60cde.zip
(find-gc-subrs-callers): Renamed from find-gc-subrs-used.
(find-gc-subrs-called): Renamed from subrs-called, and defvar'd.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/find-gc.el29
2 files changed, 18 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b67ad5b7f96..0f383206986 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -68,9 +68,9 @@
68 (event-key, key-press-event-p): Delete definitions. 68 (event-key, key-press-event-p): Delete definitions.
69 69
70 * emacs-lisp/find-gc.el (find-gc-unsafe-list) 70 * emacs-lisp/find-gc.el (find-gc-unsafe-list)
71 (find-gc-source-directory, find-gc-subrs-used) 71 (find-gc-source-directory, find-gc-subrs-callers)
72 (find-gc-noreturn-list, find-gc-source-files): 72 (find-gc-noreturn-list, find-gc-source-files)
73 Vars renamed and defvar'd. 73 (find-gc-subrs-called): Vars renamed and defvar'd.
74 74
75 * emacs-lisp/checkdoc.el (checkdoc-make-overlay) 75 * emacs-lisp/checkdoc.el (checkdoc-make-overlay)
76 (checkdoc-overlay-put, checkdoc-delete-overlay) 76 (checkdoc-overlay-put, checkdoc-delete-overlay)
diff --git a/lisp/emacs-lisp/find-gc.el b/lisp/emacs-lisp/find-gc.el
index 91d1f016627..8d3b0b02a4e 100644
--- a/lisp/emacs-lisp/find-gc.el
+++ b/lisp/emacs-lisp/find-gc.el
@@ -34,8 +34,14 @@
34 34
35(defvar find-gc-source-directory) 35(defvar find-gc-source-directory)
36 36
37(defvar find-gc-subrs-used nil 37(defvar find-gc-subrs-callers nil
38 "List of subrs used so far in GC testing.") 38 "Alist of users of subrs, from GC testing.
39Each entry has the form (FUNCTION . FUNCTIONS-THAT-CALL-IT).")
40
41(defvar find-gc-subrs-called nil
42 "Alist of subrs called, in GC testing.
43Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).")
44
39 45
40;;; Functions on this list are safe, even if they appear to be able 46;;; Functions on this list are safe, even if they appear to be able
41;;; to call the target. 47;;; to call the target.
@@ -84,9 +90,9 @@ Also store it in `find-gc-unsafe'."
84) 90)
85 91
86(defun trace-unsafe (func) 92(defun trace-unsafe (func)
87 (let ((used (assq func find-gc-subrs-used))) 93 (let ((used (assq func find-gc-subrs-callers)))
88 (or used 94 (or used
89 (error "No find-gc-subrs-used for %s" (car find-gc-unsafe-list))) 95 (error "No find-gc-subrs-callers for %s" (car find-gc-unsafe-list)))
90 (while (setq used (cdr used)) 96 (while (setq used (cdr used))
91 (or (assq (car used) find-gc-unsafe-list) 97 (or (assq (car used) find-gc-unsafe-list)
92 (memq (car used) find-gc-noreturn-list) 98 (memq (car used) find-gc-noreturn-list)
@@ -97,8 +103,6 @@ Also store it in `find-gc-unsafe'."
97 103
98 104
99 105
100;;; This produces an a-list of functions in subrs-called. The cdr of
101;;; each entry is a list of functions which the function in car calls.
102 106
103(defun trace-call-tree (&optional already-setup) 107(defun trace-call-tree (&optional already-setup)
104 (message "Setting up directories...") 108 (message "Setting up directories...")
@@ -112,7 +116,7 @@ Also store it in `find-gc-unsafe'."
112 find-gc-source-directory)))) 116 find-gc-source-directory))))
113 (save-excursion 117 (save-excursion
114 (set-buffer (get-buffer-create "*Trace Call Tree*")) 118 (set-buffer (get-buffer-create "*Trace Call Tree*"))
115 (setq subrs-called nil) 119 (setq find-gc-subrs-called nil)
116 (let ((case-fold-search nil) 120 (let ((case-fold-search nil)
117 (files find-gc-source-files) 121 (files find-gc-source-files)
118 name entry) 122 name entry)
@@ -131,7 +135,7 @@ Also store it in `find-gc-unsafe'."
131 (match-end 0)))) 135 (match-end 0))))
132 (message "%s : %s" (car files) name) 136 (message "%s : %s" (car files) name)
133 (setq entry (list name) 137 (setq entry (list name)
134 subrs-called (cons entry subrs-called))) 138 find-gc-subrs-called (cons entry find-gc-subrs-called)))
135 (if (looking-at ".*\n?.*\"\\([A-Za-z0-9_]+\\)\"") 139 (if (looking-at ".*\n?.*\"\\([A-Za-z0-9_]+\\)\"")
136 (progn 140 (progn
137 (setq name (intern (buffer-substring (match-beginning 1) 141 (setq name (intern (buffer-substring (match-beginning 1)
@@ -143,17 +147,14 @@ Also store it in `find-gc-unsafe'."
143) 147)
144 148
145 149
146;;; This produces an inverted a-list in find-gc-subrs-used. The cdr of each
147;;; entry is a list of functions that call the function in car.
148
149(defun trace-use-tree () 150(defun trace-use-tree ()
150 (setq find-gc-subrs-used (mapcar 'list (mapcar 'car subrs-called))) 151 (setq find-gc-subrs-callers (mapcar 'list (mapcar 'car find-gc-subrs-called)))
151 (let ((ptr subrs-called) 152 (let ((ptr find-gc-subrs-called)
152 p2 found) 153 p2 found)
153 (while ptr 154 (while ptr
154 (setq p2 (car ptr)) 155 (setq p2 (car ptr))
155 (while (setq p2 (cdr p2)) 156 (while (setq p2 (cdr p2))
156 (if (setq found (assq (car p2) find-gc-subrs-used)) 157 (if (setq found (assq (car p2) find-gc-subrs-callers))
157 (setcdr found (cons (car (car ptr)) (cdr found))))) 158 (setcdr found (cons (car (car ptr)) (cdr found)))))
158 (setq ptr (cdr ptr)))) 159 (setq ptr (cdr ptr))))
159) 160)