[Q] row-major-aref inlining

Didier Verna <[email protected]> Sun, 09 Apr 2006 16:25:22 +0200
Newsgroups gmane.lisp.allegro
Message-ID <[email protected]>
        Hi !

Consider the following code:


(declaim (optimize (speed 3)
		   (compilation-speed 0)
		   (safety 0)
		   (debug 0)))

(defun assign (array value)
  (declare (:explain :boxing :calls :types))
  (declare (type (simple-array single-float (* *)) array))
  (declare (type single-float value))
  (let ((size (array-total-size array)))
    (dotimes (i size)
      (declare (type (integer 0 100) i))
      (setf (row-major-aref array i) value))))

ACL tells me that it is unable to inling the calls to array-total-size and
row-major-aref. Am I correct in assuming that's because the actual sizes of
the array are unknown ?

But what worries me more is that it also says it's generating a single-float
box. I guess this box is to pass VALUE to the array setter. Again, am I
correct ?

Did I miss a way to improve this code (I mean, keeping row-major-aref as the
access method) ?


Thank you !

-- 
Didier Verna, [email protected], http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-BicĂȘtre, France   Fax.+33 (1) 53 14 59 22   [email protected]