void factor_vm::fixup_data(cell data_offset, cell code_offset) { slot_visitor<data_fixupper> data_workhorse(this,data_fixupper(data_offset)); data_workhorse.visit_roots(); object_fixupper fixupper(this,data_offset,code_offset); fixup_sizer sizer(data_offset); data->tenured->iterate(fixupper,sizer); }
/* Initialize an object in a newly-loaded image */ void factor_vm::relocate_object(object *object, cell data_relocation_base, cell code_relocation_base) { cell hi_tag = object->h.hi_tag(); /* Tuple relocation is a bit trickier; we have to fix up the layout object before we can get the tuple size, so do_slots is out of the question */ if(hi_tag == TUPLE_TYPE) { tuple *t = (tuple *)object; data_fixup(&t->layout,data_relocation_base); cell *scan = t->data(); cell *end = (cell *)((cell)object + untagged_object_size(object)); for(; scan < end; scan++) data_fixup(scan,data_relocation_base); } else { object_fixupper fixupper(this,data_relocation_base); do_slots((cell)object,fixupper); switch(hi_tag) { case WORD_TYPE: fixup_word((word *)object,code_relocation_base); break; case QUOTATION_TYPE: fixup_quotation((quotation *)object,code_relocation_base); break; case DLL_TYPE: ffi_dlopen((dll *)object); break; case ALIEN_TYPE: fixup_alien((alien *)object); break; case CALLSTACK_TYPE: fixup_callstack_object((callstack *)object,code_relocation_base); break; } } }
void factor_vm::fixup_code(cell data_offset, cell code_offset) { code_block_fixupper fixupper(this,data_offset,code_offset); code->allocator->iterate(fixupper); }
void factor_vm::relocate_code(cell data_relocation_base) { code_block_fixupper fixupper(this,data_relocation_base); iterate_code_heap(fixupper); }
void factor_vm::fixup_callstack_object(callstack *stack, cell code_relocation_base) { stack_frame_fixupper fixupper(this,code_relocation_base); iterate_callstack_object(stack,fixupper); }