On Mon, Mar 8, 2021, at 5:41 PM, Spiwack, Arnaud wrote:
> 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
I see, thanks for the pointer (tee hee!). Seems like that real-estate is
already used up in the runtime's representation.
I replied to the thread just now a mildly interesting result with unboxed sums
prior to reading this. Seems like a potentially fun avenue for someone with
more time.
Cheers,
Chris
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs