From: Robert Dodier <robert_dodier@ya...> - 2009-01-18 17:22:08
(setf (symbol-function 'bar)
(let ((x (gensym)))
(coerce `(lambda (,x) (declare (special ,x)) (* 2 ,x)) 'function)))
(let ((f (compile nil #'bar ))) (funcall f 1d0))
=> java.lang.NoSuchFieldError: G75
and prints a Java stack trace.
The crucial features seem to be: (DECLARE (SPECIAL ,X)) where
X is a gensym, and (COMPILE NIL #'BAR).
If the special declaration is cut out, or the declared
variable is not a gensym, or #'BAR is not compiled, then
(if I'm not mistaken) the FUNCALL succeeds and returns 2d0.
Now you might think that declaring a gensym special is a
silly thing to do, and you would be right; its name is not
known elsewhere in the code. This example originates from
some code in Maxima in which constructs a function to be
used as an integrand. I can suppress this bug by cutting
out the special declaration, which I'll probably do since
the declaration has no effect, but it seems best to also
fix ABCL so it doesn't barf.
Hope this helps,
From: Robert Dodier <robert_dodier@ya...> - 2009-02-10 05:55:06
Encouraged by recent developments I tried this example again:
> (setf (symbol-function 'bar)
> (let ((x (gensym)))
> (coerce `(lambda (,x) (declare (special ,x)) (* 2 ,x))
> (let ((f (compile nil #'bar ))) (funcall f 1d0))
When I tried this a few weeks ago I got this error:
> => java.lang.NoSuchFieldError: G75
However today after updating from svn I get:
java.lang.ClassFormatError: Illegal class name "Lorg/armedbear/lisp/Symbol;" in class file <Unknown>
at java.lang.ClassLoader.defineClass1(Native Method)
If I replace (gensym) with 'xx, then it runs successfully
and returns 2.0d0.
Maybe someone can look into this. Thanks for your help!