Runtime bug? and other questions

Stephen Weeks sweeks@intertrust.com
Wed, 26 Jan 2000 13:01:00 -0800 (PST)


> BTW what does the GC do
> when it finds a pointer to an object outside of the fromspace? The SML/NJ
> runtime would just leave these objects alone. (i.e. not trace or forward
> them). Can MLton be made to behave the same way?

There isn't any need to change the GC.  Such pointers can be treated
as "word"s (in the SML sense).  Words are never even traced by the
GC.  This approach is used for a lot of things (e.g. C strings) in the
basis library implementation.

The only thing that can't be done is have a slot in an object that can
store a MLton pointer or a C pointer.  If you needed to do this, it
would be easy enough to change the GC to check a pointer before
forwarding it.  Just change the first bit of the forward function from
	assert(isInFromSpace(s, *pp));
to something like
	if (isInFromSpace(s, *pp))
		... the rest of forward ...

But hopefully the first approach is sufficient.