From 8f45dd3a5a074998e1aa697ba8f2a8b1b7388427 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Fri, 24 Apr 2009 14:26:30 +0000 Subject: [PATCH] 1.0.27.40: host-invariant string constant coalescing 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 | 7 +++++-- src/compiler/ir1util.lisp | 24 ++++++++++++++++++++---- version.lisp-expr | 2 +- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/compiler/dump.lisp b/src/compiler/dump.lisp index 50f253d..6cffe91 100644 --- a/src/compiler/dump.lisp +++ b/src/compiler/dump.lisp @@ -208,7 +208,8 @@ (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) @@ -238,7 +239,9 @@ (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))) diff --git a/src/compiler/ir1util.lisp b/src/compiler/ir1util.lisp index 9259405..34a9a58 100644 --- a/src/compiler/ir1util.lisp +++ b/src/compiler/ir1util.lisp @@ -1685,10 +1685,26 @@ ((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)) diff --git a/version.lisp-expr b/version.lisp-expr index e75c497..9d4c47f 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4