G-Vectors contain Lisp objects. The format is as follows:
------------------------------------------------------------------ | Fixnum code (5) | Subtype (3) | Allocated length (24) | ------------------------------------------------------------------ | Vector entry 0 (Additional entries in subsequent words) | ------------------------------------------------------------------
The first word of the vector is a header indicating its length; the remaining words hold the boxed entries of the vector, one entry per 32-bit word. The header word is of type fixnum. It contains a 3-bit subtype field, which is used to indicate several special types of general vectors. At present, the following subtype codes are defined:
Following the subtype is a 24-bit field indicating how many 32-bit words are allocated for this vector, including the header word. Legal indices into the vector range from zero to the number in the allocated length field minus 2, inclusive. Normally, the index is checked on every access to the vector. Entry 0 is stored in the second word of the vector, and subsequent entries follow contiguously in virtual memory.
Once a vector has been allocated, it is possible to reduce its length by using the Shrink-Vector miscop, but never to increase its length, even back to the original size, since the space freed by the reduction may have been reclaimed. This reduction simply stores a new smaller value in the length field of the header word.
It is not an error to create a vector of length 0, though it will always be an out-of-bounds error to access such an object. The maximum possible length for a general vector is 224-2 entries, and that can’t fit in the available space. The maximum length is 223-2 entries, and that is only possible if no other general vectors are present in the space.
Bignums are identical in format to G-Vectors although each entry is a 32-bit integer, and thus only assembler routines should ever access an entry.
Objects of type Function and Array are identical in format to general vectors, though they have their own spaces.