NAME
src/pmc/addrregistry.pmc - A GC Registry PMC
DESCRIPTION
The AddrRegistry class provides the equivalence of reference counts mainly for extenders and embedders of Parrot. The hash keys are the addresses of the key PMC, values are reference counts, i.e. the difference of (set_pmc_keyed - delete_pmc_keyed). If the reference goes to zero, the entry is deleted physically.
Please note that you have to anchor an instance of AddrRegistry yourself with Parrot_register_pmc
if it isn't visible to Parrot.
Functions
void init()
Initializes the instance.
void destroy()
Free hash structure.
void mark()
Marks the hash as live.
INTVAL get_integer_keyed(PMC *key)
Returns the reference count for INTVAL elements()
Returns the number of elements in the hash.
INTVAL get_bool()
Returns true if the hash size is not zero.
void set_pmc_keyed(PMC *key, PMC *value)
Increment the reference count of void set_integer_keyed(PMC *key, INTVAL value)
Set the given value.
void delete_keyed(PMC *key)
Decrement the reference count of PMC *get_iter ()
Return a new iterator for the PMC.
PMC *get_pmc_keyed(PMC *key)
If called from iteration,
return the key PMC,
else PMCNULL is returned.
key
or 0 if the key doesn't exist.
key
.
If the entry doesn't exist create it.
The value
is always ignored.
key
.
If the reference count reaches 0,
delete the entry.
SEE ALSO
src/pmc.c:gc_register_pmc()