[MLton] implement _address and _symbol
Henry Cejtin
henry.cejtin@sbcglobal.net
Thu, 21 Jul 2005 14:57:07 -0500
Isn't all of this stuff with Pinned things really in the wrong place? The
point is that in C it is unavoidable that at times you are going to have a
pointer into the heap itself. This is ok because the C code knows (and must
know) if it is doing something that might trigger a GC. As long as no GC is
triggered, it can count on the fact that the pointer remains valid.
The argument for Pinned comes when the C code wants to do something that
might cause a GC (i.e., it wants to run some ML code). This is an aspect of
the implementation of the C code. Hence it should be handled by something in
the C code, not by changing the interface to the C code.
The point I am trying to make (not to clearly I see) is that the notion of
pinning a pointer should be done entirely on the C side.
My notion would be that when the C code is going to call some ML code, it
would register (pinning is fine for this) the objects it wants to refer to
after the GC, then run the ML code, then (at some point) do the indirection
off of the pinned things to get back the actual direct pointers.
I don't see any point in having Pinned show up in ML code at all.