abcl icon indicating copy to clipboard operation
abcl copied to clipboard

How does array upgrading work?

Open lassik opened this issue 3 years ago • 3 comments

Armed Bear Common Lisp 1.9.0
Java 19 Homebrew
OpenJDK 64-Bit Server VM

How does this:

> (upgraded-array-element-type '(unsigned-byte 16))
(UNSIGNED-BYTE 16)

> (upgraded-array-element-type '(unsigned-byte 17))
T

> (upgraded-array-element-type '(unsigned-byte 31))
T

> (upgraded-array-element-type '(unsigned-byte 32))
(UNSIGNED-BYTE 32)

result in this:

> (type-of (make-array 10 :element-type '(unsigned-byte 17)))
(SIMPLE-ARRAY (UNSIGNED-BYTE 32) (10))

> (type-of (make-array '(10 10) :element-type '(unsigned-byte 17)))
(SIMPLE-ARRAY (UNSIGNED-BYTE 32) (10 10))

> (type-of (make-array '(10 10 10) :element-type '(unsigned-byte 17)))
(SIMPLE-ARRAY (UNSIGNED-BYTE 32) (10 10 10))

lassik avatar Oct 03 '22 06:10 lassik

ABCL is making the decision to promote to a seventeen bit byte to (UNSIGNED-BYTE 32), which is the next optimized size.

It should be able to signal the Bear to attempt to optimize for size by the right declaim form, but that is currently not implementation.

easye avatar Aug 18 '23 17:08 easye

(upgraded-array-element-type '(unsigned-byte 17)) should return (UNSIGNED-BYTE 32)?

lassik avatar Aug 19 '23 12:08 lassik

(upgraded-array-element-type '(unsigned-byte 17)) should return (UNSIGNED-BYTE 32)?

Ah, I reproduced that as a bug now. Re-opening.

easye avatar Aug 20 '23 07:08 easye