Next: objects codes gc, Previous: objects codes ops, Up: objects codes [Index]
The relocation vector is a Scheme vector referenced by the meta data of a code object. In this documentation we refer to the code object associated to a relocation vector as the “subject code object”. The relocation vector can be empty. The relocation vector is divided into records, each some words long:
0 1 2 3 4 5 6 7 |-----|-----|-----|-----|-----|-----|-----|-----| reloc vector |...........|.................|.................| 1st record 2nd record 3rd record
the first word in each record contains a fixnum which must be interpreted as bit field (this fixnum is never zero). The layout of the first machine word in a record is:
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 ... |----|----|----|----|----|----|----|----| ........................|.........|.........| 1st word number of bytes record tag fixnum tag
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 ... |----|----|----|----|----|----|----|----| ...................|.........|..............| 1st word number of bytes record tag fixnum tag
The 2 least significant bits of the fixnum’s data represent a type tag for the record:
#b00
Record referencing a vanilla Scheme object.
#b01
Record referencing the address of a C function.
#b10
Record referencing an offset in the memory block of a Scheme object.
#b11
Record referencing an entry point in a code object.
the remaining most significant bits of the fixnum’s data area represent a number of bytes, a displacement in the data area of the subject code object selecting a target word:
meta data machine code |---------|----------------+---+-------| code object |................|...| displacement target word
The purpose of each record in the relocation vector is to provide operands from which a value for the target word can be computed and stored in the middle of machine code; this way the machine code can easily use it. When the subject code object is created: the values must be computed and stored. Every time the garbage collector moves the subject code object: the values must be recomputed and updated. Whenever the subject code object is serialised into a FASL file: the relocation vector is serialised along with the code.
To allow inspection and comprehension of the records, the function
code-reloc-vector->sexp
transforms a relocation vector into a
human readable symbolic expression (see code-reloc-vector->sexp).
• objects codes reloc vanilla: | Records of type: vanilla object. | |
• objects codes reloc foreign: | Records of type: foreign address. | |
• objects codes reloc offset: | Records of type: offset in object. | |
• objects codes reloc jump: | Records of type: jump to label-offset. |
Next: objects codes gc, Previous: objects codes ops, Up: objects codes [Index]