Open metayan opened 4 years ago
This seems related to the package local nickname system, which I introduced into CCL. I'll take this bug.
The issue seems related to the functions DEFAULT-FORM-HANDLER
and E-LIST
from the system fn
.
https://github.com/cbaggers/fn/blob/8d8587d03a7b5e26b306fc90018e385d9e5acc2c/mad.lisp#L297-L300 https://github.com/cbaggers/fn/blob/8d8587d03a7b5e26b306fc90018e385d9e5acc2c/mad.lisp#L314-L333
(defun default-form-handler (first &rest rest)
`(list ,(if (symbolp first)
`',first
(e first)) ,@(e-list rest)))
(defun e (form)
(flet ((handle (form)
(apply (form-handler (first form)) form)))
(cond ((and (listp form) (gethash (first form) *form-handler*))
(handle form))
(t
(multiple-value-bind (form expanded)
(macroexpand-1 form *env*)
(cond (expanded
(e form))
(t
(typecase form
(null nil)
(list
(let ((next (compiler-macroexpand-1 form)))
(if (eq form next)
(handle form)
(e next))))
(t
`',form)))))))))
The four repeating backtrace lines are:
(HANDER-PROGN LOCALLY
(DECLARE (NOTINLINE INTERN))
(INTERN LISP-NAME :VARI.GLSL))
(E-LIST ((CCL::PACKAGE-%LOCAL-NICKNAMES *PACKAGE*)
(LOCALLY # #)
(CCL::%PKG-REF-INTERN LISP-NAME #)))
(DEFAULT-FORM-HANDLER IF
(CCL::PACKAGE-%LOCAL-NICKNAMES *PACKAGE*)
(LOCALLY (DECLARE #)
(INTERN LISP-NAME :VARI.GLSL))
(CCL::%PKG-REF-INTERN LISP-NAME (LOAD-TIME-VALUE #)))
(E-LIST ((DECLARE #)
(INTERN LISP-NAME :VARI.GLSL)))
I recognize the following form.
(IF
(CCL::PACKAGE-%LOCAL-NICKNAMES *PACKAGE*)
(LOCALLY (DECLARE #)
(INTERN LISP-NAME :VARI.GLSL))
(CCL::%PKG-REF-INTERN LISP-NAME (LOAD-TIME-VALUE #)))
It is this part of my commit:
https://github.com/Clozure/ccl/pull/188/files#diff-7dbee25941139b1e1582d8f0c87f1b23R2430-R2432
This code from fn
seems to drop into an infinite recursion when trying to compute package-local nicknames of a symbol while macroexpanding and compiler-macroexpanding a form. I will try to reproduce it in a smaller way later today.
I say that this is not a CCL issue.
CLHS NOTINLINE says,
In the presence of a compiler macro definition for
function-name
, anotinline
declaration prevents that compiler macro from being used.
The macroexpansion machinery contained in the fn
library ignores this fact and recursively compiler-macroexpands the INTERN
form which was explicitly declared NOTINLINE
, which leads into infinite loops as demonstrated here.
Until FN is fixed, a workaround is available at https://github.com/cbaggers/cepl/issues/350#issuecomment-693713107
To trigger: (ql:quickload :varjo)
Works: Clozure Common Lisp Version 1.11.6 DarwinX8664 Clozure Common Lisp Version 1.12-dev (v1.12-dev.3-24-g1fd2a4b4) DarwinX8664 SBCL, ECL, ABCL Fails: Clozure Common Lisp Version 1.12-dev (v1.12-dev.5-17-g58d4d91c) DarwinX8664
Not sure that it's not an issue with
varjo
orfn
, but appeared recently, and only with CCL, so filing here. Same behavior with bothmaster
andrelease-quicklisp
branches.