3 struct must_start_gc_again {
6 template <typename TargetGeneration, typename Policy>
7 struct gc_workhorse : no_fixup {
8 static const bool translated_code_block_map = false;
11 TargetGeneration* target;
15 gc_workhorse(factor_vm* parent, TargetGeneration* target, Policy policy)
16 : parent(parent), target(target), policy(policy), code(parent->code) {}
18 object* fixup_data(object* obj) {
19 FACTOR_ASSERT((parent->current_gc &&
20 parent->current_gc->op == collect_growing_heap_op) ||
21 parent->data->seg->in_segment_p((cell)obj));
23 if (!policy.should_copy_p(obj)) {
24 policy.visited_object(obj);
28 // is there another forwarding pointer?
29 while (obj->forwarding_pointer_p()) {
30 object* dest = obj->forwarding_pointer();
34 if (!policy.should_copy_p(obj)) {
35 policy.visited_object(obj);
39 cell size = obj->size();
40 object* newpointer = target->allot(size);
42 throw must_start_gc_again();
44 memcpy(newpointer, obj, size);
45 obj->forward_to(newpointer);
47 policy.promoted_object(newpointer);
52 code_block* fixup_code(code_block* compiled) {
53 if (!code->allocator->state.marked_p((cell)compiled)) {
54 code->allocator->state.set_marked_p((cell)compiled, compiled->size());
55 parent->mark_stack.push_back((cell)compiled + 1);