What are the current rules about object duplication during GC?
rrnewton at gmail.com
Wed Aug 21 23:10:24 CEST 2013
Is the status quo still the same as it was in this paper?
That is, there is a low-probability that a race will result in immutable
objects being duplicated, but not mutable objects. But that leaves me
wondering exactly which types are currently included in the duplicatable
vs. "take the lock" category .
The reason I'm asking is because *defeating GHC compile-time and runtime
optimizations* is precisely the goal of the recent work to make a
safe/reliable infrastructure for CAS-based lockfree data structures in GHC.
For example, the atomic-primops package uses the Any kind and type
coercions to store objects (pointers) in a form that makes them opaque to
the compiler, preventing them from being unboxed and reboxed (changing
Actually, the current policy of this library that false negatives (failing
CAS) must be tolerated, which is *usually* not an onerous obligation. So
if the heap objects in question CAN be duplicated, that is still ok, but I
would like to know if it is the case, that is, if Any is treated any
differently than, say, Int.
My guess is *no, *but I'd like to confirm this. That is, it seems
that Anyeffects the compiler (which promises
not to enter the
but the physical representation of a thunk or function doesn't change, and
thus the GC must treat those objects exactly as it would if they were
Any. Sound right?
 P.S. The places I checked before asking on this list were here:
And here: http://ghc.haskell.org/trac/ghc/wiki/GarbageCollectorNotes
If there is newer documentation for the GC, please let me know.
 One hint is on line 531 of
// PRIM rather than CONSTR, because PRIM objects cannot be duplicated by
Yet there are 62 different types of objects in ClosureTypes.hs, so I'm not
sure what all the rules are.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs