[GHC] #5210: Add primops for copying/cloning byte arrays

GHC cvs-ghc at haskell.org
Tue May 24 12:02:24 CEST 2011


#5210: Add primops for copying/cloning byte arrays
---------------------------------+------------------------------------------
    Reporter:  tibbe             |        Owner:  simonmar    
        Type:  feature request   |       Status:  patch       
    Priority:  high              |    Milestone:  7.2.1       
   Component:  Compiler          |      Version:  7.0.3       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by tibbe):

 Do we have a way to convert an Addr# to a pointer in Haskell code? If so,
 couldn't one just call memcpy directly on the pointer? The reason I'm
 adding these primops is that pointer arithmetic is not possible on
 `ByteArray#`s, as any interior pointer you grab could be invalid by the
 time you call `memcpy`, as the GC might move the array. Since `Addr#`
 point outside the heap it should be safe to use pointer arithmetic on
 them.

 In any case, please open a separate ticket.

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



More information about the Glasgow-haskell-bugs mailing list