VM: cleanups, like removing redundant paranthesis and removing method
declarations that doesn't existdb4
parent
8f02cad9c5
commit
3887b58c02
|
@ -3,14 +3,11 @@
|
|||
namespace factor {
|
||||
|
||||
struct aging_policy {
|
||||
factor_vm* parent;
|
||||
aging_space* aging;
|
||||
tenured_space* tenured;
|
||||
|
||||
explicit aging_policy(factor_vm* parent)
|
||||
: parent(parent),
|
||||
aging(parent->data->aging),
|
||||
tenured(parent->data->tenured) {}
|
||||
: aging(parent->data->aging), tenured(parent->data->tenured) {}
|
||||
|
||||
bool should_copy_p(object* untagged) {
|
||||
return !(aging->contains_p(untagged) || tenured->contains_p(untagged));
|
||||
|
|
|
@ -94,11 +94,11 @@ void data_heap::reset_tenured() {
|
|||
}
|
||||
|
||||
bool data_heap::high_fragmentation_p() {
|
||||
return (tenured->largest_free_block() <= high_water_mark());
|
||||
return tenured->largest_free_block() <= high_water_mark();
|
||||
}
|
||||
|
||||
bool data_heap::low_memory_p() {
|
||||
return (tenured->free_space() <= high_water_mark());
|
||||
return tenured->free_space() <= high_water_mark();
|
||||
}
|
||||
|
||||
void data_heap::mark_all_cards() {
|
||||
|
|
|
@ -187,15 +187,15 @@ void factor_vm::gc(gc_op op, cell requested_size) {
|
|||
}
|
||||
|
||||
void factor_vm::primitive_minor_gc() {
|
||||
gc(collect_nursery_op, 0 /* requested size */);
|
||||
gc(collect_nursery_op, 0);
|
||||
}
|
||||
|
||||
void factor_vm::primitive_full_gc() {
|
||||
gc(collect_full_op, 0 /* requested size */);
|
||||
gc(collect_full_op, 0);
|
||||
}
|
||||
|
||||
void factor_vm::primitive_compact_gc() {
|
||||
gc(collect_compact_op, 0 /* requested size */);
|
||||
gc(collect_compact_op, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -211,7 +211,7 @@ object* factor_vm::allot_large_object(cell type, cell size) {
|
|||
|
||||
/* If it still won't fit, grow the heap */
|
||||
if (!data->tenured->can_allot_p(requested_size)) {
|
||||
gc(collect_growing_heap_op, size /* requested size */);
|
||||
gc(collect_growing_heap_op, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
namespace factor {
|
||||
|
||||
struct nursery_policy {
|
||||
factor_vm* parent;
|
||||
bump_allocator* nursery;
|
||||
|
||||
explicit nursery_policy(factor_vm* parent) : parent(parent) {}
|
||||
explicit nursery_policy(bump_allocator* nursery) : nursery(nursery) {}
|
||||
|
||||
bool should_copy_p(object* obj) {
|
||||
return parent->data->nursery->contains_p(obj);
|
||||
return nursery->contains_p(obj);
|
||||
}
|
||||
|
||||
void promoted_object(object* obj) {}
|
||||
|
@ -17,11 +17,12 @@ struct nursery_policy {
|
|||
};
|
||||
|
||||
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. */
|
||||
collector<aging_space, nursery_policy> collector(this,
|
||||
this->data->aging,
|
||||
nursery_policy(this));
|
||||
nursery_policy policy(this->data->nursery);
|
||||
collector<aging_space, nursery_policy>
|
||||
collector(this, this->data->aging, policy);
|
||||
|
||||
collector.visitor.visit_all_roots();
|
||||
gc_event* event = current_gc->event;
|
||||
|
|
|
@ -87,9 +87,9 @@ segment::segment(cell size_, bool executable_p) {
|
|||
|
||||
int prot;
|
||||
if (executable_p)
|
||||
prot = (PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||
prot = PROT_READ | PROT_WRITE | PROT_EXEC;
|
||||
else
|
||||
prot = (PROT_READ | PROT_WRITE);
|
||||
prot = PROT_READ | PROT_WRITE;
|
||||
|
||||
char* array = (char*)mmap(NULL, pagesize + size + pagesize, prot,
|
||||
MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
|
|
|
@ -368,8 +368,6 @@ struct factor_vm {
|
|||
void collect_compact();
|
||||
void collect_growing_heap(cell requested_size);
|
||||
void gc(gc_op op, cell requested_size);
|
||||
void scrub_context(context* ctx);
|
||||
void scrub_contexts();
|
||||
void primitive_minor_gc();
|
||||
void primitive_full_gc();
|
||||
void primitive_compact_gc();
|
||||
|
|
Loading…
Reference in New Issue