예제 #1
0
파일: callbacks.cpp 프로젝트: PGGB/factor
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);
}
예제 #2
0
  template <typename Iterator> void each_instruction_operand(Iterator& iter) {
    if (!to_boolean(relocation))
      return;

    byte_array* rels = untag<byte_array>(relocation);

    cell index = 0;
    cell length = untag_fixnum(rels->capacity) / sizeof(relocation_entry);

    for (cell i = 0; i < length; i++) {
      relocation_entry rel = rels->data<relocation_entry>()[i];
      iter(instruction_operand(rel, this, index));
      index += rel.number_of_parameters();
    }
  }