VM: Refactor tenured_space.hpp to Factor style
parent
238e9d9810
commit
bd66094e1b
|
@ -1,53 +1,37 @@
|
||||||
namespace factor
|
namespace factor {
|
||||||
{
|
|
||||||
|
|
||||||
struct tenured_space : free_list_allocator<object> {
|
struct tenured_space : free_list_allocator<object> {
|
||||||
object_start_map starts;
|
object_start_map starts;
|
||||||
|
|
||||||
explicit tenured_space(cell size, cell start) :
|
explicit tenured_space(cell size, cell start)
|
||||||
free_list_allocator<object>(size,start), starts(size,start) {}
|
: free_list_allocator<object>(size, start), starts(size, start) {}
|
||||||
|
|
||||||
object *allot(cell size)
|
object* allot(cell size) {
|
||||||
{
|
object* obj = free_list_allocator<object>::allot(size);
|
||||||
object *obj = free_list_allocator<object>::allot(size);
|
if (obj) {
|
||||||
if(obj)
|
|
||||||
{
|
|
||||||
starts.record_object_start_offset(obj);
|
starts.record_object_start_offset(obj);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell first_object()
|
cell first_object() {
|
||||||
{
|
return (cell) next_allocated_block_after(this->first_block());
|
||||||
return (cell)next_allocated_block_after(this->first_block());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cell next_object_after(cell scan)
|
cell next_object_after(cell scan) {
|
||||||
{
|
cell size = ((object*)scan)->size();
|
||||||
cell size = ((object *)scan)->size();
|
object* next = (object*)(scan + size);
|
||||||
object *next = (object *)(scan + size);
|
return (cell) next_allocated_block_after(next);
|
||||||
return (cell)next_allocated_block_after(next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_mark_bits()
|
void clear_mark_bits() { state.clear_mark_bits(); }
|
||||||
{
|
|
||||||
state.clear_mark_bits();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool marked_p(object *obj)
|
bool marked_p(object* obj) { return this->state.marked_p(obj); }
|
||||||
{
|
|
||||||
return this->state.marked_p(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_marked_p(object *obj)
|
void set_marked_p(object* obj) { this->state.set_marked_p(obj); }
|
||||||
{
|
|
||||||
this->state.set_marked_p(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void sweep()
|
void sweep() {
|
||||||
{
|
|
||||||
free_list_allocator<object>::sweep();
|
free_list_allocator<object>::sweep();
|
||||||
starts.update_for_sweep(&this->state);
|
starts.update_for_sweep(&this->state);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue