From 1fd80272bd0a0510113978a33066622e4fd506a7 Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Sun, 18 Aug 2002 13:55:26 +0000 Subject: [PATCH] 0.7.6.26: comment tweaking fixed bug 192, "constant-folding DATA-VECTOR-REF", by adding an ordinary DEFUN definition of D-V-R --- BUGS | 38 -------------------------------------- NEWS | 5 ++++- make.sh | 8 ++------ src/code/array.lisp | 6 ++++++ src/cold/snapshot.lisp | 19 +++++++++++++++++++ src/pcl/fngen.lisp | 1 - tests/compiler.impure.lisp | 37 +++++++++++++++++++++++++++++++++++++ version.lisp-expr | 2 +- 8 files changed, 69 insertions(+), 47 deletions(-) diff --git a/BUGS b/BUGS index 1749fca..48a6a4b 100644 --- a/BUGS +++ b/BUGS @@ -1441,44 +1441,6 @@ WORKAROUND: c. the examples in CLHS 7.6.5.1 (regarding generic function lambda lists and &KEY arguments) do not signal errors when they should. -192: "constant-folding DATA-VECTOR-REF" - (from Einar Floystad Dorum sbcl-devel 14 Aug 2002) - Typing this - (defun test () - (funcall - (LAMBDA (TEXT I L ) - (LABELS ((G908 (I) - (LET ((INDEX - (OR - (IF (= I L) - NIL - (LET ((S TEXT) - (E (ELT TEXT I))) - (DECLARE (IGNORABLE S E)) - (WHEN (EQL #\a E) - (G909 (1+ I)))))))) - INDEX)) - (G909 (I) - (OR - (IF (= I L) - NIL - (LET ((S TEXT) - (E (ELT TEXT I))) - (DECLARE (IGNORABLE S E)) - (WHEN (EQL #\b E) (G910 (1+ I))))))) - (G910 (I) - (LET ((INDEX - (OR - (IF NIL - NIL - (LET ((S TEXT)) - (DECLARE (IGNORABLE S)) - (WHEN T I)))))) - INDEX))) - (G908 I))) "abcdefg" 0 (length "abcdefg"))) - at the command prompt in sbcl-0.7.6.23 gives - (BUG "full call to SB-KERNEL:DATA-VECTOR-REF"). - DEFUNCT CATEGORIES OF BUGS IR1-#: These labels were used for bugs related to the old IR1 interpreter. diff --git a/NEWS b/NEWS index c517832..d9d5817 100644 --- a/NEWS +++ b/NEWS @@ -1226,7 +1226,10 @@ changes in sbcl-0.7.7 relative to sbcl-0.7.6: * Bug fix: changed encoding of PCL's internal MAKE-INSTANCE functions so that EXPORTing the name of the class doesn't cause MAKE-INSTANCE functions from earlier DEFCLASSes to get lost (thanks - to Antonio Martinez) + to Antonio Martinez for reporting this) + * Bug 192 fixed: The internal primitive DATA-VECTOR-REF can now be + constant-folded without failing an assertion. (thanks to Einar + Floystad Dorum for reporting this) * Minor incompatible change: COMPILE-FILE-PATHNAME now merges its OUTPUT-FILE argument with its INPUT-FILE argument, resulting in behaviour analogous to RENAME-FILE. This puts its behaviour more diff --git a/make.sh b/make.sh index 14dd17c..6aa8f99 100755 --- a/make.sh +++ b/make.sh @@ -35,12 +35,8 @@ # "lisp -noinit -batch" # to use an existing CMU CL binary as a cross-compilation host # when you have weird things in your .cmucl-init file -# Someday any sufficiently ANSI Common Lisp, perhaps CLISP and/or -# OpenMCL should work -# "clisp" -# "??" -# but not yet as of sbcl-0.7.4. (There are still some weird dependencies -# on idiosyncrasies of the way CMU CL implements Common Lisp.) +# "openmcl --batch" +# to use an OpenMCL binary as a cross-compilation host # # FIXME: Make a more sophisticated command line parser, probably # accepting "sh make.sh --xc-host foolisp" instead of the diff --git a/src/code/array.lisp b/src/code/array.lisp index 360514d..f4791de 100644 --- a/src/code/array.lisp +++ b/src/code/array.lisp @@ -333,6 +333,12 @@ index)))) *specialized-array-element-types*)))) +;;; (Ordinary DATA-VECTOR-REF usage compiles into a vop, but +;;; DATA-VECTOR-REF is also FOLDABLE, and this ordinary function +;;; definition is needed for the compiler to use in constant folding.) +(defun data-vector-ref (array index) + (hairy-data-vector-ref array index)) + (defun hairy-data-vector-set (array index new-value) (with-array-data ((vector array) (index index) (end)) (declare (ignore end)) diff --git a/src/cold/snapshot.lisp b/src/cold/snapshot.lisp index 846c06f..a52d1ca 100644 --- a/src/cold/snapshot.lisp +++ b/src/cold/snapshot.lisp @@ -1,4 +1,23 @@ ;;;; code to detect whether a package has changed +;;;; +;;;; This is really old code which was most useful when first +;;;; bootstrapping SBCL when only CMU CL was available as an XC host. +;;;; Its main purpose was to check that legacy code like DEFMACRO +;;;; DOLIST and DEFUN IR1-OPTIMIZE-UNTIL-DONE was all correctly +;;;; converted from code which mutated the XC host into code which +;;;; built things for the target. +;;;; +;;;; These days, things like DEFUN IR1-OPTIMIZE-UNTIL-DONE can't very +;;;; well be mutating the cross-compiler host because we can build +;;;; successfully under OpenMCL, which shouldn't have the same +;;;; packages or symbols. So we don't need to worry very much about +;;;; modifying the XC host's private packages. However, it's still +;;;; conceivable that something affecting the XC host's CL package +;;;; (maybe DEFMACRO DOLIST?) could be written in such a way that it +;;;; would silently compile under SBCL, CMU CL, and even OpenMCL, and +;;;; still be fundamentally wrong. Since it'd be good to prevent such +;;;; modifications of the XC host's CL package, this code is still +;;;; retained despite being a little strange. ;;;; This software is part of the SBCL system. See the README file for ;;;; more information. diff --git a/src/pcl/fngen.lisp b/src/pcl/fngen.lisp index 7564c76..5a1222a 100644 --- a/src/pcl/fngen.lisp +++ b/src/pcl/fngen.lisp @@ -190,4 +190,3 @@ (defun load-function-generator (test gensyms generator generator-lambda system) (store-fgen (make-fgen test gensyms generator generator-lambda system))) - diff --git a/tests/compiler.impure.lisp b/tests/compiler.impure.lisp index 7806b50..af77b04 100644 --- a/tests/compiler.impure.lisp +++ b/tests/compiler.impure.lisp @@ -159,6 +159,43 @@ (logand a0 a10) ;; a call to prevent the other arguments from being optimized away (logand a1 a2 a3 a4 a5 a6 a7 a8 a9))) + +;;; bug 192, reported by Einar Floystad Dorum: Compiling this in 0.7.6 +;;; caused the compiler to try to constant-fold DATA-VECTOR-REF, which +;;; is OK, except that there was no non-VOP definition of +;;; DATA-VECTOR-REF, so it would fail. +(defun bug192 () + (funcall + (LAMBDA (TEXT I L ) + (LABELS ((G908 (I) + (LET ((INDEX + (OR + (IF (= I L) + NIL + (LET ((S TEXT) + (E (ELT TEXT I))) + (DECLARE (IGNORABLE S E)) + (WHEN (EQL #\a E) + (G909 (1+ I)))))))) + INDEX)) + (G909 (I) + (OR + (IF (= I L) + NIL + (LET ((S TEXT) + (E (ELT TEXT I))) + (DECLARE (IGNORABLE S E)) + (WHEN (EQL #\b E) (G910 (1+ I))))))) + (G910 (I) + (LET ((INDEX + (OR + (IF NIL + NIL + (LET ((S TEXT)) + (DECLARE (IGNORABLE S)) + (WHEN T I)))))) + INDEX))) + (G908 I))) "abcdefg" 0 (length "abcdefg"))) ;;; BUG 48a. and b. (symbol-macrolet handling), fixed by Eric Marsden ;;; and Raymond Toy for CMUCL, fix ported for sbcl-0.7.6.18. diff --git a/version.lisp-expr b/version.lisp-expr index 6bbbd47..99b7acd 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.6.25" +"0.7.6.26" -- 1.7.10.4