Hi.
I've now implemented the new rehash behaviour that we discussed during the conference ~2 months ago. This means that weak mappings that contain the only reference to a reference-counted object will free the object when the hashtable is resized. Note that this only takes care of the most common case of weak mappings. The more complicated cases will still need the full gc.
For reference:
INDEX INDEX VALUE VALUE HANDLING REFTYPE CONTENT REFTYPE CONTENT ------------------------------------------ STRONG * STRONG * KEEP STRONG * WEAK UNREF KEEP STRONG * WEAK SINGLE FREE STRONG * WEAK MULTIPLE KEEP WEAK UNREF STRONG * KEEP WEAK SINGLE STRONG * FREE WEAK MULTIPLE STRONG * KEEP WEAK UNREF WEAK UNREF KEEP WEAK UNREF WEAK MULTIPLE KEEP WEAK SINGLE WEAK * FREE WEAK * WEAK SINGLE FREE WEAK MULTIPLE WEAK UNREF KEEP WEAK MULTIPLE WEAK MULTIPLE KEEP
Legend: STRONG Strong (default) reference. WEAK Weak (set with set_weak_flag()) reference. * Any value. UNREF Value that is not reference counted (eg ints or floats). SINGLE Reference-counted value with a single reference. MULTIPLE Reference-counted value with more than one reference. KEEP Entry to be kept after the rehash. FREE Entry to be freed during the rehash.
I would appreciate testing, and any comments about the behaviour (intended or otherwise).
Happy New Year!
/grubba
pike-devel@lists.lysator.liu.se