VM: merge full_collector.hpp into full_collector.cpp
parent
a7757eed41
commit
beb71ce49b
|
@ -115,7 +115,6 @@ ifdef CONFIG
|
||||||
vm/slot_visitor.hpp \
|
vm/slot_visitor.hpp \
|
||||||
vm/collector.hpp \
|
vm/collector.hpp \
|
||||||
vm/to_tenured_collector.hpp \
|
vm/to_tenured_collector.hpp \
|
||||||
vm/full_collector.hpp \
|
|
||||||
vm/arrays.hpp \
|
vm/arrays.hpp \
|
||||||
vm/math.hpp \
|
vm/math.hpp \
|
||||||
vm/byte_arrays.hpp \
|
vm/byte_arrays.hpp \
|
||||||
|
|
|
@ -2,6 +2,28 @@
|
||||||
|
|
||||||
namespace factor {
|
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,
|
/* 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
|
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,
|
compiler triggers a GC, and the caller block gets GCd as a result,
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
|
@ -133,7 +133,6 @@ namespace factor { struct factor_vm; }
|
||||||
#include "slot_visitor.hpp"
|
#include "slot_visitor.hpp"
|
||||||
#include "collector.hpp"
|
#include "collector.hpp"
|
||||||
#include "to_tenured_collector.hpp"
|
#include "to_tenured_collector.hpp"
|
||||||
#include "full_collector.hpp"
|
|
||||||
#include "arrays.hpp"
|
#include "arrays.hpp"
|
||||||
#include "math.hpp"
|
#include "math.hpp"
|
||||||
#include "byte_arrays.hpp"
|
#include "byte_arrays.hpp"
|
||||||
|
|
Loading…
Reference in New Issue