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/callstack.hpp \
|
||||||
vm/slot_visitor.hpp \
|
vm/slot_visitor.hpp \
|
||||||
vm/collector.hpp \
|
vm/collector.hpp \
|
||||||
vm/copying_collector.hpp \
|
|
||||||
vm/nursery_collector.hpp \
|
vm/nursery_collector.hpp \
|
||||||
vm/aging_collector.hpp \
|
vm/aging_collector.hpp \
|
||||||
vm/to_tenured_collector.hpp \
|
vm/to_tenured_collector.hpp \
|
||||||
|
|
|
@ -36,7 +36,7 @@ void factor_vm::collect_aging() {
|
||||||
std::swap(data->aging, data->aging_semispace);
|
std::swap(data->aging, data->aging_semispace);
|
||||||
data->reset_aging();
|
data->reset_aging();
|
||||||
|
|
||||||
copying_collector<aging_space, aging_policy> collector(this,
|
collector<aging_space, aging_policy> collector(this,
|
||||||
this->data->aging,
|
this->data->aging,
|
||||||
aging_policy(this));
|
aging_policy(this));
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ template <typename TargetGeneration, typename Policy> struct collector {
|
||||||
cell cards_scanned;
|
cell cards_scanned;
|
||||||
cell decks_scanned;
|
cell decks_scanned;
|
||||||
cell code_blocks_scanned;
|
cell code_blocks_scanned;
|
||||||
|
cell scan;
|
||||||
|
|
||||||
collector(factor_vm* parent, TargetGeneration* target, Policy policy)
|
collector(factor_vm* parent, TargetGeneration* target, Policy policy)
|
||||||
: parent(parent),
|
: parent(parent),
|
||||||
|
@ -79,7 +80,9 @@ template <typename TargetGeneration, typename Policy> struct collector {
|
||||||
visitor(parent, workhorse),
|
visitor(parent, workhorse),
|
||||||
cards_scanned(0),
|
cards_scanned(0),
|
||||||
decks_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) {
|
void trace_code_heap_roots(std::set<code_block*>* remembered_set) {
|
||||||
std::set<code_block*>::const_iterator iter = remembered_set->begin();
|
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 "callstack.hpp"
|
||||||
#include "slot_visitor.hpp"
|
#include "slot_visitor.hpp"
|
||||||
#include "collector.hpp"
|
#include "collector.hpp"
|
||||||
#include "copying_collector.hpp"
|
|
||||||
#include "nursery_collector.hpp"
|
#include "nursery_collector.hpp"
|
||||||
#include "aging_collector.hpp"
|
#include "aging_collector.hpp"
|
||||||
#include "to_tenured_collector.hpp"
|
#include "to_tenured_collector.hpp"
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace factor {
|
||||||
void factor_vm::collect_nursery() {
|
void factor_vm::collect_nursery() {
|
||||||
/* Copy live objects from the nursery (as determined by the root set and
|
/* Copy live objects from the nursery (as determined by the root set and
|
||||||
marked cards in aging and tenured) to aging space. */
|
marked cards in aging and tenured) to aging space. */
|
||||||
copying_collector<aging_space, nursery_policy> collector(this,
|
collector<aging_space, nursery_policy> collector(this,
|
||||||
this->data->aging,
|
this->data->aging,
|
||||||
nursery_policy(this));
|
nursery_policy(this));
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,6 @@ struct factor_vm {
|
||||||
void end_gc();
|
void end_gc();
|
||||||
void set_current_gc_op(gc_op op);
|
void set_current_gc_op(gc_op op);
|
||||||
void start_gc_again();
|
void start_gc_again();
|
||||||
void update_code_heap_for_minor_gc(std::set<code_block*>* remembered_set);
|
|
||||||
void collect_nursery();
|
void collect_nursery();
|
||||||
void collect_aging();
|
void collect_aging();
|
||||||
void collect_to_tenured();
|
void collect_to_tenured();
|
||||||
|
|
Loading…
Reference in New Issue