|Title||Duplicate code between pool classes|
|Assigned user||Richard Brooksby|
|Description||There has long been similar code in the AWL, AMS, and LO pool classes for implementing mark-and-sweep garbage collection. Compare, for example, loSegWalk with AMSWalk and awlSegWalk.|
branch/2016-04-14/no-condemn-suspend deliberately changed this code to make the similarities even more obvious, but avoided large-scale changes to structure that would actually share it. Work is required specifically to implement sharing.
|Analysis||1. Move some pool methods to segment subclasses instead. Methods like "whiten", "scan", "fix", and "reclaim" are pool methods because historically the pool was the only class-like place in the MPS. These should be methods on GC segments instead.|
2. Lift the LO segment class into its own module implementing mark-and-sweep (and rename it).
3. Lift the AMS segment class to a specialisation of the LO segment class with scanning.
4. Specialise the AMS segment class to add weak-link scanning for the AWL pool.
5. Investigate sharing between the AMC class (which implements another form of mark-and-sweep for ambiguous references) and these segment classes. Possibly it could inherit from the AWL segment class and specialise with object motion.
There is a difficulty with step 3 in that AMS implements some tricky optimizations in order to maintain only two bit-tables (nonwhite, nongrey) instead of three (alloc, marked, scanned) when ambiguous references need not be supported. However, are these optimizations really effective? The optimizations can only be used when we can be sure that there are no ambiguous references into the pool. But the MPS does not support exact collection: the reserve/commit protocol requires an ambiguous reference . So maybe we are paying a cost in complexity for no actual benefit. See job000535, job000548, job000549, job000550, job001549, job003782, job003841 for bugs related to these optimizations.
|Created by||Richard Brooksby|
|Created on||2016-04-29 09:07:51|
|Last modified by||Gareth Rees|
|Last modified on||2018-07-19 06:28:33|
|History||2016-04-29 RB Created.|
|194690||open||2018-07-19 06:25:51||Gareth Rees||Merge branch/2018-07-09/seg-alloc into the master sources.|
|194268||open||2018-06-28 13:57:07||Gareth Rees||Merge branch/2017-03-04/seg-methods.|