New primitive types?
Michal Terepeta
michal.terepeta at gmail.com
Tue Aug 1 13:37:06 UTC 2017
Hi all,
I'm working on making it possible to pack constructor fields [1],
example:
```
data Foo = Foo {-# UNPACK #-} !Float {-# UNPACK #-} !Int32
```
should only require 4 bytes for unpacked `Float` and 4 bytes for
unpacked `Int32`, which on 64-bit arch would take just 1 word (instead
of 2 it currently does).
The diff to support packing of fields is in review [2], but to really
take advantage of it I think we need to introduce new primitive types:
- Int{8,16,32}#
- Word{8,16,32}#
along with some corresponding primops and with some other follow-up
changes like extending `PrimRep`.
Then we could use them in definitions of `Int{8,16,32}` and
`Word{8,16,32}` (they're currently just wrapping `Int#` and `Word#`).
Does that sound ok with everyone? (just making sure that this makes
sense before I invest more time into this :)
Thanks,
Michal
[1] https://ghc.haskell.org/trac/ghc/ticket/13825
[2] https://phabricator.haskell.org/D3809
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20170801/820c5a67/attachment.html>
More information about the ghc-devs
mailing list