[plt-scheme] Mobile objects

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Feb 12 20:45:55 EST 2007

At Mon, 12 Feb 2007 17:05:19 -0800, "Jim Blandy" wrote:
> GNU Emacs uses a C/collector interface much like the 3m interface.  We
> had ongoing problems with people 'knowing' that a collection would not
> occur in a certain block of code, and not bothering to register their
> temporary variables.  Later changes would then add innocent-looking
> function calls which would break the assumptions made earlier.  In
> practice, people found it hard to work with rules like "The 3m
> collector needs to know the address of every local or temporary
> pointer within a function call at any point when a collection can be
> triggered."

I agree completely. We address this issue in a couple of ways:

 1. By not writing C code, and instead using `(lib "foreign.ss")'.

 2. By using `mzc --xform' to automatically instrument C code with
    temporary-variable registration, instead of inserting it manually.

Whether this is enough remains an open question.

> If one wanted to allow collections to be triggered by a thread while
> other threads run C code, the 3m interface would not be adequate; but
> I gather this isn't one of MzScheme's goals.

Right. I'd like to support multiprocessing eventually, but I think
we'll have to have it in some different form.

> Here's an alternative way to allow C to look inside strings and
> arrays, without giving much away about how and where they live, or
> when GC might occur:
> http://sources.redhat.com/ml/guile/1999-01/msg00093.html

Thanks for the pointer!


Posted on the users mailing list.