chiark / gitweb /
src/{codegen,method}-impl.lisp: Allow non-variables in `vars' lists.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 10:04:18 +0000 (11:04 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 30 Aug 2015 17:11:37 +0000 (18:11 +0100)
It used to be assumed that everything in the `vars' list was a
`var-inst' object, but that's not going to be true any more.

src/codegen-impl.lisp
src/method-impl.lisp

index 3790d9d1d837b692712c057d4addedec4ed99662..e99a0c2b435838d462603d4903ce68880a250ade 100644 (file)
@@ -127,7 +127,9 @@ (defmethod emit-insts ((codegen basic-codegen) insts)
 
 (defmethod ensure-var ((codegen basic-codegen) name type &optional init)
   (let* ((vars (codegen-vars codegen))
-        (var (find name vars :key #'inst-name :test #'equal)))
+        (var (find name
+                   (remove-if-not (lambda (var) (typep var 'var-inst)) vars)
+                   :key #'inst-name :test #'equal)))
     (cond ((not var)
           (setf (codegen-vars codegen)
                 (cons (make-var-inst name type init) vars)))
@@ -176,7 +178,7 @@ (defmethod temporary-var ((codegen basic-codegen) type)
                           (c-type-equal-p type (inst-type var)))
                      name
                      nil)))
-             vars)
+             (remove-if-not (lambda (var) (typep var 'var-inst)) vars))
        (let* ((name (make-instance 'temporary-variable
                                    :in-use-p t
                                    :tag (prog1 temp-index
index 09dbb2b5eca4c524370a5fc77d05bdbb372fed48..f3673d8968a638130b3210aab9999b3e755ef629 100644 (file)
@@ -474,8 +474,10 @@ (defmethod compute-method-entry-functions ((method basic-effective-method))
                 (dolist (tail chain-tails)
                   (setup-entry tail)
                   (dolist (var vars)
-                    (ensure-var codegen (inst-name var)
-                                (inst-type var) (inst-init var)))
+                    (if (typep var 'var-inst)
+                        (ensure-var codegen (inst-name var)
+                                    (inst-type var) (inst-init var))
+                        (emit-decl codegen var)))
                   (when parm-n (varargs-prologue))
                   (emit-insts codegen insts)
                   (when parm-n (varargs-epilogue))