abcl
abcl copied to clipboard
How does array upgrading work?
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))
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.
(upgraded-array-element-type '(unsigned-byte 17)) should return (UNSIGNED-BYTE 32)?
(upgraded-array-element-type '(unsigned-byte 17))should return(UNSIGNED-BYTE 32)?
Ah, I reproduced that as a bug now. Re-opening.