Next: , Previous: , Up: objects codes reloc   [Index]


13.23.3.3 Records of type: offset in object

These records are composed of 3 words: the second word contains a fixnum which, unpacked to iksword_t, represents a byte offset; the third word contains the tagged pointer to a subordinate Scheme object. When these records are processed: the tagged pointer is added to the offset in bytes and the result is stored in the target word in the data area of the subject code object:

   meta data         data area
  |.........|..........................|

s_code   p_data
  v         v
  |---------|--------------|---|-------| code object
            |..............|...|target word
      ------->displacement   ^
     |                       |
     |       ----------------
     |      |
     |  off + obj
  |----|----|----| offset in object record
   1st  2nd  3rd

Records of this type are used when the subject code object uses a pointer to a word in the code block of the subordinate Scheme object:

      pointer ---
                 |
                 v
|--------------|---|----------| subordinate Scheme object
|..............|...|
  displacement  word

the pointer to the word is the sum between:

  1. The tagged pointer to the subordinate code object.
  2. A constant that untags the tagged pointer to the subordinate code object.
  3. A constant representing the displacement of the word in the memory block of the subordinate Scheme object.

the offset stored in the relocation vector is the sum between the latter two constants.

Example: common routines

Every Scheme function makes use of some common machine code routines: to validate the number of arguments, to validate the number of returned values, as implementation of call-with-values and other operations. Such routines are compiled into code objects.

When the subject code object calls such routines, it does it by jumping directly to the entry point in the machine code; for each routine used by the subject code object, a relocation vector record is added containing:

  1. A tagged pointer to the code object implementing the routine.
  2. A fixnum which, unpacked to iksword_t, represents the constant off_code_tag.

adding off_code_tag to the tagged pointer yields the address of the machine code entry point.


Next: , Previous: , Up: objects codes reloc   [Index]