- We use a trick to identify the info pointer: when swapping pointers
- for threading, we set the low bit of the original pointer, with the
- result that all the pointers in the chain have their low bits set
- except for the info pointer.
- -------------------------------------------------------------------------- */
+ The main difficulty here is that we need to be able to identify the
+ info pointer at the end of the chain. We can't use the low bits of
+ the pointer for this; they are already being used for
+ pointer-tagging. What's more, we need to retain the
+ pointer-tagging tag bits on each pointer during the
+ threading/unthreading process.
+
+ Our solution is as follows:
+ - an info pointer (chain length zero) is identified by having tag 0
+ - in a threaded chain of length > 0:
+ - the pointer-tagging tag bits are attached to the info pointer
+ - the first entry in the chain has tag 1
+ - second and subsequent entries in the chain have tag 2
+
+ This exploits the fact that the tag on each pointer to a given
+ closure is normally the same (if they are not the same, then
+ presumably the tag is not essential and it therefore doesn't matter
+ if we throw away some of the tags).
+ ------------------------------------------------------------------------- */