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-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
|
|
|
if(allot_profiling)
|
|
|
|
allot_profile_step(align8(a));
|
2004-08-16 20:42:30 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-03-21 20:59:30 -05:00
|
|
|
INLINE u16 cget(CELL where)
|
2004-07-16 02:26:21 -04:00
|
|
|
{
|
2005-03-21 20:59:30 -05:00
|
|
|
return *((u16*)where);
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
2005-03-21 20:59:30 -05:00
|
|
|
INLINE void cput(CELL where, u16 what)
|
2004-07-16 02:26:21 -04:00
|
|
|
{
|
2005-03-21 20:59:30 -05:00
|
|
|
*((u16*)where) = what;
|
2004-07-16 02:26:21 -04:00
|
|
|
}
|
|
|
|
|
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-18 22:29:29 -04:00
|
|
|
void primitive_address(void);
|
2005-02-18 20:37:01 -05:00
|
|
|
void primitive_size(void);
|
|
|
|
|
|
|
|
/* A heap walk allows useful things to be done, like finding all
|
|
|
|
references to an object for debugging purposes. */
|
|
|
|
CELL heap_scan_ptr;
|
|
|
|
|
|
|
|
/* End of heap when walk was started; prevents infinite loop if
|
|
|
|
walk consing */
|
|
|
|
CELL heap_scan_end;
|
|
|
|
|
|
|
|
void primitive_begin_scan(void);
|
|
|
|
void primitive_next_object(void);
|
|
|
|
void primitive_end_scan(void);
|