I am trying to fix the bug https://bugs.launchpad.net/sbcl/+bug/515603 'inlining a recursive function causes compiler to stack overflow.'
I have attached the draft of a patch there, which solves the problem by prohibiting the inline expansion of the recursive functions when they are called within their own bodies. Unfortunately, this patch also breaks the cross-compilation process (the patch works only when ir1opt.lisp is loaded after chill.lisp into a running system), due to the too wide group of the 'maybe-recursive' calls it recognizes currently:
(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))
There is a problem with the precise classification of the recursive functionals in IR1. Namely, caller/callee can be anonymous (but still recursive) functionals, which makes the initial idea about the functionals names comparison almost useless. What is the other way to check for the recursion presence (I feel that I am missing something here)?