For what it's worth, Ocaml uses the fact that pointers are word-aligned
(hence even numbers) to let the gc distinguish between unboxed values and
pointers: 63-bit integers are made odd by representing n as (2n+1).

But GHC also makes use of the word-alignment of pointers: it is used for
pointer tagging [
https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/rts/haskell-execution/pointer-tagging
]. The tag is, for a closure that has been forced, a representation of its
constructor (only the 7 first constructors can be so tagged, if I
understand correctly). This is an optimisation for pattern matching: you
don't have to run the closure's entry code every time you pattern-match.

The bottom-line is that it can't be true, in GHC, that odd values are
unboxed and even values are pointers, since odd pointers already exist. Not
sure whether the optimisation can be recovered.

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

Reply via email to