2004-07-16 02:26:21 -04:00
|
|
|
typedef struct {
|
|
|
|
CELL base;
|
|
|
|
CELL here;
|
2004-07-29 17:18:41 -04:00
|
|
|
CELL alarm;
|
2004-07-16 02:26:21 -04:00
|
|
|
CELL limit;
|
|
|
|
} ZONE;
|
|
|
|
|
2004-08-31 20:31:16 -04:00
|
|
|
ZONE active;
|
|
|
|
ZONE prior;
|
2004-07-16 02:26:21 -04:00
|
|
|
|
2004-08-29 03:20:19 -04:00
|
|
|
bool allot_profiling;
|
|
|
|
|
2004-08-12 02:13:43 -04:00
|
|
|
void* alloc_guarded(CELL size);
|
2004-08-31 20:31:16 -04:00
|
|
|
void init_zone(ZONE* zone, CELL size);
|
2004-07-16 02:26:21 -04:00
|
|
|
void init_arena(CELL size);
|
|
|
|
void flip_zones();
|
|
|
|
|
2004-08-16 20:42:30 -04:00
|
|
|
void check_memory(void);
|
2004-08-29 03:20:19 -04:00
|
|
|
void allot_profile_step(CELL a);
|
2004-07-16 02:26:21 -04:00
|
|
|
|
|
|
|
INLINE CELL align8(CELL a)
|
|
|
|
{
|
|
|
|
return ((a & 7) == 0) ? a : ((a + 8) & ~7);
|
|
|
|
}
|
|
|
|
|
2004-08-16 20:42:30 -04:00
|
|
|
INLINE void* allot(CELL a)
|
|
|
|
{
|
2004-08-31 20:31:16 -04:00
|
|
|
CELL h = active.here;
|
|
|
|
active.here += align8(a);
|
2004-08-29 03:20:19 -04:00
|
|
|
#ifdef FACTOR_PROFILER
|
|
|
|
if(allot_profiling)
|
|
|
|
allot_profile_step(align8(a));
|
|
|
|
#endif
|
2004-08-16 20:42:30 -04:00
|
|
|
check_memory();
|
|
|
|
return (void*)h;
|
|
|
|
}
|
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
INLINE CELL get(CELL where)
|
|
|
|
{
|
|
|
|
return *((CELL*)where);
|
|
|
|
}
|
|
|
|
|
|
|
|
INLINE void put(CELL where, CELL what)
|
|
|
|
{
|
|
|
|
*((CELL*)where) = what;
|
|
|
|
}
|
|
|
|
|
|
|
|
INLINE CHAR cget(CELL where)
|
|
|
|
{
|
|
|
|
return *((CHAR*)where);
|
|
|
|
}
|
|
|
|
|
|
|
|
INLINE void cput(CELL where, CHAR what)
|
|
|
|
{
|
|
|
|
*((CHAR*)where) = what;
|
|
|
|
}
|
|
|
|
|
2004-09-02 22:53:50 -04:00
|
|
|
INLINE BYTE bget(CELL where)
|
2004-07-23 20:35:13 -04:00
|
|
|
{
|
2004-09-02 22:53:50 -04:00
|
|
|
return *((BYTE*)where);
|
2004-07-23 20:35:13 -04:00
|
|
|
}
|
|
|
|
|
2004-09-02 22:53:50 -04:00
|
|
|
INLINE void bput(CELL where, BYTE what)
|
2004-07-23 20:35:13 -04:00
|
|
|
{
|
2004-09-02 22:53:50 -04:00
|
|
|
*((BYTE*)where) = what;
|
2004-07-23 20:35:13 -04:00
|
|
|
}
|
|
|
|
|
2004-07-16 02:26:21 -04:00
|
|
|
bool in_zone(ZONE* z, CELL pointer);
|
2004-07-24 00:54:57 -04:00
|
|
|
|
|
|
|
void primitive_room(void);
|
2004-08-29 03:20:19 -04:00
|
|
|
void primitive_allot_profiling(void);
|
2004-09-06 22:39:12 -04:00
|
|
|
void primitive_address_of(void);
|