VM: the copying_collector only contained one method, so it can easily be
merged with its base classdb4
parent
685a795aa0
commit
e4bb3058e0
|
@ -115,7 +115,6 @@ ifdef CONFIG
|
|||
vm/callstack.hpp \
|
||||
vm/slot_visitor.hpp \
|
||||
vm/collector.hpp \
|
||||
vm/copying_collector.hpp \
|
||||
vm/nursery_collector.hpp \
|
||||
vm/aging_collector.hpp \
|
||||
vm/to_tenured_collector.hpp \
|
||||
|
|
|
@ -36,9 +36,9 @@ void factor_vm::collect_aging() {
|
|||
std::swap(data->aging, data->aging_semispace);
|
||||
data->reset_aging();
|
||||
|
||||
copying_collector<aging_space, aging_policy> collector(this,
|
||||
this->data->aging,
|
||||
aging_policy(this));
|
||||
collector<aging_space, aging_policy> collector(this,
|
||||
this->data->aging,
|
||||
aging_policy(this));
|
||||
|
||||
collector.visitor.visit_all_roots();
|
||||
collector.cheneys_algorithm();
|
||||
|
|
|
@ -69,6 +69,7 @@ template <typename TargetGeneration, typename Policy> struct collector {
|
|||
cell cards_scanned;
|
||||
cell decks_scanned;
|
||||
cell code_blocks_scanned;
|
||||
cell scan;
|
||||
|
||||
collector(factor_vm* parent, TargetGeneration* target, Policy policy)
|
||||
: parent(parent),
|
||||
|
@ -79,7 +80,9 @@ template <typename TargetGeneration, typename Policy> struct collector {
|
|||
visitor(parent, workhorse),
|
||||
cards_scanned(0),
|
||||
decks_scanned(0),
|
||||
code_blocks_scanned(0) {}
|
||||
code_blocks_scanned(0) {
|
||||
scan = target->start + target->occupied_space();
|
||||
}
|
||||
|
||||
void trace_code_heap_roots(std::set<code_block*>* remembered_set) {
|
||||
std::set<code_block*>::const_iterator iter = remembered_set->begin();
|
||||
|
@ -173,6 +176,13 @@ template <typename TargetGeneration, typename Policy> struct collector {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cheneys_algorithm() {
|
||||
while (scan && scan < this->target->here) {
|
||||
this->visitor.visit_object((object*)scan);
|
||||
scan = this->target->next_object_after(scan);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
namespace factor {
|
||||
|
||||
template <typename TargetGeneration, typename Policy>
|
||||
struct copying_collector : collector<TargetGeneration, Policy> {
|
||||
cell scan;
|
||||
|
||||
copying_collector(factor_vm* parent, TargetGeneration* target,
|
||||
Policy policy)
|
||||
: collector<TargetGeneration, Policy>(parent, target, policy),
|
||||
scan(target->here) {}
|
||||
|
||||
void cheneys_algorithm() {
|
||||
while (scan && scan < this->target->here) {
|
||||
this->visitor.visit_object((object*)scan);
|
||||
scan = this->target->next_object_after(scan);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
|
@ -135,7 +135,6 @@ namespace factor { struct factor_vm; }
|
|||
#include "callstack.hpp"
|
||||
#include "slot_visitor.hpp"
|
||||
#include "collector.hpp"
|
||||
#include "copying_collector.hpp"
|
||||
#include "nursery_collector.hpp"
|
||||
#include "aging_collector.hpp"
|
||||
#include "to_tenured_collector.hpp"
|
||||
|
|
|
@ -5,9 +5,9 @@ namespace factor {
|
|||
void factor_vm::collect_nursery() {
|
||||
/* Copy live objects from the nursery (as determined by the root set and
|
||||
marked cards in aging and tenured) to aging space. */
|
||||
copying_collector<aging_space, nursery_policy> collector(this,
|
||||
this->data->aging,
|
||||
nursery_policy(this));
|
||||
collector<aging_space, nursery_policy> collector(this,
|
||||
this->data->aging,
|
||||
nursery_policy(this));
|
||||
|
||||
collector.visitor.visit_all_roots();
|
||||
gc_event* event = current_gc->event;
|
||||
|
|
Loading…
Reference in New Issue