[Openmcl-devel] "internal" functions and xref

Takehiko Abe keke at gol.com
Tue Nov 18 00:25:06 PST 2008


(while trying to fix slime's who-calls for ccl-1.3, I noticed)

ccl::make-xref-entry returns bogus xrefs when it is given "internal"
functions.

Example:

   $ ccl -n
   Welcome to Clozure Common Lisp Version 1.3-dev-r  (LinuxX8664)!
   ? (require 'xref)
   XREF
   ("XREF")
   ? (ccl::callers 'print-object)
   (#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT 
(INSPECTOR::UNBOUND-MARKER T)>
    #<CCL::STANDARD-KERNEL-METHOD CCL::REPORT-CONDITION (CONDITION T)>
    CCL::WRITE-A-FROB #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT 
(COMPLEX T)>
    (:INTERNAL (PRINT-OBJECT (CLASS T)))
    (:INTERNAL (PRINT-OBJECT (STANDARD-OBJECT T)))
    (:INTERNAL CCL::WRITE-AN-ISTRUCT))
   ? (car (last *))
   (:INTERNAL CCL::WRITE-AN-ISTRUCT)
   ? (ccl::make-xref-entry * :direct-calls)
   #<XREF-ENTRY INTERNAL METHOD (WRITE-AN-ISTRUCT)>
   ?

A simple fix I came up with was to add a new CASE clause for :internal:

(defun make-xref-entry (input relation)
   (etypecase input
     (symbol
      ...)
     (method
      ...)
     (cons
      (case (car input)
        ((ppc-lap-macro compiler-macro-function)
         ...)
+      ((:internal)
+       (make-xref-entry (cadr input) relation))
        (t
         )))))

But then I noticed that there are inputs for flet/labels local
functions too. e.g.

   ? (ccl::callers 'ccl::%multiply-and-add-loop)
   ((:INTERNAL CCL::MULTIPLY-UNSIGNED-BIGNUMS CCL::MULTIPLY-BIGNUMS))

So make-xref-entry now becomes:

(defun make-xref-entry (input relation)
   (etypecase input
     (symbol
      ...)
     (method
      ...)
     (cons
      (case (car input)
        ((ppc-lap-macro compiler-macro-function)
         ...)
+      ((:internal)
+       (if (= (length input) 3)
+         (make-xref-entry (nth 2 input) relation)
+         (make-xref-entry (cadr input) relation)))
        (t
         )))))

Bah. I feel like I should ask what these "internal" functions are.

regards,
T.



More information about the Openmcl-devel mailing list