Previous: objects codes reloc offset, Up: objects codes reloc [Index]
NOTE This record type is currently not used. Is it really needed? Can its use allow operations not possible with 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 code
object. When these records are processed: a 32-bit byte offset is
computed and 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 |----|----|----| jump label offset record 1st 2nd 3rd
Let’s imagine the following scenario in Assembly language, in which a
jmp
instruction is used to jump directly to another entry point
by specifying the target address as an immediate value:
... jmp L_target ... ... L_target: ...
such operation can be implemented also as:
... jmp-pc-relative (L_target - L_after_jmp) L_after_jmp: ... ... L_target: ...
in which the jump is to the address at a computable offset from the
jmp-pc-relative
instruction; the target address is computed at
run–time, by the CPU executing the jmp-pc-relative
instruction, by adding the constant offset L_target - L_after_jmp
to the value of the Instruction Pointer Register (or Program Counter
Register).
The “jump to label–offset” records are used to implement this
scenario, in which: the jmp-pc-relative
instruction is in the
subject code object; the target label is in the subordinate code object.
The third word in the record contains the tagged pointer to the
subordinate Scheme code object. The second word in the record contains
a fixnum which, unpacked to iksword_t
, represents the constant to
add to a tagged pointer to the subordinate code object to obtain the
offset of the target label:
meta data machine code |---------|--------------|---|-----| subject code object ^ L_after_jmp |..............|...| displacement 32-bit meta data machine code |---------|------------|-----------| subordinate code object ^ L_target |......................| offset - code_primary_tag
At present, the code handles only 32-bit offsets.
Previous: objects codes reloc offset, Up: objects codes reloc [Index]