Changes between Version 1 and Version 2 of GMPMemoryManagement


Ignore:
Timestamp:
Apr 2, 2007 9:50:39 PM (7 years ago)
Author:
Stefan O'Rear
Comment:

add bangs before types that shouldn't have been links

Legend:

Unmodified
Added
Removed
Modified
  • GMPMemoryManagement

    v1 v2  
    44GMP expects a storage model where pointers (newtyped as mpz_t) are explicitly allocated and freed. 
    55However, Haskell requires Integers to be garbage collected. 
    6 This could be done with ForeignPtrs, however (presumably for performance reasons?) GHC uses ByteArray#s from the heap instead. 
     6This could be done with !ForeignPtrs, however (presumably for performance reasons?) GHC uses !ByteArray#s from the heap instead. 
    77rts/sm/Storage.c `initStorage` sets three override functions to do this: `stgAllocForGMP`, `stgReallocForGMP`, and `stgDeallocForGMP`. 
    88 
    99This requires a fairly subtle interaction in order to work safely, 
    10 because heap ByteArray#s are normal objects and can be moved by garbage collection. 
     10because heap !ByteArray#s are normal objects and can be moved by garbage collection. 
    1111The important thing to note is that the GHC garbage collector is of the stop-the-world variety. 
    1212This means that all threads must reach a synchronization point before garbage collection can actually begin.