On 10/3/2011 4:20 PM, Sean Kelly wrote:
Immutable data would have to be allocated on the shared heap as well, which means the contention for the shared heap may actually be fairly significant. But the alternatives are all too complex (migrating immutable data from local pools to a common pool when a thread terminates, etc). There's also the problem of transferring knowledge of whether something is immutable into the allocation routine. As things stand, I don't believe that type info is available.
Right. The current language allows no way to determine in advance if an allocation will be eventually made immutable (or shared) or not.
However, if the gc used thread local pools to do the allocation from (not the collection), the gc would go faster because it wouldn't need locking to allocate from those pools. This change can happen without any language or compiler changes.