diff --git a/src/compiler/ir1opt.lisp b/src/compiler/ir1opt.lisp index d091f38..93cd2bf 100644 --- a/src/compiler/ir1opt.lisp +++ b/src/compiler/ir1opt.lisp @@ -933,6 +933,19 @@ (mark-for-deletion succ))))) t)))) + +;;; +;;; This function conservatively ensures that a call is not +;;; recursive. Conservatism is connected with including anonymous +;;; calls into the recursive calls group. +(defun call-is-definitely-not-recursive-p (ref) + (let ((caller (leaf-%source-name (node-home-lambda ref))) + (callee (leaf-%source-name (ref-leaf ref)))) + (if (or (eq caller '.anonymous.) + (eq callee '.anonymous.) + (eq caller callee)) + nil t))) + ;;; This is called both by IR1 conversion and IR1 optimization when ;;; they have verified the type signature for the call, and are ;;; wondering if something should be done to special-case the call. If @@ -972,7 +985,9 @@ ((nil :maybe-inline) (policy call (zerop space)))) (defined-fun-p leaf) (defined-fun-inline-expansion leaf) - (inline-expansion-ok call)) + (inline-expansion-ok call) + (call-is-definitely-not-recursive-p ref)) + ;; Inline: if the function has already been converted at another call ;; site in this component, we point this REF to the functional. If not, ;; we convert the expansion.