[GHC] #11143: Feature request: Add index/read/write primops with byte offset for ByteArray#

GHC ghc-devs at haskell.org
Sat Mar 3 23:20:16 UTC 2018


#11143: Feature request: Add index/read/write primops with byte offset for
ByteArray#
-------------------------------------+-------------------------------------
        Reporter:  vagarenko         |                Owner:  sjakobi
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:  newcomers
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D4433
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * cc: Jaffacake (added)


Comment:

 I don't believe so; this is one of the reasons the primops look like they
 do: they allow us to avoid dealing with alignment headaches. Frankly, I'm
 not even sure what sort of alignment guarantees our current C-- load and
 store nodes expect. Jaffacake, could you comment on this?

 We do have a list of architectures for which we need to worry about
 alignment (essentially everything but amd64; see `PprC.cLoad`). To figure
 out how to lower these operations I would likely just use a C compiler.
 For instance, compile a test program like,
 {{{#!c
 #include <stdint.h>

 struct { uint32_t x; } __attribute__((packed)) *x;

 void store() {
     x->x = 42;
 }
 }}}
 with a cross-compiler and see what gets produced.

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


More information about the ghc-tickets mailing list