On October 7, 2020 2:02:53 PM EDT, David Feuer <david.fe...@gmail.com> wrote:
>Yes, the bitmap structures used to encode the structure of stack
>frames. These *look* like they might be reusable for mix-and-match
>arrays in Haskell-land. If so, that could be a pretty cheap new
>feature.

Ahh, yes. In principle we could expose a new array type allowing the user to 
specify the pointer-ness of each entry. This wouldn't reuse any of the large 
bitmap machinery since these must be specified in the info table rather than 
the closure but the idea is similar. Implementation would require a new set of 
primops along with GC support but I suspect that none of this is too hard.

All these being said, this may not be terribly efficient for garbage collection 
since the GC will need to walk over both pointers and non-pointers, trashing a 
good amount of cache in the process. Moreover, the array itself would be 
larger, due to the two bitmaps.

I suspect most applications would be on the whole better served by a structure 
of arrays approach to achieve the same idea.  If you have multiple pointers and 
locality is a concern then you can even pack all of your pointers into a single 
array with some indexing magic and an unsafeCoerce.

Cheers,

- Ben
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to