VM: Refactor aging_space to Factor style

db4
Erik Charlebois 2013-05-11 21:40:14 -04:00
parent ee9fd64b69
commit 6c919e7d72
1 changed files with 11 additions and 12 deletions

View File

@ -1,20 +1,19 @@
namespace factor namespace factor {
{
struct aging_space : bump_allocator<object> { struct aging_space : bump_allocator<object> {
object_start_map starts; object_start_map starts;
explicit aging_space(cell size, cell start) : explicit aging_space(cell size, cell start)
bump_allocator<object>(size,start), starts(size,start) {} : bump_allocator<object>(size, start), starts(size, start) {}
object *allot(cell size) object* allot(cell size) {
{ if (here + size > end)
if(here + size > end) return NULL; return NULL;
object *obj = bump_allocator<object>::allot(size); object* obj = bump_allocator<object>::allot(size);
starts.record_object_start_offset(obj); starts.record_object_start_offset(obj);
return obj; return obj;
} }
}; };
} }