]> gitweb.factorcode.org Git - factor.git/blob - vm/aging_space.hpp
Merge branch 'new_gc' of git://factorcode.org/git/factor into new_gc
[factor.git] / vm / aging_space.hpp
1 namespace factor
2 {
3
4 struct aging_space : bump_allocator<object> {
5         object_start_map starts;
6
7         explicit aging_space(cell size, cell start) :
8                 bump_allocator<object>(size,start), starts(size,start) {}
9
10         object *allot(cell size)
11         {
12                 if(here + size > end) return NULL;
13
14                 object *obj = bump_allocator<object>::allot(size);
15                 starts.record_object_start_offset(obj);
16                 return obj;
17         }
18
19         cell next_object_after(cell scan)
20         {
21                 cell size = ((object *)scan)->size();
22                 if(scan + size < here)
23                         return scan + size;
24                 else
25                         return 0;
26         }
27 };
28
29 }