New primitive types?
michal.terepeta at gmail.com
Wed Aug 2 18:52:50 UTC 2017
On Tue, Aug 1, 2017 at 8:08 PM Carter Schonwald <carter.schonwald at gmail.com>
> One issue with packed fields is that on many architectures you can't
quite do subword reads or
> writes. So it might not always be a win.
Could you give any examples?
Note that we're still going to do aligned read/writes, i.e., `Int32#`
would still be 4 bytes aligned, `Int16#` 2 bytes, etc. So we might
have "holes", e.g., `data Foo = Foo Int8# Int64#` would still waste 7
bytes (since `Int64#` should be 8 bytes aligned).
In the future, I'd also like to do some field reordering to avoid some
holes like that in cases like `Foo Int32# Int64# Int32#` (here it'd be
better if the in-memory layout was `Int64#` first and then the two
> There's also the issue that c-- as it exists in ghc doesn't have any
notion of subword sized
> That said, I do support making word/int64/32 # types more first class /
built in. (I hit some
> issues which tie into this topic in the process of working on my still in
> package. )
> Point being: I support improving what we have, but it's got a bit of
surface area. Please let me
> know how I can help you dig into this though
Have a look at https://ghc.haskell.org/trac/ghc/ticket/13825 which
tracks the progress. The most recent diff is
So far, most of this work is based on some unfinished code by Simon
Marlow to support storing constructor fields smaller than words. I'm
currently mostly finishing/fixing it and splitting to smaller pieces.
Introducing more primitive stuff is the next step. (assuming everyone
is ok with this :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ghc-devs