[slime-devel] LispWorks 6 and list-callers/list-callees
Martin Simmons
martin at lispworks.com
Thu Jul 22 19:10:15 UTC 2010
>>>>> On Thu, 22 Jul 2010 14:52:00 +0200, Vitaly Mayatskikh said:
>
> Here's patch to bring list-callers back to life for LW6 and
> implementation of list-callees. Tested on LW 6.0.1.
That is wrong becasue it removes the main distinguishing feature of
list-callers (compared to who-calls).
Please try the code below instead. It should work in all versions of
LispWorks, so I will check it in if it works for you.
(defun list-callers-internal (name)
(let ((callers (make-array 100
:fill-pointer 0
:adjustable t)))
(hcl:sweep-all-objects
#'(lambda (object)
(when (and #+Harlequin-PC-Lisp (low:compiled-code-p object)
#+Harlequin-Unix-Lisp (sys:callablep object)
#-(or Harlequin-PC-Lisp Harlequin-Unix-Lisp) (sys:compiled-code-p object)
(system::find-constant$funcallable name object))
(vector-push-extend object callers))))
;; Delay dspec:object-dspec until after sweep-all-objects
;; to reduce allocation problems.
(loop for object across callers
collect (if (symbolp object)
(list 'function object)
(or (dspec:object-dspec object) object)))))
(defun list-callees-internal (name)
(let ((callees '()))
(system::find-constant$funcallable
'junk name
:test #'(lambda (junk constant)
(declare (ignore junk))
(when (and (symbolp constant)
(fboundp constant))
(pushnew (list 'function constant) callees :test 'equal))
;; Return nil so we iterate over all constants.
nil))
callees))
--
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/
More information about the slime-devel
mailing list