• Simon Marlow's avatar
    Make allocatePinned use local storage, and other refactorings · 5270423a
    Simon Marlow authored
    This is a batch of refactoring to remove some of the GC's global
    state, as we move towards CPU-local GC.  
    
      - allocateLocal() now allocates large objects into the local
        nursery, rather than taking a global lock and allocating
        then in gen 0 step 0.
    
      - allocatePinned() was still allocating from global storage and
        taking a lock each time, now it uses local storage. 
        (mallocForeignPtrBytes should be faster with -threaded).
        
      - We had a gen 0 step 0, distinct from the nurseries, which are
        stored in a separate nurseries[] array.  This is slightly strange.
        I removed the g0s0 global that pointed to gen 0 step 0, and
        removed all uses of it.  I think now we don't use gen 0 step 0 at
        all, except possibly when there is only one generation.  Possibly
        more tidying up is needed here.
    
      - I removed the global allocate() function, and renamed
        allocateLocal() to allocate().
    
      - the alloc_blocks global is gone.  MAYBE_GC() and
        doYouWantToGC() now check the local nursery only.
    5270423a
Capability.h 11 KB