2 docCopyright("Steve Dekorte", 2002)
3 docLicense("BSD revised")
9 #include "Common_inline.h"
10 #ifdef IO_DECLARE_INLINES
12 // inspecting markers -------------------
14 IOINLINE
int Collector_markerIsWhite_(Collector
*self
, CollectorMarker
*m
)
16 return (self
->whites
->color
== m
->color
);
19 IOINLINE
int Collector_markerIsGray_(Collector
*self
, CollectorMarker
*m
)
21 return (COLLECTOR_GRAY
== m
->color
);
24 IOINLINE
int Collector_markerIsBlack_(Collector
*self
, CollectorMarker
*m
)
26 return (self
->blacks
->color
== m
->color
);
29 // changing marker colors -------------------
31 IOINLINE
void Collector_makeFree_(Collector
*self
, CollectorMarker
*v
)
33 CollectorMarker_removeAndInsertAfter_((CollectorMarker
*)v
, self
->freed
);
36 IOINLINE
void Collector_makeWhite_(Collector
*self
, CollectorMarker
*v
)
38 CollectorMarker_removeAndInsertAfter_((CollectorMarker
*)v
, self
->whites
);
41 IOINLINE
void Collector_makeGray_(Collector
*self
, CollectorMarker
*v
)
43 CollectorMarker_removeAndInsertAfter_((CollectorMarker
*)v
, self
->grays
);
46 IOINLINE
void Collector_makeBlack_(Collector
*self
, CollectorMarker
*v
)
48 CollectorMarker_removeAndInsertAfter_((CollectorMarker
*)v
, self
->blacks
);
51 IOINLINE
void Collector_makeGrayIfWhite_(Collector
*self
, void *v
)
53 if (Collector_markerIsWhite_(self
, (CollectorMarker
*)v
))
55 Collector_makeGray_(self
, v
);
60 IOINLINE void Collector_makeFreed_(Collector *self, void *v)
62 CollectorMarker_removeAndInsertAfter_(v, self->freed);
66 IOINLINE
void *Collector_value_addingRefTo_(Collector
*self
, void *v
, void *ref
)
68 if (Collector_markerIsBlack_(self
, (CollectorMarker
*)v
) && Collector_markerIsWhite_(self
, (CollectorMarker
*)ref
))
70 Collector_makeGray_(self
, ref
);