It appears that the RTS has more flexibility in its array representations
than users can access through primops. In particular, there are
"pointers-first" and "bitmapped" arrays. Are these used for the evaluation
stack or something? I'd be very interested in getting user access to some
of this power.

Lots of data structures can be represented efficiently using internal nodes
consisting of some (unboxed) structural information, some pointers to other
internal nodes, and some (boxed or unboxed) leaves. A hashmap, for example,
could have internal nodes laid out something like this (pointers-first
would probably work well):

bitmap1: which children are inhabited?
bitmap2: which children are internal nodes?
pointers: pointers to internal nodes and leaf nodes. (If we change some of
the traditional arithmetic, we can probably even store keys and values
directly in their parent nodes rather than having separate Leaf nodes.)

As it is today, we need extra indirections between each array and the next
one to accommodate the tagging: node -> array -> node -> array -> ...

How feasible would it be to offer things like this?
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to