Objects

Every data other than number is represented by an object which is allocated in heap. Each memory cell of an object has the object header and fixed number of slots for object variables. Since vectors may consist of arbitrary number of elements, they have 'size' slot immediately after the header. Fig. 3 depicts the structures of object and vector, and their header word. Only the words indicated as slot and element are accessible from users.

Figure 3: Structures of object, vector, and object header
\begin{figure}\begin{center}
\mbox{\epsfxsize =10cm
\epsfbox{fig/object.ps}
}
\end{center}
\end{figure}

A header is composed of six fields. Two MSB bits, m and b, are used to indicate the side of the neighbor cell in Fibonacci-buddy memory management. There are three mark bits in the mark field, each of which is used by the garbage collector to identify accessible cells, by the printer to recognize circular objects in printing in #n= and #n# notations, and by copy-object to copy shared objects. The elmt field discriminates one of seven possible data types of vector elements, pointer, bit, character, byte, integer, float and foreign-string. Although elmt can be available in the class, it is provided in the header to make the memory manager independent of the structure of a class and to make the element accessing faster. The bid field represents the physical size of a memory cell. 31 different sizes up to 16 MB are represented by the five bits in this field. The lower short word (16 bits) is used for the class id. This is used to retrieve the class of an object via the system's class table. This class id can be regarded as the type tag of traditional Lisps. Currently only the lower 8 bits of the cid are used and the upper 8 bits are ignored. Therefore, the maximum number of classes is limited to 256, though this limit can be raised up to 65536 by reconfiguring the EusLisp to allocate more memory to the system's class table.

k-okada 2013-05-21