From ed5ac62f0691fb6adb040bd317a7a10d2a5f158b Mon Sep 17 00:00:00 2001 From: dtc <dtc> Date: Sun, 24 Aug 1997 03:46:45 +0000 Subject: [PATCH] Add a source transform for array-header-p to handle some cases in which the result can be determined from the argument type. This stops compiler warning messages produced by the with-array-data macro when the array is known not to be a subtype of (simple-array * (*)). --- compiler/array-tran.lisp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/compiler/array-tran.lisp b/compiler/array-tran.lisp index 76449e95b..e4fcd9112 100644 --- a/compiler/array-tran.lisp +++ b/compiler/array-tran.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/array-tran.lisp,v 1.19 1997/04/01 19:23:56 dtc Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/array-tran.lisp,v 1.20 1997/08/24 03:46:45 dtc Exp $") ;;; ;;; ********************************************************************** ;;; @@ -580,3 +580,23 @@ (deftransform bit-not ((bit-array-1 result-bit-array) (bit-vector (constant-argument t))) '(bit-not bit-array-1 bit-array-1)) + + +;;; ARRAY-HEADER-P -- transform. +;;; +;;; Pick off some constant cases. +;;; +(deftransform array-header-p ((array) (array)) + (let ((type (continuation-type array))) + (declare (optimize (safety 3))) + (unless (array-type-p type) + (give-up)) + (let ((dims (array-type-dimensions type))) + (cond ((csubtypep type (specifier-type '(simple-array * (*)))) + ;; No array header. + nil) + ((and (listp dims) (> (length dims) 1)) + ;; Multi-dimensional array, will have a header. + t) + (t + (give-up)))))) -- GitLab