[MLton] pinned objects (was: implement _address and _symbol)
Stephen Weeks
MLton@mlton.org
Thu, 21 Jul 2005 06:58:23 -0700
> So, to make sure I understand, a pin is a pointer into the heap from
> outside of it. When a GC occures, the external pointer gets updated.
Yes.
> The way I see it, Pinned.t is (yet another) level of pointers. Here,
> the Pinned.t lives on the heap, but points at the pin which lives
> outside the heap, which points to the 'a which lives in the heap.
No extra level. Underneath the :> we would have
type MLton.Pinned.t = MLton.Pointer.t
There is no need for another level beyond the pin that lives outside
the heap. The ML value is the pin (address of the malloc'd object).
> This works perfectly with what I now know of the FFI, since Pinned.t
> would be internally exactly the pointer you want to pass to the C
> function.
Right.