]> gitweb.factorcode.org Git - factor.git/blob - native/memory.h
450eb593d2777b14eb6174fc9722cd2b72e318f3
[factor.git] / native / memory.h
1 typedef struct {
2         CELL base;
3         CELL here;
4         CELL limit;
5 } ZONE;
6
7 ZONE* z1;
8 ZONE* z2;
9 ZONE* active; /* either z1 or z2 */
10 ZONE* prior; /* if active==z1, z2; if active==z2, z1 */
11
12 void init_arena(CELL size);
13 void flip_zones();
14
15 CELL allot(CELL a);
16
17 INLINE CELL align8(CELL a)
18 {
19         return ((a & 7) == 0) ? a : ((a + 8) & ~7);
20 }
21
22 INLINE CELL get(CELL where)
23 {
24         return *((CELL*)where);
25 }
26
27 INLINE void put(CELL where, CELL what)
28 {
29         *((CELL*)where) = what;
30 }
31
32 INLINE CHAR cget(CELL where)
33 {
34         return *((CHAR*)where);
35 }
36
37 INLINE void cput(CELL where, CHAR what)
38 {
39         *((CHAR*)where) = what;
40 }
41
42 INLINE BYTE bget(CELL where)
43 {
44         return *((BYTE*)where);
45 }
46
47 INLINE void bput(CELL where, BYTE what)
48 {
49         *((BYTE*)where) = what;
50 }
51
52 bool in_zone(ZONE* z, CELL pointer);
53
54 void primitive_room(void);