]> gitweb.factorcode.org Git - factor.git/blob - vm/zone.hpp
merge project-euler.factor
[factor.git] / vm / zone.hpp
1 namespace factor
2 {
3
4 struct zone {
5         /* allocation pointer is 'here'; its offset is hardcoded in the
6         compiler backends */
7         cell start;
8         cell here;
9         cell size;
10         cell end;
11
12         zone(cell size_, cell start_) : start(start_), here(0), size(size_), end(start_ + size_) {}
13
14         inline bool contains_p(object *pointer)
15         {
16                 return ((cell)pointer - start) < size;
17         }
18
19         inline object *allot(cell size)
20         {
21                 cell h = here;
22                 here = h + align8(size);
23                 return (object *)h;
24         }
25 };
26
27 }