1.0.27.40: host-invariant string constant coalescing
authorChristophe Rhodes <csr21@cantab.net>
Fri, 24 Apr 2009 14:26:30 +0000 (14:26 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 24 Apr 2009 14:26:30 +0000 (14:26 +0000)
It took a little time to get right, but here's (I hope) invariant
constant string coalescing in the cross-file-compiler.

3 commit messages follow:

more invariant constant string coalescing

When dumping strings in cross-compilation, we always end up dumping as
base-string.  That means we need to compare all strings of whatever
underlying array type for content equality, not just strings of the same
type.  This shows up when dumping in the same file "BLOCK" and the value
of (symbol-name 'block) under CLISP, which dumps two separate values.

dumping string constants, the other half

Not only do we have to enter entries into the hash table with a known
element-type, we also have to retrieve them... bogosity finally picked
up by use of a CL symbol name (AND) in src/compiler/x86/insts.lisp...

further refinement on constant coalescing

Not only must we coalesce all kinds of strings at fasl dump time, we
must coalesce the constants in our TN representation while we're
compiling, otherwise we will get different lengths of constant vectors
for the same function depending on how many different string
representations there are in the host compiler.

src/compiler/dump.lisp
src/compiler/ir1util.lisp
version.lisp-expr

index 50f253d..6cffe91 100644 (file)
            (type string x))
   (unless *cold-load-dump*
     (let ((handle (cdr (assoc
-                        (array-element-type x)
+                        #+sb-xc-host 'base-char ; for repeatable xc fasls
+                        #-sb-xc-host (array-element-type x)
                         (gethash x (fasl-output-equal-table fasl-output))))))
       (cond
         (handle (dump-push handle fasl-output) t)
            (type string x))
   (unless *cold-load-dump*
     (let ((handle (dump-pop fasl-output)))
-      (push (cons (array-element-type x) handle)
+      (push (cons #+sb-xc-host 'base-char ; repeatable xc fasls
+                  #-sb-xc-host (array-element-type x)
+                  handle)
             (gethash x (fasl-output-equal-table fasl-output)))
       (setf (gethash x (fasl-output-eq-table fasl-output)) handle)
       (dump-push handle fasl-output)))
index 9259405..34a9a58 100644 (file)
                                  ((atom y) (file-coalesce-p y))
                                (unless (file-coalesce-p (car y))
                                  (return nil)))))
-                       ;; We *could* coalesce base-strings as well, but we'd need
-                       ;; a separate hash-table for that, since we are not allowed to
-                       ;; coalesce base-strings with non-base-strings.
-                       (typep x '(or (vector character) bit-vector)))))
+                       ;; We *could* coalesce base-strings as well,
+                       ;; but we'd need a separate hash-table for
+                       ;; that, since we are not allowed to coalesce
+                       ;; base-strings with non-base-strings.
+                       (typep x
+                              '(or bit-vector
+                                ;; in the cross-compiler, we coalesce
+                                ;; all strings with the same contents,
+                                ;; because we will end up dumping them
+                                ;; as base-strings anyway.  In the
+                                ;; real compiler, we're not allowed to
+                                ;; coalesce regardless of string
+                                ;; specialized element type, so we
+                                ;; KLUDGE by coalescing only character
+                                ;; strings (the common case) and
+                                ;; punting on the other types.
+                                #+sb-xc-host
+                                string
+                                #-sb-xc-host
+                                (vector character))))))
              (coalescep (x)
                (if faslp (file-coalesce-p x) (core-coalesce-p x))))
       (if (and (boundp '*constants*) (coalescep object))
index e75c497..9d4c47f 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.27.39"
+"1.0.27.40"