<div><div dir="auto">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.  </div><div dir="auto"><br></div><div dir="auto">There's also the issue that c-- as it exists in ghc doesn't have any notion of subword sized types.  </div><div dir="auto"><br></div><div dir="auto">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 progress safeword package. )</div><div dir="auto"><br></div><div dir="auto">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 </div><br><div class="gmail_quote"><div>On Tue, Aug 1, 2017 at 9:37 AM Michal Terepeta <<a href="mailto:michal.terepeta@gmail.com">michal.terepeta@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi all,</div><div><br></div><div>I'm working on making it possible to pack constructor fields [1],</div><div>example:</div><div><br></div><div>```</div><div>data Foo = Foo {-# UNPACK #-} !Float {-# UNPACK #-} !Int32</div><div>```</div><div><br></div><div>should only require 4 bytes for unpacked `Float` and 4 bytes for</div><div>unpacked `Int32`, which on 64-bit arch would take just 1 word (instead</div><div>of 2 it currently does).</div><div><br></div><div>The diff to support packing of fields is in review [2], but to really</div><div>take advantage of it I think we need to introduce new primitive types:</div><div>- Int{8,16,32}#</div><div>- Word{8,16,32}#</div><div>along with some corresponding primops and with some other follow-up</div><div>changes like extending `PrimRep`.</div><div><br></div><div>Then we could use them in definitions of `Int{8,16,32}` and</div><div>`Word{8,16,32}` (they're currently just wrapping `Int#` and `Word#`).</div><div><br></div><div>Does that sound ok with everyone? (just making sure that this makes</div><div>sense before I invest more time into this :)</div><div><br></div><div>Thanks,</div><div>Michal</div><div><br></div><div>[1] <a href="https://ghc.haskell.org/trac/ghc/ticket/13825" target="_blank">https://ghc.haskell.org/trac/ghc/ticket/13825</a></div><div>[2] <a href="https://phabricator.haskell.org/D3809" target="_blank">https://phabricator.haskell.org/D3809</a></div><div><br></div></div>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div></div>