instruction_operand callback_heap::callback_operand(code_block *stub, cell index) { tagged<array> code_template(parent->special_objects[CALLBACK_STUB]); tagged<byte_array> relocation_template(array_nth(code_template.untagged(),0)); relocation_entry entry(relocation_template->data<relocation_entry>()[index]); return instruction_operand(entry,stub,0); }
void jit::emit_relocation(cell relocation_template_) { data_root<byte_array> relocation_template(relocation_template_, parent); cell capacity = array_capacity(relocation_template.untagged()) / sizeof(relocation_entry); relocation_entry* relocations = relocation_template->data<relocation_entry>(); for (cell i = 0; i < capacity; i++) { relocation_entry entry = relocations[i]; relocation_entry new_entry(entry.rel_type(), entry.rel_class(), entry.rel_offset() + code.count); relocation.append_bytes(&new_entry, sizeof(relocation_entry)); } }