[armedbear-devel] Support for specialized arrays?
Greetings, I presume ABCL supports specialized arrays (element-type:) syntactically but I am wondering if ABCL actually creates more efficient, type specific, arrays rather than generic, arrays of objects? Thanks. Blake McBride
Figured it out: (array-element-type (make-array '(2 2) :element-type 'fixnum :initial-contents '((1 2)(3 4)))) T It seems all arrays are generic in ABCL. That's okay. Just nice to know. Thanks. Blake On Tue, Oct 25, 2011 at 5:54 PM, Blake McBride <blake@mcbride.name> wrote:
Greetings,
I presume ABCL supports specialized arrays (element-type:) syntactically but I am wondering if ABCL actually creates more efficient, type specific, arrays rather than generic, arrays of objects?
Thanks.
Blake McBride
Blake McBride <blake@mcbride.name> writes:
Figured it out:
(array-element-type (make-array '(2 2) :element-type 'fixnum :initial-contents '((1 2)(3 4))))
T You could check that with (upgraded-array-element-type 'fixnum) => T
And to check all types (loop for symbol being the symbols in :cl when (not (eql t (or (ignore-errors (upgraded-array-element-type symbol)) t))) collect symbol) => (BIT STANDARD-CHAR BASE-CHAR CHARACTER) -- With best regards, Stas.
Hi Stas, Blake, On Wed, Oct 26, 2011 at 11:54 AM, Stas Boukarev <stassats@gmail.com> wrote:
Blake McBride <blake@mcbride.name> writes:
Figured it out:
(array-element-type (make-array '(2 2) :element-type 'fixnum :initial-contents '((1 2)(3 4))))
T You could check that with (upgraded-array-element-type 'fixnum) => T
And to check all types (loop for symbol being the symbols in :cl when (not (eql t (or (ignore-errors (upgraded-array-element-type symbol)) t))) collect symbol) => (BIT STANDARD-CHAR BASE-CHAR CHARACTER)
Seems we need to be better at detecting specializer types: We have types for vectors and arrays of higher rank with elements of: * UNSIGNED-BYTE 8 * UNSIGNED-BYTE 16 * UNSIGNED-BYTE 32 But it seems that the upgraded type of FIXNUM doesn't fit in UNSIGNED-BYTE 32; I'd say we need specialized arrays for SIGNED-BYTE 8, SIGNED-BYTE 32 (aka fixnum) and maybe SIGNED-BYTE 64 (aka JAVA-LONG) as well. It's easy to implement. Nobody did it yet, that's all. BTW: I answered this mail by looking at src/org/armedbear/lisp/make_array.java -- for those interested. Hope that helps. Bye, Erik.
participants (3)
-
Blake McBride
-
Erik Huelsmann
-
Stas Boukarev