From: Didier Verna
Subject: No shifting in fixnum arrays ?
Date: 
Message-ID: <muxlkulwe2a.fsf@uzeb.lrde.epita.fr>
CL-USER> (setf foo (make-array 10 :element-type 'fixnum :initial-element 1))
#(1 1 1 1 1 1 1 1 1 1)
CL-USER> (kernel:get-lisp-obj-address (aref foo 5))
4


        So, contrary to popular belief (or just my belief, maybe ;-), CMU-CL
doesn't represent fixnums as machine words in a specialized array (so, no
shifting operation is required during array access, and so so, you gain
nothing in using a simple-vector) ???

-- 
Didier Verna, ······@lrde.epita.fr, 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   ······@xemacs.org

From: Christophe Rhodes
Subject: Re: No shifting in fixnum arrays ?
Date: 
Message-ID: <sqwte5ic0x.fsf@cam.ac.uk>
Didier Verna <······@lrde.epita.fr> writes:

> CL-USER> (setf foo (make-array 10 :element-type 'fixnum :initial-element 1))
> #(1 1 1 1 1 1 1 1 1 1)
> CL-USER> (kernel:get-lisp-obj-address (aref foo 5))
> 4
>
>         So, contrary to popular belief (or just my belief, maybe ;-), CMU-CL
> doesn't represent fixnums as machine words in a specialized array (so, no
> shifting operation is required during array access, and so so, you gain
> nothing in using a simple-vector) ???

Um.  Your transcript doesn't demonstrate anything of the sort (though
your conclusion about the representation of fixnum arrays in CMUCL
happens to be correct): by the time GET-LISP-OBJ-ADDRESS gets hold of
its argument, any boxing necessary will already have occurred.  You
potentially gain typesafety (equivalently, you lose polymorphism) by
using a specialized fixnum array, as well as the automatic declaration
of array accesses.  If you want an array of machine words, you can ask
for one.  (Well, you can ask for an array of ([un]signed-byte 32),
anyway).

To give you any more information, you'll have to be clearer about your
point.

Christophe
From: Didier Verna
Subject: Re: No shifting in fixnum arrays ?
Date: 
Message-ID: <muxbqvhwd8y.fsf@uzeb.lrde.epita.fr>
Christophe Rhodes <·····@cam.ac.uk> wrote:

> Um. Your transcript doesn't demonstrate anything of the sort (though your
> conclusion about the representation of fixnum arrays in CMUCL happens to be
> correct): by the time GET-LISP-OBJ-ADDRESS gets hold of its argument, any
> boxing necessary will already have occurred.

        Damn, you're right.

> To give you any more information, you'll have to be clearer about your
> point.

        It's OK. It's just that I read somewhere that fixnums were stored as
machine integers in simple-arrays, so it was more efficient to use
simple-vectors. And I was surprised to see no difference in execution time
when trying the two possibilities.

Thanks.

-- 
Didier Verna, ······@lrde.epita.fr, 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   ······@xemacs.org
From: Marcin 'Qrczak' Kowalczyk
Subject: Re: No shifting in fixnum arrays ?
Date: 
Message-ID: <8764lpb91l.fsf@qrnik.zagroda>
Didier Verna <······@lrde.epita.fr> writes:

> So, contrary to popular belief (or just my belief, maybe ;-), CMU-CL
> doesn't represent fixnums as machine words in a specialized array
> (so, no shifting operation is required during array access, and so
> so, you gain nothing in using a simple-vector) ???

It's possible that an array of fixnums doesn't have to have its
contents scanned on GC, even if its representation is otherwise
the same as a generic array. But I have no idea whether this is
true in CMUCL.

-- 
   __("<         Marcin Kowalczyk
   \__/       ······@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/