VM: merge full_collector.hpp into full_collector.cpp

db4
Björn Lindqvist 2015-08-04 00:06:57 +02:00
parent a7757eed41
commit beb71ce49b
4 changed files with 22 additions and 27 deletions

View File

@ -115,7 +115,6 @@ ifdef CONFIG
vm/slot_visitor.hpp \
vm/collector.hpp \
vm/to_tenured_collector.hpp \
vm/full_collector.hpp \
vm/arrays.hpp \
vm/math.hpp \
vm/byte_arrays.hpp \

View File

@ -2,6 +2,28 @@
namespace factor {
struct full_policy {
factor_vm* parent;
tenured_space* tenured;
explicit full_policy(factor_vm* parent)
: parent(parent), tenured(parent->data->tenured) {}
bool should_copy_p(object* untagged) {
return !tenured->contains_p(untagged);
}
void promoted_object(object* obj) {
tenured->state.set_marked_p((cell)obj, obj->size());
parent->mark_stack.push_back((cell)obj);
}
void visited_object(object* obj) {
if (!tenured->state.marked_p((cell)obj))
promoted_object(obj);
}
};
/* After a sweep, invalidate any code heap roots which are not marked,
so that if a block makes a tail call to a generic word, and the PIC
compiler triggers a GC, and the caller block gets GCd as a result,

View File

@ -1,25 +0,0 @@
namespace factor {
struct full_policy {
factor_vm* parent;
tenured_space* tenured;
explicit full_policy(factor_vm* parent)
: parent(parent), tenured(parent->data->tenured) {}
bool should_copy_p(object* untagged) {
return !tenured->contains_p(untagged);
}
void promoted_object(object* obj) {
tenured->state.set_marked_p((cell)obj, obj->size());
parent->mark_stack.push_back((cell)obj);
}
void visited_object(object* obj) {
if (!tenured->state.marked_p((cell)obj))
promoted_object(obj);
}
};
}

View File

@ -133,7 +133,6 @@ namespace factor { struct factor_vm; }
#include "slot_visitor.hpp"
#include "collector.hpp"
#include "to_tenured_collector.hpp"
#include "full_collector.hpp"
#include "arrays.hpp"
#include "math.hpp"
#include "byte_arrays.hpp"