Previous: Detecting Cycles, Up: Referable Objects
Objects tracking references to themselves maintain a list of such references.
The list items are the very objects holding the references, known by the
address of one of their attribute, a certain struct x1f4_nodelink_type
one.
See struct x1f4_nodelink_type.
Otherwise stated, objects in the libx1f4i0 type system, those object
holding reference and being referred themselves that is, embed some
struct x1f4_nodelink_type
record. The address at which this record is
stored is offered to the referred objects for reference up tracing purposed.
Such struct x1f4_nodelink_type
record needs to be set up before it is
used. The list of references hold by other objects to itself that one object
maintains is a list of pointers to struct x1f4_nodelink_type
records.
The struct x1f4_nodelink_type
record has some certain slip
field.
The field is the flag space required for tracking the already visited
references when running the cycle detection algorithm. It needs be NULL
outside the algorithm itself.
The other struct x1f4_nodelink_type
record field is some miss
address of some routine determining whether the object for which it is defined
(the object embedding the struct x1f4_nodelink_type
record from which is
was picked up) is referred by some variable(s) and thus not to be freed. The
method is expected to return some non zero value if the object is positively
variable(s) referred, zero otherwise.
When called, the routine indicated by the miss
field will be supplied
with the execution context, some address of some struct
x1f4_nodelink_type
pointer to construct the linked list of visited references
and the address of the struct x1f4_nodelink_type
record from which the
routine itself was picked up, as arguments, in this order.
What such routine would tipically do is:
slip
field
of its last argument. If that's the case it would return zero without further
processing (for else the the cycle detection algorithm might run endlessly).
There may be more cases to check for non zero return: the list size may be zero and equal to the reference count - indicating an object in the process of destruction. Such will happen if the destruction routine sets the count zero before proceeding with the removal of the references hold by the object itself.
See Detecting Cycles.
slip
field of its last argument
with the value of the pointer stored at the address indicated by its second
argument (in effect, the previously visited object) and setting the same
pointer stored at the same address indicated by the same second argument to the
value of its third argument (the address by which the object is to be known),
in this order.
miss
until some non zero return. If such return occurs the method is to return non
zero itself, otherwise the method will return zero. The executed routines will
be supplied with the execution context (the first argument of the executing
routine), the pointer address for the visited reference tracking (the second
argument of the executing routine) and the address of the struct
x1f4_nodelink_type
record from which they were picked up, as arguments, in
this order.