Next: Heap and relocatable areas, Previous: Memory management, Up: Memory management
Each ECL object belongs to one of the 22 implementation types. The
implementation types are shown in Table 4-1 with the corresponding Common-Lisp
data types. In the table, the compiled functions are divided into three
implementation types; cfun
is the type of compiled functions without
environment, cclosure
is the type of compiled functions with environment
(i.e., the type of compiled closures) and gfun
is the type of compiled
generic functions of CLOS.
Implementation Type | Common-Lisp Data Type
|
cons | cons
|
fixnum | fixnum
|
bignum | bignum
|
ratio | ratio
|
short-float | short-float
|
long-float | long-float (= double-float = single-float)
|
complex | complex
|
character | character
|
symbol | symbol
|
package | package
|
hash-table | hash-table
|
array | (and array (not vector))
|
vector | (and vector (not string) (not bit-vector))
|
string | string
|
bit-vector | bit-vector
|
structure | structure
|
stream | stream
|
random-state | random-state
|
readtable | readtable
|
cfun | compiled-function without environment
|
cclosure | compiled-function with environment
|
gfun | none (CLOS generic-function)
|
instance | none (CLOS instance)
|
thread | none (thread)
|
|
Each object is represented by a cell allocated in the heap area of the interpreter. The size of the cell is determined by the implementation type of the object.
The implementation types are classified according to the size of the cells for the objects of the type, as shown in Table 4-2. The size of the cells in the same type class is the same.
1 | CONS BIGNUM RATIO COMPLEX STRUCTURE
|
2 | SHORT-FLOAT RANDOM-STATE READTABLE
|
3 | LONG-FLOAT CFUN CCLOSURE
|
4 | SYMBOL
|
5 | PACKAGE
|
6 | ARRAY HASH-TABLE VECTOR BIT-VECTOR STREAM
|
7 | STRING
|
8 | PATHNAME
|
For objects of the (implementation) types readtable
, symbol
,
package
, array
, hash-table
, vector
,
bit-vector
, stream
, cclosure
, string
, cfun
,
and structure
(or instance
), the cell is simply a header of the
object. The body of the object is allocated separately from the cell and is
managed in a different manner. The memory space occupied by the body of such
an object is called a block. A block is either contiguous or
relocatable depending on the area in which it is allocated. The
difference between the two areas will be explained below. Table 4-3 lists
these types, along with the contents of the body and the kind of the block.
readtable | read table | contiguous
|
symbol | symbol name | relocatable
|
package | hash table | contiguous
|
array | array body | relocatable or contiguous
|
hash-table | hash table | relocatable
|
vector | vector body | relocatable or contiguous
|
bit-vector | bit-vector body | relocatable or contiguous
|
stream | I/O buffer | contiguous
|
cclosure | code | contiguous
|
string | string body | relocatable or contiguous
|
cfun | code | contiguous
|
structure | structure body | relocatable
|
instance | instance slots | relocatable
|
thread | thread data | contiguous
|
Usually, the body of an array, a vector, a bit-vector, or a string is allocated
as a relocatable block. In ECL, the function make-array
takes an
extra keyword argument :static. If the :static argument is supplied
with a non-() value, then the body of the array is allocated as a
contiguous block.