cvs commit: fptools/ghc/compiler/prelude primops.txt.pp fptools/ghc/lib/std PrelGHC.hi-boot.pp fptools/ghc/rts GC.c PrimOps.hc Storage.c Storage.h StoragePriv.h fptools/ghc/includes PrimOps.h

Manuel M. T. Chakravarty chak@cse.unsw.edu.au
Wed, 08 Aug 2001 23:18:42 +1000


Simon Marlow <simonmar@glass.cse.ogi.edu> wrote,

>   Had a brainwave on the way to work this morning, and realised that the
>   garbage collector can handle "pinned objects" as long as they don't
>   contain any pointers.
>   
>   This is absolutely ideal for doing temporary allocation in the FFI,
>   because what we really want to do is allocate a pinned ByteArray and
>   let the GC clean it up later.  So this set of changes adds the
>   required framework.
>   
>   There are two new primops:
>   
>    newPinnedByteArray# :: Int# -> State# s -> (# State# s, MutByteArr# s #)
>    byteArrayContents#  :: ByteArr# -> Addr#
>   
>   obviously byteArrayContents# is highly unsafe.

Cool :-)

Manuel