2009-10-07 16:48:09 -04:00
|
|
|
namespace factor
|
|
|
|
{
|
|
|
|
|
2009-10-20 23:20:49 -04:00
|
|
|
struct tenured_space : free_list_allocator<object> {
|
2009-10-20 14:47:04 -04:00
|
|
|
object_start_map starts;
|
|
|
|
|
2009-10-25 00:02:58 -04:00
|
|
|
explicit tenured_space(cell size, cell start) :
|
2009-10-20 23:20:49 -04:00
|
|
|
free_list_allocator<object>(size,start), starts(size,start) {}
|
2009-10-20 14:47:04 -04:00
|
|
|
|
|
|
|
object *allot(cell size)
|
|
|
|
{
|
2009-10-20 23:20:49 -04:00
|
|
|
object *obj = free_list_allocator<object>::allot(size);
|
|
|
|
if(obj)
|
|
|
|
{
|
|
|
|
starts.record_object_start_offset(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cell first_object()
|
|
|
|
{
|
2009-10-27 22:31:28 -04:00
|
|
|
return (cell)next_allocated_block_after(this->first_block());
|
2009-10-20 23:20:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
cell next_object_after(cell scan)
|
|
|
|
{
|
|
|
|
cell size = ((object *)scan)->size();
|
|
|
|
object *next = (object *)(scan + size);
|
2009-10-27 22:31:28 -04:00
|
|
|
return (cell)next_allocated_block_after(next);
|
2009-10-20 23:20:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void clear_mark_bits()
|
|
|
|
{
|
|
|
|
state.clear_mark_bits();
|
|
|
|
}
|
2009-10-20 14:47:04 -04:00
|
|
|
|
2009-10-20 23:20:49 -04:00
|
|
|
bool marked_p(object *obj)
|
|
|
|
{
|
|
|
|
return this->state.marked_p(obj);
|
|
|
|
}
|
|
|
|
|
2009-11-23 19:51:08 -05:00
|
|
|
void set_marked_p(object *obj)
|
2009-10-20 23:20:49 -04:00
|
|
|
{
|
|
|
|
this->state.set_marked_p(obj);
|
2009-10-20 14:47:04 -04:00
|
|
|
}
|
2009-11-01 21:15:42 -05:00
|
|
|
|
|
|
|
void sweep()
|
|
|
|
{
|
|
|
|
free_list_allocator<object>::sweep();
|
|
|
|
starts.update_for_sweep(&this->state);
|
|
|
|
}
|
2009-10-07 16:48:09 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|