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