Finish separating the stable name and stable pointer tables
The stable name table and stable pointer table are both implemented in rts/Stable.c
, with their code interleaved. Presumably this is for historical reasons; they were once one table, and they were split for performance reasons (see #7674 (closed)).
As far as I can tell, they basically don't share anything—or at least anything that they actually should. They do share a mutex, which smells like a terrible idea. Doesn't that just introduce contention between StableName
and StablePtr
operations in different threads? They also share an initialization function, initStableTables
, that appears to allocate both a stable name table and a stable pointer table as soon as either of them is needed. Unless I'm missing something, there's no point whatsoever in doing that. So I think we should actually divide Stable.c
into StableName.c
and StablePtr.c
and give each its own mutex.