2009/5/6 James Y Knight <foom@...>:
> On May 6, 2009, at 12:28 PM, Nikodemus Siivola wrote:
>> Add a new slot, ARRAY-DISPLACED-FROM, to array-headers, and store a
>> list of weak backpointers to arrays displaced to the array in
>> question there. SET-ARRAY-HEADER (as part of ADJUST-ARRAY) now
>> checks this list, and signals an error if any of the displaced-from
>> arrays is larger than the new size.
> This seems somewhat poor, as it means that programs' proper execution
> depends on when the GC collects the discarded displaced arrays.
> Might it not be better to shrink or mark as unusable the displaced-
> from arrays?
You are perfectly correct. I missed the obvious.
A slightly more sanitary arrangement has been committed as 188.8.131.52:
When adjusting an array so that it becomes too small to hold an array
displaced to it, invalidate the displaced array by setting all its
dimensions to zero (also zero out fill pointer and total size). This
causes typechecks with specified dimensions to catch, as well as any
bounds-checked accesses. The second piece is to signal an
INVALID-ARRAY-ERROR instead of the INVALID-ARRAY-INDEX-ERROR or
vanilla TYPE-ERROR when encountering one of these neutered arrays
(identifiable from the original dimensions we have stashed away before