From: Christophe R. <cr...@us...> - 2002-12-09 11:54:52
|
Update of /cvsroot/sbcl/sbcl/src/compiler In directory sc8-pr-cvs1:/tmp/cvs-serv21240/src/compiler Modified Files: early-c.lisp ir1-translators.lisp ir1report.lisp Log Message: 0.7.10.14: Fix bug 219 (ANSIfying DEFINE-COMPILER-MACRO in non-toplevel contexts): ... remove IR1 implementation, converting to a macro- and EVAL-WHEN-based implementation ... increment fasl file version number also, while I'm at it, set the COMPILER-MACRO-FUNCTION name to something useful for use in the debugger; apply similar fix for the MACRO-FUNCTION of a macro: ... move DEBUG-NAMIFY to SB-INT and export it. Index: early-c.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/compiler/early-c.lisp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- early-c.lisp 8 Jun 2002 00:00:04 -0000 1.23 +++ early-c.lisp 9 Dec 2002 11:54:49 -0000 1.24 @@ -165,3 +165,19 @@ dynamic binding, even though the symbol name follows the usual naming~@ convention (names like *FOO*) for special variables" symbol)) (values)) + +;;; shorthand for creating debug names from source names or other +;;; stems, e.g. +;;; (DEBUG-NAMIFY "FLET ~S" SOURCE-NAME) +;;; (DEBUG-NAMIFY "top level form ~S" FORM) +;;; +;;; FIXME: This function seems to have a lot in common with +;;; STRINGIFY-FORM, and perhaps there's some way to merge the two +;;; functions. +(defun debug-namify (format-string &rest format-arguments) + (with-standard-io-syntax + (let ((*print-readably* nil) + (*package* *cl-package*) + (*print-length* 3) + (*print-level* 2)) + (apply #'format nil format-string format-arguments)))) Index: ir1-translators.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/compiler/ir1-translators.lisp,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- ir1-translators.lisp 11 Nov 2002 08:37:03 -0000 1.34 +++ ir1-translators.lisp 9 Dec 2002 11:54:49 -0000 1.35 @@ -1063,20 +1063,17 @@ ;;;; interface to defining macros -;;;; FIXME: -;;;; classic CMU CL comment: -;;;; DEFMACRO and DEFUN expand into calls to %DEFxxx functions -;;;; so that we get a chance to see what is going on. We define -;;;; IR1 translators for these functions which look at the -;;;; definition and then generate a call to the %%DEFxxx function. -;;;; Alas, this implementation doesn't do the right thing for -;;;; non-toplevel uses of these forms, so this should probably -;;;; be changed to use EVAL-WHEN instead. - -;;; Return a new source path with any stuff intervening between the -;;; current path and the first form beginning with NAME stripped off. -;;; This is used to hide the guts of DEFmumble macros to prevent -;;; annoying error messages. +;;; Old CMUCL comment: +;;; +;;; Return a new source path with any stuff intervening between the +;;; current path and the first form beginning with NAME stripped +;;; off. This is used to hide the guts of DEFmumble macros to +;;; prevent annoying error messages. +;;; +;;; Now that we have implementations of DEFmumble macros in terms of +;;; EVAL-WHEN, this function is no longer used. However, it might be +;;; worth figuring out why it was used, and maybe doing analogous +;;; munging to the functions created in the expanders for the macros. (defun revert-source-path (name) (do ((path *current-path* (cdr path))) ((null path) *current-path*) @@ -1084,28 +1081,3 @@ (when (or (eq first name) (eq first 'original-source-start)) (return path))))) - -(def-ir1-translator %define-compiler-macro ((name def lambda-list doc) - start cont - :kind :function) - (let ((name (eval name)) - (def (second def))) ; We don't want to make a function just yet... - - (when (eq (info :function :kind name) :special-form) - (compiler-error "attempt to define a compiler-macro for special form ~S" - name)) - - (setf (info :function :compiler-macro-function name) - (coerce def 'function)) - - (let* ((*current-path* (revert-source-path 'define-compiler-macro)) - (fun (ir1-convert-lambda def - :debug-name (debug-namify - "DEFINE-COMPILER-MACRO ~S" - name)))) - (setf (functional-arg-documentation fun) (eval lambda-list)) - - (ir1-convert start cont `(%%define-compiler-macro ',name ,fun ,doc))) - - (when sb!xc:*compile-print* - (compiler-mumble "~&; converted ~S~%" name)))) Index: ir1report.lisp =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/compiler/ir1report.lisp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ir1report.lisp 1 Feb 2002 15:31:15 -0000 1.9 +++ ir1report.lisp 9 Dec 2002 11:54:49 -0000 1.10 @@ -192,22 +192,6 @@ (format nil "~<~@; ~S~:>" (list form)) (prin1-to-string form))))) -;;; shorthand for creating debug names from source names or other -;;; stems, e.g. -;;; (DEBUG-NAMIFY "FLET ~S" SOURCE-NAME) -;;; (DEBUG-NAMIFY "top level form ~S" FORM) -;;; -;;; FIXME: This function seems to have a lot in common with -;;; STRINGIFY-FORM, and perhaps there's some way to merge the two -;;; functions. -(defun debug-namify (format-string &rest format-arguments) - (with-standard-io-syntax - (let ((*print-readably* nil) - (*package* *cl-package*) - (*print-length* 3) - (*print-level* 2)) - (apply #'format nil format-string format-arguments)))) - ;;; shorthand for a repeated idiom in creating debug names ;;; ;;; the problem, part I: We want to create debug names that look like |