DIRECT ATOM
<< 3
<< 3
...
A direct atom is an atom which fits in a machine word, less one bit for the tag. It is stored directly.
64-BIT MACHINE WORD
Nouns are represented as machine words with the MSBs as tag bits.
Legend:Yellow - dataDark green - pointer tagPurple - pointerOrange - metadataLight blue - sizeGrey - reserved
0
CELL POINTER
HEAD
METADATA
TAIL
A cell is represented as a tagged pointer. The memory referenced is adjacent machine words.The machine word at the pointer is metadata. The machine word directly following (higher in memory)is the noun representation of the head, followed by the noun representation of the tail. The metadatafield is primarily used for the mug.
INDIRECT ATOM
An indirect atom is an atom which is too big to be a direct atom. It is thus represented as a taggedpointer. The memory referenced is 64-bit aligned. The first 64 bits are metadata, followed by the size in 64-bit words, then the actual value of the atom. The metadata field is primarily used forthe mug. The first three bits of the size are reserved for a possible forwarding pointer tag.
FORWARDING POINTER - CELL
When a cell is copied from one stack frame to another, its head is replaced with a forwarding pointer to the new location.
1
0
1
1
0
SIZE
METADATA
DATA
FORWARDING POINTER - INDIRECT ATOM
When an indirect atom is copied from one stack frame to another, its size is replaced with aforwarding pointer.
METADATA
DATA
<< 3
...
1
0
FORWARDING POINTER
FORWARDING POINTER
METADATA
TAIL
<< 3
1
1
0
1
1
1
1
1
1