[GHC] #10049: Lower level memcpy primop

GHC ghc-devs at haskell.org
Fri Jan 30 22:21:59 UTC 2015


#10049: Lower level memcpy primop
-------------------------------------+-------------------------------------
              Reporter:  chadaustin  |             Owner:
                  Type:  feature     |            Status:  new
  request                            |         Milestone:
              Priority:  normal      |           Version:  7.8.4
             Component:  Compiler    |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  None/Unknown
          Architecture:              |        Blocked By:
  Unknown/Multiple                   |   Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 I'm doing some really low-level buffer stuff, and it would be quite
 helpful if there were lower-level memcpy primitives.

 I'm thinking something like:

 {{{#!hs
 copyBytes# :: Addr# -> Addr# -> Int# -> State# s -> State# s
 copyBytes dst src size _ = ...
 }}}

 I would expect it to compile, on x86, into "rep movsb", which is
 frequently optimal on Ivy Bridge and Haswell.

 The other memcpy primitives use Array# or MutableArray#, and it's not
 clear how, if all you have is an Addr#, how to get the corresponding
 Array# or MutableArray#.  (Can you just cast?)

 It may be appropriate to have corresponding 16-bit and 32-bit operations;
 "rep movsw" and "rep movsd", respectively.

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


More information about the ghc-tickets mailing list