Next: , Previous: , Up: Object Format   [Contents]


40.10 Array Headers

The array-header data-block has the following format:

----------------------------------------------------------------
| Header Len (24 bits) = Array Rank +6   | Array Type (8 bits) |
----------------------------------------------------------------
|               Fill Pointer (30 bits)                   | 0 0 | 
----------------------------------------------------------------
|               Fill Pointer p (29 bits) -- t or nil   | 1 1 1 |
----------------------------------------------------------------
|               Available Elements (30 bits)             | 0 0 | 
----------------------------------------------------------------
|               Data Vector (29 bits)                  | 1 1 1 | 
----------------------------------------------------------------
|               Displacement (30 bits)                   | 0 0 | 
----------------------------------------------------------------
|               Displacedp (29 bits) -- t or nil       | 1 1 1 | 
----------------------------------------------------------------
|               Range of First Index (30 bits)           | 0 0 | 
----------------------------------------------------------------
                              .
                              .
                              .

The array type in the header-word is one of the eight-bit patterns from “Data-Blocks and Other-immediates Typing”, sec-data-blocks-and-header, indicating that this is a complex string, complex vector, complex bit-vector, or a multi-dimensional array. The data portion of the other-immediate word is the length of the array header data-block. Due to its format, its length is always six greater than the array’s number of dimensions. The following words have the following interpretations and types:

Fill Pointer:

This is a fixnum indicating the number of elements in the data vector actually in use. This is the logical length of the array, and it is typically the same value as the next slot. This is the second word, so LENGTH of any array, with or without an array header, is just four bytes off the pointer to it.

Fill Pointer P:

This is either T or NIL and indicates whether the array uses the fill-pointer or not.

Available Elements:

This is a fixnum indicating the number of elements for which there is space in the data vector. This is greater than or equal to the logical length of the array when it is a vector having a fill pointer.

Data Vector:

This is a pointer descriptor referencing the actual data of the array. This a data-block whose first word is a header-word with an array type as described in “Data-Blocks and Header-Word Format”, sec-data-blocks-and-header and “Data-Blocks and Other-immediates Typing”, sec-data-blocks-and-o-i

Displacement:

This is a fixnum added to the computed row-major index for any array. This is typically zero.

Displacedp:

This is either t or nil. This is separate from the displacement slot, so most array accesses can simply add in the displacement slot. The rare need to know if an array is displaced costs one extra word in array headers which probably aren’t very frequent anyway.

Range of First Index:

This is a fixnum indicating the number of elements in the first dimension of the array. Legal index values are zero to one less than this number inclusively. IF the array is zero-dimensional, this slot is non-existent.

... (remaining slots):

There is an additional slot in the header for each dimension of the array. These are the same as the Range of First Index slot.


Next: Bignums, Previous: Symbols and NIL, Up: Object Format   [Contents]