From 8a55e8e2feb7fd0faaaed6d420beec97dade94e4 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 8 Oct 2002 08:24:06 +0000 Subject: [PATCH] 0.7.8.20: Fix the small-data-vector-ref/c issue for PPC, following the solution for SPARC ... and make the test a little more exhaustive --- BUGS | 4 ++++ src/compiler/ppc/array.lisp | 23 ++++++++++++++++------- tests/array.pure.lisp | 21 +++++++++++++++++++-- version.lisp-expr | 2 +- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/BUGS b/BUGS index b823166..c0b8f47 100644 --- a/BUGS +++ b/BUGS @@ -422,6 +422,10 @@ WORKAROUND: (I haven't tried to investigate this bug enough to guess whether there might be any user-level symptoms.) + In fact, the type system is likely to depend on this inequality not + holding... * is not equivalent to T in many cases, such as + (VECTOR *) /= (VECTOR T). + 94a: Inconsistencies between derived and declared VALUES return types for DEFUN aren't checked very well. E.g. the logic which successfully diff --git a/src/compiler/ppc/array.lisp b/src/compiler/ppc/array.lisp index 8239a8f..f1e2683 100644 --- a/src/compiler/ppc/array.lisp +++ b/src/compiler/ppc/array.lisp @@ -1,6 +1,14 @@ -;;; -;;; Written by William Lott -;;; +;;;; array operations for the PPC VM + +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. + (in-package "SB!VM") @@ -180,9 +188,11 @@ (:result-types positive-fixnum) (:temporary (:scs (non-descriptor-reg)) temp) (:generator 15 - (multiple-value-bind (word extra) (floor index ,elements-per-word) + (multiple-value-bind (word extra) + (floor index ,elements-per-word) (setf extra (logxor extra (1- ,elements-per-word))) - (let ((offset (- (* (+ word sb!vm:vector-data-offset) sb!vm:n-word-bytes) + (let ((offset (- (* (+ word sb!vm:vector-data-offset) + sb!vm:n-word-bytes) sb!vm:other-pointer-lowtag))) (cond ((typep offset '(signed-byte 16)) (inst lwz result object offset)) @@ -190,8 +200,7 @@ (inst lr temp offset) (inst lwzx result object temp)))) (unless (zerop extra) - (inst srwi result result - (logxor (* extra ,bits) ,(1- elements-per-word)))) + (inst srwi result result (* ,bits extra))) (unless (= extra ,(1- elements-per-word)) (inst andi. result result ,(1- (ash 1 bits))))))) (define-vop (,(symbolicate 'data-vector-set/ type)) diff --git a/tests/array.pure.lisp b/tests/array.pure.lisp index 65a8a60..4e665ed 100644 --- a/tests/array.pure.lisp +++ b/tests/array.pure.lisp @@ -62,8 +62,24 @@ (aref x 12)))))) (error "error not thrown in COMPILED-DECLARED-AREF ~S" form)))))) -;;; On the SPARC, until sbcl-0.7.7.20, there was a bug in array references -;;; for small vector elements (spotted by Raymond Toy). +;;; On the SPARC, until sbcl-0.7.7.20, there was a bug in array +;;; references for small vector elements (spotted by Raymond Toy); the +;;; bug persisted on the PPC until sbcl-0.7.8.20. +(let (vector) + (loop for i below 64 + for list = (make-list 64 :initial-element 1) + do (setf (nth i list) 0) + do (setf vector (make-array 64 :element-type 'bit + :initial-contents list)) + do (assert (= (funcall + (compile nil + `(lambda (rmdr) + (declare (type (simple-array bit (*)) rmdr) + (optimize (speed 3) (safety 0))) + (aref rmdr ,i))) + vector) + 0)))) +#| (assert (= (funcall (lambda (rmdr) (declare (type (simple-array bit (*)) rmdr) @@ -71,3 +87,4 @@ (aref rmdr 0)) #*00000000000000000000000000000001000000000) 0)) +|# \ No newline at end of file diff --git a/version.lisp-expr b/version.lisp-expr index 76cdc82..7458ebb 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; internal versions off the main CVS branch, it gets hairier, e.g. ;;; "0.pre7.14.flaky4.13".) -"0.7.8.19" +"0.7.8.20" -- 1.7.10.4