[GHC] #8299: Add richer data model address arithmetic: AddrDiff and AddrInt (ie d Int_ptr_diff and Int_ptr_size)

GHC ghc-devs
Fri Oct 4 16:03:19 UTC 2013


#8299: Add richer data model address arithmetic: AddrDiff and AddrInt (ie d
Int_ptr_diff and Int_ptr_size)
----------------------------+----------------------------------------------
        Reporter:  carter   |            Owner:
            Type:  feature  |           Status:  new
  request                   |        Milestone:  7.10.1
        Priority:  high     |          Version:  7.6.3
       Component:           |         Keywords:
  Compiler                  |     Architecture:  Unknown/Multiple
      Resolution:           |       Difficulty:  Project (more than a week)
Operating System:           |       Blocked By:
  Unknown/Multiple          |  Related Tickets:
 Type of failure:           |
  None/Unknown              |
       Test Case:           |
        Blocking:  8287     |
----------------------------+----------------------------------------------

Comment (by carter):

 Reid Barton (who's been experimenting with an x32 ABI) made an observation
 yesterday evening on IRC #ghc about address vs int sizes for ghc

 {{{
 [09:24:34] <rwbarton>    ugh, I didn't think about the fact that integer-
 gmp exposes its representation to the world
 [09:24:43] <rwbarton>    that means potentially anybody is assuming that
 Int is the same size as mp_limb_t
 [09:24:47] <hvr_>        dcoutts_: fwiw, bytestring w/ ghc-head/linux/i386
 passed too
 [09:55:47] <rwbarton>    I guess ghcjs has the same problem
 [09:56:07] <rwbarton>    can't support exporting the J# constructor
 [09:56:25] <hvr_>        rwbarton: what problem exactly?
 [09:57:11] <rwbarton>    so my problem that I just realized is on x32
 [09:57:34] <rwbarton>    where Int is 4 bytes, but gmp uses 8 byte limbs
 [09:57:59] <rwbarton>    I can't have people going around constructing
 Integers with J#, because first of all they might not provide a ByteArray#
 that's a multiple of 8 bytes long
 [09:59:49] <rwbarton>    so ideally (for me) there would be a type with
 the S# and J# constructors for pattern matching on, that was distinct from
 Integer
 [10:00:14] <rwbarton>    that former type exported, the constructors of
 Integer not exported
 [10:00:29] <rwbarton>    with conversions between them that on "ordinary"
 platforms are zero-cost
 [10:04:34] <hvr_>        rwbarton: btw, I've been wishing for some bignum-
 only type
 [10:04:45] <hvr_>        i.e. an Integer only w/ J#
 [10:05:38] <hvr_>        then the proper Integer type could use that
 unboxed as single field in its J# constructor
 }}}

 This is just another data point to consider in any design constraints

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



More information about the ghc-tickets mailing list