0.7.2.10:
authorChristophe Rhodes <csr21@cam.ac.uk>
Fri, 12 Apr 2002 12:15:56 +0000 (12:15 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Fri, 12 Apr 2002 12:15:56 +0000 (12:15 +0000)
Merge APD fix for bug 151 (sbcl-devel 2002-04-12)
... add a test for #! being undefined
... note specialness of DIGIT-CHARs
Delete unused byte-swapping code from genesis (CSR
"My pending patches" sbcl-devel 2002-04-08)

BUGS
NEWS
package-data-list.lisp-expr
src/code/early-extensions.lisp
src/code/reader.lisp
src/code/sharpm.lisp
src/compiler/fndb.lisp
src/compiler/generic/genesis.lisp
tests/reader.pure.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 502fd0b..e1e3d50 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1234,13 +1234,6 @@ WORKAROUND:
   issues were cleaned up. As of sbcl-0.7.1.9, it occurs in 
   NODE-BLOCK called by LAMBDA-COMPONENT called by IR2-CONVERT-CLOSURE.
 
-151:
-  From the ANSI description of GET-DISPATCH-MACRO-CHARACTER, it
-  should return NIL when there is no definition, e.g.
-    (GET-DISPATCH-MACRO-CHARACTER #\# #\{) => NIL
-  Instead, in sbcl-0.7.1.17 it returns
-    #<FUNCTION "top level local call SB!IMPL::DISPATCH-CHAR-ERROR">
-
 153:
   (essentially the same problem as a CMU CL bug reported by Martin
   Cracauer on cmucl-imp 2002-02-19)
diff --git a/NEWS b/NEWS
index 99f246e..1be50c3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1090,6 +1090,8 @@ changes in sbcl-0.7.3 relative to sbcl-0.7.2:
     future:) Brian Spilsbury has produced a Unicode-enabled variant of
     sbcl-0.7.0, available as a patch against sbcl-0.7.0 at
       <http://designix.com.au/brian/SBCL/sbcl-0.7.0-unicode.p0.gz>.
+  * Bugfix to GET-DISPATCH-MACRO-CHAR, now returning NIL for undefined
+    dispatch macro character combinations (thanks to Alexey Dejenka)
 
 planned incompatible changes in 0.7.x:
 * When the profiling interface settles down, maybe in 0.7.x, maybe
index 8c3b9d9..2d3f93d 100644 (file)
@@ -762,7 +762,8 @@ retained, possibly temporariliy, because it might be used internally."
              "UNENCAPSULATE"
 
              ;; various CHAR-CODEs
-             "BELL-CHAR-CODE" "ESCAPE-CHAR-CODE" "FORM-FEED-CHAR-CODE"
+             "BACKSPACE-CHAR-CODE" "BELL-CHAR-CODE" "ESCAPE-CHAR-CODE"
+             "FORM-FEED-CHAR-CODE" "LINE-FEED-CHAR-CODE"
              "RETURN-CHAR-CODE" "RUBOUT-CHAR-CODE" "TAB-CHAR-CODE"
 
              ;; symbol-hacking idioms
index 9e528e8..71f590b 100644 (file)
@@ -79,7 +79,9 @@
 ;;; (or just find a nicer way of expressing characters portably?) --
 ;;; WHN 19990713
 (defconstant bell-char-code 7)
+(defconstant backspace-char-code 8)
 (defconstant tab-char-code 9)
+(defconstant line-feed-char-code 10)
 (defconstant form-feed-char-code 12)
 (defconstant return-char-code 13)
 (defconstant escape-char-code 27)
index 69d1a6f..4114588 100644 (file)
   #!+sb-doc
   "Return the macro character function for SUB-CHAR under DISP-CHAR
    or NIL if there is no associated function."
-  (unless (digit-char-p sub-char)
-    (let* ((sub-char (char-upcase sub-char))
-          (rt (or rt *standard-readtable*))
-          (dpair (find disp-char (dispatch-tables rt)
-                       :test #'char= :key #'car)))
-      (if dpair
-         (elt (the simple-vector (cdr dpair))
-              (char-code sub-char))
-         (error "~S is not a dispatch char." disp-char)))))
+  (let* ((sub-char (char-upcase sub-char))
+         (rt (or rt *standard-readtable*))
+         (dpair (find disp-char (dispatch-tables rt)
+                      :test #'char= :key #'car)))
+    (if dpair
+        (let ((dispatch-fun (elt (the simple-vector (cdr dpair))
+                                 (char-code sub-char))))
+         ;; Digits are also initialized in a dispatch table to
+         ;; #'dispatch-char-error; READ-DISPATCH-CHAR handles them
+         ;; separately. - CSR, 2002-04-12
+          (if (eq dispatch-fun #'dispatch-char-error)
+              nil
+              dispatch-fun))
+        (error "~S is not a dispatch char." disp-char))))
 
 (defun read-dispatch-char (stream char)
   ;; Read some digits.
index b3eecb2..233a35a 100644 (file)
   (set-dispatch-macro-character #\# #\| #'sharp-vertical-bar)
   (set-dispatch-macro-character #\# #\p #'sharp-p)
   (set-dispatch-macro-character #\# #\P #'sharp-p)
-  (set-dispatch-macro-character #\# #\  #'sharp-illegal)
   (set-dispatch-macro-character #\# #\) #'sharp-illegal)
   (set-dispatch-macro-character #\# #\< #'sharp-illegal)
-  ;; FIXME: Should linefeed/newline go in this list too?
-  (dolist (cc '#.(list tab-char-code form-feed-char-code return-char-code))
+  (set-dispatch-macro-character #\# #\Space #'sharp-illegal)
+  (dolist (cc '#.(list tab-char-code form-feed-char-code return-char-code
+                       line-feed-char-code backspace-char-code))
     (set-dispatch-macro-character #\# (code-char cc) #'sharp-illegal)))
index f5bc4fd..7b433e3 100644 (file)
   (character character callable &optional readtable) function
   (unsafe))
 (defknown get-dispatch-macro-character
-  (character character &optional (or readtable null)) callable
-  (flushable))
+  (character character &optional (or readtable null)) (or callable null)
+  ())
 
 ;;; may return any type due to eof-value...
 (defknown (read read-preserving-whitespace read-char-no-hang read-char)
index 0e20313..f1d2a01 100644 (file)
 ;;; pathname), or NIL if we're not currently cold loading any object file
 (defvar *cold-load-filename* nil)
 (declaim (type (or string null) *cold-load-filename*))
-
-;;; This is vestigial support for the CMU CL byte-swapping code. CMU
-;;; CL code tested for whether it needed to swap bytes in GENESIS by
-;;; comparing the byte order of *BACKEND* to the byte order of
-;;; *NATIVE-BACKEND*, a concept which doesn't exist in SBCL. Instead,
-;;; in SBCL byte order swapping would need to be explicitly requested
-;;; with a &KEY argument to GENESIS.
-;;;
-;;; I'm not sure whether this is a problem or not, and I don't have a
-;;; machine with different byte order to test to find out for sure.
-;;; The version of the system which is fed to the cross-compiler is
-;;; now written in a subset of Common Lisp which doesn't require
-;;; dumping a lot of things in such a way that machine byte order
-;;; matters. (Mostly this is a matter of not using any specialized
-;;; array type unless there's portable, high-level code to dump it.)
-;;; If it *is* a problem, and you're trying to resurrect this code,
-;;; please test particularly carefully, since I haven't had a chance
-;;; to test the byte-swapping code at all. -- WHN 19990816
-;;;
-;;; When this variable is non-NIL, byte-swapping is enabled wherever
-;;; classic GENESIS would have done it. I.e. the value of this variable
-;;; is the logical complement of
-;;;    (EQ (SB!C:BACKEND-BYTE-ORDER SB!C:*NATIVE-BACKEND*)
-;;;    (SB!C:BACKEND-BYTE-ORDER SB!C:*BACKEND*))
-;;; from CMU CL.
-(defvar *genesis-byte-order-swap-p*)
 \f
 ;;;; miscellaneous stuff to read and write the core memory
 
   "Push THING onto the given cold-load LIST."
   `(setq ,list (cold-cons ,thing ,list)))
 
-(defun maybe-byte-swap (word)
-  (declare (type (unsigned-byte 32) word))
-  (aver (= sb!vm:n-word-bits 32))
-  (aver (= sb!vm:n-byte-bits 8))
-  (if (not *genesis-byte-order-swap-p*)
-      word
-      (logior (ash (ldb (byte 8 0) word) 24)
-             (ash (ldb (byte 8 8) word) 16)
-             (ash (ldb (byte 8 16) word) 8)
-             (ldb (byte 8 24) word))))
-
-(defun maybe-byte-swap-short (short)
-  (declare (type (unsigned-byte 16) short))
-  (aver (= sb!vm:n-word-bits 32))
-  (aver (= sb!vm:n-byte-bits 8))
-  (if (not *genesis-byte-order-swap-p*)
-      short
-      (logior (ash (ldb (byte 8 0) short) 8)
-             (ldb (byte 8 8) short))))
-
 ;;; BYTE-VECTOR-REF-32 and friends.  These are like SAP-REF-n, except
 ;;; that instead of a SAP we use a byte vector
 (macrolet ((make-byte-vector-ref-n
         (bytes (gspace-bytes gspace))
         (byte-index (ash (+ index (descriptor-word-offset address))
                          sb!vm:word-shift))
-        ;; KLUDGE: Do we really need to do byte swap here? It seems
-        ;; as though we shouldn't.. (This attempts to be a literal
-        ;; translation of CMU CL code, and I don't have a big-endian
-        ;; machine to test it.) -- WHN 19990817
-        (value (maybe-byte-swap (byte-vector-ref-32 bytes byte-index))))
+        (value (byte-vector-ref-32 bytes byte-index)))
     (make-random-descriptor value)))
 
 (declaim (ftype (function (descriptor) descriptor) read-memory))
                                                 sb!vm:lowtag-mask)
                                       (ash index sb!vm:word-shift))
                                    value)
-    ;; Note: There's a MAYBE-BYTE-SWAP in here in CMU CL, which I
-    ;; think is unnecessary now that we're doing the write
-    ;; byte-by-byte at high level. (I can't test this, though..) --
-    ;; WHN 19990817
     (let* ((bytes (gspace-bytes (descriptor-intuit-gspace address)))
           (byte-index (ash (+ index (descriptor-word-offset address))
                               sb!vm:word-shift)))
       (setf (byte-vector-ref-32 bytes byte-index)
-           (maybe-byte-swap (descriptor-bits value))))))
+           (descriptor-bits value)))))
 
 (declaim (ftype (function (descriptor descriptor)) write-memory))
 (defun write-memory (address value)
@@ -2951,16 +2897,6 @@ initially undefined function references:~2%")
 ;;;     the executable which will load the core.
 ;;;   MAP-FILE-NAME gets (?) a map file. (dunno about this -- WHN 19990815)
 ;;;
-;;; other arguments:
-;;;   BYTE-ORDER-SWAP-P controls whether GENESIS tries to swap bytes
-;;;     in some places in the output. It's only appropriate when
-;;;     cross-compiling from a machine with one byte order to a
-;;;     machine with the opposite byte order, which is irrelevant in
-;;;     current (19990816) SBCL, since only the X86 architecture is
-;;;     supported. If you're trying to add support for more
-;;;     architectures, see the comments on DEFVAR
-;;;     *GENESIS-BYTE-ORDER-SWAP-P* for more information.
-;;;
 ;;; FIXME: GENESIS doesn't belong in SB!VM. Perhaps in %KERNEL for now,
 ;;; perhaps eventually in SB-LD or SB-BOOT.
 (defun sb!vm:genesis (&key
@@ -2968,8 +2904,7 @@ initially undefined function references:~2%")
                      symbol-table-file-name
                      core-file-name
                      map-file-name
-                     c-header-file-name
-                     byte-order-swap-p)
+                     c-header-file-name)
 
   (when (and core-file-name
             (not symbol-table-file-name))
@@ -3011,7 +2946,6 @@ initially undefined function references:~2%")
 
     (let* ((*foreign-symbol-placeholder-value* (if core-file-name nil 0))
           (*load-time-value-counter* 0)
-          (*genesis-byte-order-swap-p* byte-order-swap-p)
           (*cold-fdefn-objects* (make-hash-table :test 'equal))
           (*cold-symbols* (make-hash-table :test 'equal))
           (*cold-package-symbols* nil)
index acbb303..46f4db2 100644 (file)
 (in-package "CL-USER")
 
 (assert (equal (symbol-name '#:|fd\sA|) "fdsA"))
+
+;;; Prior to sbcl-0.7.2.10, SBCL disobeyed the ANSI requirements on
+;;; returning NIL for unset dispatch-macro-character functions (bug
+;;; 151, fixed by Alexey Dejenka sbcl-devel "bug 151" 2002-04-12)
+(assert (not (get-dispatch-macro-character #\# #\{)))
+(assert (not (get-dispatch-macro-character #\# #\0)))
+;;; and we might as well test that we don't have any cross-compilation
+;;; shebang residues left...
+(assert (not (get-dispatch-macro-character #\# #\!)))
+;;; also test that all the illegal sharp macro characters are
+;;; recognized as being illegal.
+(loop for char in '(#\Backspace #\Tab #\Newline #\Linefeed
+                    #\Page #\Return #\Space #\) #\<)
+   do (assert (get-dispatch-macro-character #\# char)))
+
+(assert (not (ignore-errors (get-dispatch-macro-character #\! #\0)
+                            t)))
index cb24730..57f9f34 100644 (file)
@@ -18,4 +18,4 @@
 ;;; for internal versions, especially for internal versions off the
 ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
 
-"0.7.2.9"
+"0.7.2.10"