2009/7/30 Leslie P. Polzer <sky@...>:
> Nikodemus Siivola wrote:
>>> While working on the ARRAY-IN-BOUNDS-P transform
>>> I've noticed that it would be nice to have access to
>>> the derived types of the array's dimensions' LVAR.
>>> This way we could do some additional optimization for
>>> interval types.
>>> Is there an established way to access such information,
>>> or to pass through this information? If not, would the
>>> addition of a free-form IR1-INFO slot in the LVAR class
>>> be acceptable?
>> I'm not entirely sure what you mean by this. Do you have an example?
> Let's say we create an array like this:
> (make-array (random 5))
> Then the array dimension LVAR will have the interval type [0..4].
> Unfortunately by the time we are at something like
> (deftransform array-in-bounds-p ...)
> for the array in question we only (to my knowledge) have access
> to the array's type specifier whose dimensions won't be known
> because they are not constant.
Ah... I think I would try to extend ARRAY-TYPE objects so that
dimensions are expressed by types instead of integers. Then
DERIVE-TYPE optimizer for MAKE-ARRAY would just have to fill them in
appropriately -- and consumers of ARRAY-TYPE objects need to change of
There may be some interesting generality available by make it possible
to associate LVAR which generate derived bounds of different sorts
with types expressing those bounds, but that is clearly a more
A semirelated thing is this:
(dotimes (i (length simple-1d-array))
(foo (aref simple-1d-array i)))
As long as there are no other assignments to I, the bounds-checks on
AREF could be eliminated, if we were able to annotate the types