[Ecls-list] [PATCH,BUG] Some fixes for ECL & a bug

Alexander Gavrilov angavrilov at gmail.com
Sat Jul 10 14:19:14 UTC 2010


There is a serious bug in the new way of representing
macros during compilation.

(defmacro xxxxx (v) t)
(defmethod foo (arg) (xxxxx (((arg)))))

If the above code is compiled via compile-file, the
following error appears:


 Error:
      in file foo.lisp, position 22
      at (DEFMETHOD FOO ...)
      * The macro form (DEFMETHOD FOO (ARG) (XXXXX (((ARG))))) was not expanded successfully.
    Error detected:
    In form
    (((ARG)))
    FUNCTION: Not a valid argument ((ARG)).


The cause for this is that now the macro is stored only
in the environment, so when defmethod's macroexpander
calls (coerce body 'function) in order to exploit the
bytecode compiler's walker, it has no way to know
about the macro, and tries to make sense of (((ARG)))
as a function call. It is also obvious that with less
convoluted cases it might finish without an error, but
mess up whatever data defmethod tries to gather due to
incomplete expansion.

I have no ideas about fixing this, so I just report it.



Also, here are some fixes for things with less convoluted causes:

Fixes errors about variable CONSTANTLY-NIL being unset:

diff --git a/src/clos/slot.lsp b/src/clos/slot.lsp
index c25039a..c169611 100644
--- a/src/clos/slot.lsp
+++ b/src/clos/slot.lsp
@@ -98,8 +98,8 @@
   ;;
   (if (constantp form)
       (let ((value (eval form)))
-       (cond ((null value) ''si::constantly-nil)
-             ((eq value t) ''si::constantly-t)
+       (cond ((null value) '#'si::constantly-nil)
+             ((eq value t) '#'si::constantly-t)
              (t `(constantly ,form))))
       `#'(lambda () ,form)))
 


Fixes errors about T not being a list during calls to make-instance:

diff --git a/src/clos/standard.lsp b/src/clos/standard.lsp
index 72ee9c6..8bc77c7 100644
--- a/src/clos/standard.lsp
+++ b/src/clos/standard.lsp
@@ -724,7 +724,7 @@ because it contains a reference to the undefined class~%  ~A"
   ;; First get all initargs which have been declared in the given
   ;; methods, then check the list of initargs declared in the slots
   ;; of the class.
-  (unless (eq methods t)
+  (unless (or (eq methods t) (eq cached-keywords t))
     (do* ((name-loc initargs (cddr name-loc))
          (allow-other-keys nil)
          (allow-other-keys-found nil)



Stops invalid errors about (ignorable #'local-function):

diff --git a/src/cmp/cmpenv-declare.lsp b/src/cmp/cmpenv-declare.lsp
index 1d69d80..e4ae9be 100644
--- a/src/cmp/cmpenv-declare.lsp
+++ b/src/cmp/cmpenv-declare.lsp
@@ -52,6 +52,11 @@
                        name)))
   tail)
 
+(defun valid-ignore-decl-name-p (name)
+  (or (symbolp name)
+      (and (consp name)
+           (eq (first name) 'function))))
+
 (defun collect-declared (type var-list tail)
   (declare (si::c-local))
   (cmpassert (proper-list-p var-list #'symbolp)
@@ -76,11 +81,11 @@ and a possible documentation string (only accepted when DOC-P is true)."
        do (case decl-name
             (SPECIAL)
             (IGNORE
-             (cmpassert (proper-list-p decl-args #'symbolp)
+             (cmpassert (proper-list-p decl-args #'valid-ignore-decl-name-p)
                         "Syntax error in declaration ~s" decl)
              (setf ignored (parse-ignore-declaration decl-args -1 ignored)))
             (IGNORABLE
-             (cmpassert (proper-list-p decl-args #'symbolp)
+             (cmpassert (proper-list-p decl-args #'valid-ignore-decl-name-p)
                         "Syntax error in declaration ~s" decl)
              (setf ignored (parse-ignore-declaration decl-args 0 ignored)))
             (TYPE



Stops invalid errors about (notinline (setf foo)):

diff --git a/src/cmp/cmpenv-fun.lsp b/src/cmp/cmpenv-fun.lsp
index 54cf600..679fa17 100644
--- a/src/cmp/cmpenv-fun.lsp
+++ b/src/cmp/cmpenv-fun.lsp
@@ -133,7 +133,7 @@
                                  collect (cons name t))))
 
 (defun declare-notinline (fname-list &optional (env *cmp-env*))
-  (unless (every #'symbolp fname-list)
+  (unless (every #'si::valid-function-name-p fname-list)
     (cmperr "Not a valid argument to NOTINLINE declaration~%~4I~A"
             fname-list))
   (cmp-env-extend-declaration 'INLINE




More information about the ecl-devel mailing list