/*#io
docCopyright("Steve Dekorte", 2002)
docLicense("BSD revised")
*/

#define STATE_DEFAULT_COLECT_AFTER 20000

void IoState_updateCachedCollectorColors(IoState *self);

IoObject *IoState_retain_(IoState *self, IoObject *v);

int  IoState_garbageCollectorIsPaused(IoState *self);
void IoState_pushCollectorPause(IoState *self);
void IoState_popCollectorPause(IoState *self);

void IoState_gcInitPhase(IoState *self);
int IoState_gcSweepPhase(IoState *self);

void IoState_gcMarkPhase(IoState *self);
int IoState_hasValue_(IoState *self, IoObject *v);
IoObject *IoState_addValue_(IoState *self, IoObject *v);

void IoState_makeGray_(IoState *self, IoObject *v);
void IoState_makeBlackFromGray_(IoState *self, IoObject *v);
void IoState_makeGrayFromWhite_(IoState *self, IoObject *v);
void IoState_makeGrayFromBlack_(IoState *self, IoObject *v);


void IoState_immediatelyFree_(IoState *self, IoObject *v);
void IoState_immediatelyFreeIfUnreferenced_(IoState *self, IoObject *v);

// weak links 

#ifdef IOWEAKLINK_DEFINED
void IoState_addWeakLink_(IoState *self, IoWeakLink *v);
void IoState_removeWeakLink_(IoState *self, IoWeakLink *v);
void IoState_willFreeWeakLinkedValue_(IoState *self, IoObject *v);
#endif

// persistence 

void IoState_willFreePersistentValue_(IoState *self, IoObject *value);

int IoState_collectGarbage(IoState *self);
void IoState_release_(IoState *self, IoObject *v);

// memory size

size_t IoState_memorySize(IoState *self);
void IoState_compact(IoState *self);

