[armedbear-devel] [patch] compile slightly broken for compiled functions

Vladimir Sedach vsedach at gmail.com
Sat Aug 11 18:58:52 UTC 2012


Hi,

(compile nil (compile nil (lambda ()))) => NIL
(compile '+) => +

The first result is obviously wrong, and the second one is actually as
well (according to the HyperSpec, compile should return the function
definition of +).

The fix is rather trivial:

Index: src/org/armedbear/lisp/compiler-pass2.lisp
===================================================================
--- src/org/armedbear/lisp/compiler-pass2.lisp	(revision 14055)
+++ src/org/armedbear/lisp/compiler-pass2.lisp	(working copy)
@@ -7483,7 +7483,7 @@
     (resolve name) ;; Make sure the symbol has been resolved by the autoloader
     (setf definition (fdefinition name)))
   (when (compiled-function-p definition)
-    (return-from jvm-compile (values name nil nil)))
+    (return-from jvm-compile (values definition nil nil)))
   (let ((catch-errors *catch-errors*)
         (warnings-p nil)
         (failure-p nil)
Index: test/lisp/abcl/compiler-tests.lisp
===================================================================
--- test/lisp/abcl/compiler-tests.lisp	(revision 14055)
+++ test/lisp/abcl/compiler-tests.lisp	(working copy)
@@ -472,11 +472,10 @@
         (not (null result))))
   t)

+(deftest compile-named
+    (compile '+)
+  (symbol-function '+))

-
-
-
-
-
-
-
\ No newline at end of file
+(deftest compile-compile
+    (compiled-function-p (compile nil (compile nil (lambda ()))))
+  t)

Happy hacking,
Vladimir




More information about the armedbear-devel mailing list