[GHC] #8199: Get rid of HEAP_ALLOCED

GHC ghc-devs at haskell.org
Thu Apr 10 11:38:12 UTC 2014


#8199: Get rid of HEAP_ALLOCED
----------------------------+----------------------------------------------
        Reporter:  ezyang   |            Owner:  ezyang
            Type:  feature  |           Status:  new
  request                   |        Milestone:  7.10.1
        Priority:  normal   |          Version:  7.7
       Component:           |         Keywords:
  Compiler                  |     Architecture:  Unknown/Multiple
      Resolution:           |       Difficulty:  Project (more than a week)
Operating System:           |       Blocked By:  5435
  Unknown/Multiple          |  Related Tickets:
 Type of failure:           |
  None/Unknown              |
       Test Case:           |
        Blocking:           |
----------------------------+----------------------------------------------

Comment (by ezyang):

 As it turns out, removing HEAP_ALLOCED has a bad interaction with object
 unloading. The immediate failure is that the unload-object code thinks
 that all objects are unreferenced when checking static closures, because
 the static closure doesn't live in the object image but in the dynamic
 heap.

 One way to fix this is to add some extra data to all static closures
 saying where their indirection lives and use that to determine if a static
 closure is associated an unloaded object.  Then when we dynamically load
 an object, we place all of its static closures in a block allocated
 specifically for that object (this would only work for GHC's linker, but
 as it so happens, at the moment we only support unloading static objects
 and not dynamic libraries); once we conclude the object is dead we free
 the block back to the memory manager.

 Here's an alternative scheme. Since the static closures no longer live in
 the object image, we can treat them as normal closures and just check if
 their info tables are keeping an object live. However, we still need to
 make sure that space in the static blocks ends up getting freed; the most
 reliable way to do that is to actually GC static closures the same we GC
 normal objects. (But of course, if we do that, we still need pointers to
 the static indirections to update them when the static object moves
 somewhere else.)

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8199#comment:26>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list