[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Workaround for Lucid Lisp 2.0.4 bug
- To: commonloops.pa@Xerox.COM
- Subject: Workaround for Lucid Lisp 2.0.4 bug
- From: Timothy.Freeman@theory.cs.cmu.edu
- Date: Wed, 20 May 87 01:53:35 EDT
The bug is that the Lucid compiler passes something useless as the
&environment parameter to macros that are expanded at compile time.
This little file illustrates the bug because a segmentation violation
happens when we try to compile it:
(defun make-lexical-environment (environment)
(evalhook '(labels ((bar ())) (make-lexical-environment-2))
'make-lexical-environment-1
()
environment))
(defun make-lexical-environment-1 (form env)
(setq form (macroexpand form env))
(evalhook form 'make-lexical-environment-1 nil env))
(defmacro make-lexical-environment-2 (&environment env)
(list 'quote (copy-tree env)))
(defun foo ()
(macrolet ((baz (&environment env)
(format t "Env is ~S.~%" env)
(inspect env)
(make-lexical-environment env)
3))
(baz)))
The bug causes PCL (dated 4/29/87 prime) to get a segmentation
violation when it tries to walk forms with labels constructs. The
workaround I found is to change the definition of expand-defmethod in
boot.lisp as follows. The surplus call to walk-form prevents the
macros from being called directly by the compiler.
***************
*** 142,148
(defun expand-defmethod (name qualifiers arglist body)
! (let ((defmethod-uid (gensym))
(load-method-1 ()))
(multiple-value-bind (parameters lambda-list specializers)
(parse-specialized-lambda-list arglist)
--- 142,149 -----
(defun expand-defmethod (name qualifiers arglist body)
! (walker:walk-form
! (let ((defmethod-uid (gensym))
(load-method-1 ()))
(multiple-value-bind (parameters lambda-list specializers)
(parse-specialized-lambda-list arglist)
***************
*** 199,205
name
defmethod-uid
load-method-1
! real-body)))))))))
(defun make-top-level-form (form)
#-Symbolics form
--- 200,206 -----
name
defmethod-uid
load-method-1
! real-body))))))))))
(defun make-top-level-form (form)
#-Symbolics form