pharo-vm
pharo-vm copied to clipboard
Re-think SpurMemoryManager hierarchy
The current state of the hierarchy is as follows:
SpurMemoryManager .
Spur32BitMemoryManager .
Spur32BitCoMemoryManager .
Spur64BitMemoryManager .
Spur64BitCoMemoryManager .
A problem here is that there is a considerable amount of identical methods in two classes of Spur:
- Spur32BitCoMemoryManager
- Spur64BitCoMemoryManager
However, Spur32BitMemoryManager and Spur64BitMemoryManager behaviors are mostly different (keeping the same protocol).
To get rid of this duplication, we could re-think the design of the hierarchy. One simple option could be to promote common methods to a single class SpurBaseCoMemoryManager :
SpurMemoryManager .
SpurBaseCoMemoryManager.
Spur32BitCoMemoryManager .
Spur64BitCoMemoryManager .
Methods in Spur32BitMemoryManager and Spur64BitMemoryManager (two classes not related with Cog JIT) could be accessed by an instance variable in SpurBaseCoMemoryManager.
This presents the little disadvantage of having two parallel (though small) hierarchies (which is not a big deal since these classes are only used by very few use cases), but on the other hand, we could gain in maintanability since modifications could be done in just one place.
If you have an alternative design please let us know.
Can we apply a trait?