mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Return names, not functions, from ctu:find-named-callees
This commit is contained in:
parent
e40b1bc4be
commit
4c8f524b50
|
|
@ -321,7 +321,7 @@
|
|||
(with-test (:name :block-compile-top-level-closures.self-call.local-calls)
|
||||
;; Test that we can local call ourselves in the same environment despite
|
||||
;; being a top level closure.
|
||||
(assert (not (member #'self-call (ctu:find-named-callees #'self-call)))))
|
||||
(assert (not (member 'self-call (ctu:find-named-callees #'self-call)))))
|
||||
|
||||
(with-test (:name :block-compile-top-level-closures.same-environment)
|
||||
(ctu:file-compile
|
||||
|
|
@ -368,7 +368,7 @@
|
|||
:block-compile t
|
||||
:load t)
|
||||
;; Closure can directly reference the simple fun for SIMPLE.
|
||||
(assert (not (member #'simple (ctu:find-named-callees #'closure))))
|
||||
(assert (not (member 'simple (ctu:find-named-callees #'closure))))
|
||||
(multiple-value-bind (val counter)
|
||||
(closure)
|
||||
(assert (eq val #'simple))
|
||||
|
|
|
|||
|
|
@ -2357,7 +2357,7 @@
|
|||
TAG)))
|
||||
(with-test (:name :bug-520366)
|
||||
(let ((callees (find-named-callees #'bar-520366)))
|
||||
(assert (equal (list #'quux-520366) callees))))
|
||||
(assert (equal '(quux-520366) callees))))
|
||||
|
||||
(defgeneric no-applicable-method/retry (x))
|
||||
(defmethod no-applicable-method/retry ((x string))
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
(loop for i from start repeat count
|
||||
for c = (code-header-ref code i)
|
||||
when (or (not namep) (equal name (sb-kernel:fdefn-name c)))
|
||||
collect (sb-kernel:fdefn-fun c))))
|
||||
collect (sb-kernel:fdefn-name c))))
|
||||
|
||||
(defun find-anonymous-callees (fun &key (type 'function))
|
||||
(let ((code (fun-code-header (%fun-fun fun))))
|
||||
|
|
|
|||
|
|
@ -1805,28 +1805,25 @@
|
|||
(+ arg0 arg1))
|
||||
(declaim (notinline target-fun))
|
||||
|
||||
;; That issue aside, neither sb-introspect nor ctu:find-named-callees
|
||||
;; can examine an interpreted function for its callees,
|
||||
;; so we can't actually use this function.
|
||||
(defun test-target-fun-called (fun res)
|
||||
(assert (member #'target-fun
|
||||
(ctu:find-named-callees #'caller-fun-1)))
|
||||
(assert (member 'target-fun (ctu:find-named-callees #'caller-fun-1)))
|
||||
(assert (equal (funcall fun) res)))
|
||||
|
||||
(defun caller-fun-1 ()
|
||||
(funcall 'target-fun 1 2))
|
||||
#-interpreter(test-target-fun-called #'caller-fun-1 3)
|
||||
(compile 'caller-fun-1) ; in case #+interpreter
|
||||
(test-target-fun-called #'caller-fun-1 3)
|
||||
|
||||
(defun caller-fun-2 ()
|
||||
(declare (inline target-fun))
|
||||
(apply 'target-fun 1 '(3)))
|
||||
#-interpreter(test-target-fun-called #'caller-fun-2 4)
|
||||
(test-target-fun-called #'caller-fun-2 4)
|
||||
|
||||
(defun caller-fun-3 ()
|
||||
(flet ((target-fun (a b)
|
||||
(- a b)))
|
||||
(list (funcall #'target-fun 1 4) (funcall 'target-fun 1 4))))
|
||||
#-interpreter(test-target-fun-called #'caller-fun-3 (list -3 5))
|
||||
(test-target-fun-called #'caller-fun-3 (list -3 5))
|
||||
|
||||
;;; Reported by NIIMI Satoshi
|
||||
;;; Subject: [Sbcl-devel] compilation error with optimization
|
||||
|
|
@ -3219,12 +3216,13 @@
|
|||
(funcall (if t #'inline-fun) 'a)))
|
||||
:load t)
|
||||
(assert (equal (ctu:find-named-callees (symbol-function 'new-inline-functional-type-conflict.2))
|
||||
(list #'print)))
|
||||
'(print)))
|
||||
;; We want to share the functional on space > speed, so we should
|
||||
;; have 3 code segments: one for
|
||||
;; NEW-INLINE-FUNCTIONAL-TYPE-CONFLICT.2's XEP, one for
|
||||
;; NEW-INLINE-FUNCTIONAL-TYPE-CONFLICT.2, and one for INLINE-FUN.
|
||||
(assert (= 3 (length (sb-disassem::get-code-segments (sb-kernel::fun-code-header #'new-inline-functional-type-conflict.2)))))
|
||||
(assert (= 3 (length (sb-disassem::get-code-segments
|
||||
(sb-kernel:fun-code-header #'new-inline-functional-type-conflict.2)))))
|
||||
;; We should have no type information from the arguments, because
|
||||
;; the functional is shared.
|
||||
(let ((type (sb-kernel:%simple-fun-type
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ Evaluation took:
|
|||
(ctu:find-named-callees equalp-impl)))
|
||||
(case type
|
||||
((parent child)
|
||||
(assert (equal callees `(,#'sb-int:bit-vector-=))))
|
||||
(assert (equal callees '(sb-int:bit-vector-=))))
|
||||
(child2
|
||||
;; EQUAL on SIMPLE-BIT-VECTOR gets open-coded
|
||||
(assert (not callees)))))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue