[racket] Embedded Racket 5.1.3 on Windows

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Oct 6 09:02:00 EDT 2011

At Thu, 06 Oct 2011 13:37:45 +0200, gabor papp wrote:
> > Meanwhile, if you move the call to Interpreter::Register() to just
> > after scheme_basic_env(), like this:
> > does it work?
> Yes, it works!

After looking at this more, I don't think I can make the old behavior
work easily, and the Interpreter::Register() call in Fluxus may need to
move permanently. Or how about switching to scheme_main_setup()
instead of scheme_main_stack_setup() plus scheme_basic_env()?

The problem is related to places. When places are supported there are
actually two GC spaces on start up: a "master" GC space which is shared
among places, and the GC space for the initial place. Before you call
scheme_basic_env(), you're in the master GC space, but when
scheme_basic_env() returns, then you're in the initial place.

When Interpreter::Register() is called before scheme_basic_env(), then
static variables get registered for the master GC, but the values that
are stored in the statics belong to the initial place. That mismatch
causes the crash.

I think the best solution is to say that registration belongs after
scheme_basic_env() --- unless a static contains only values that are
allocated before scheme_basic_env() is called (which happens in
`racket'). The scheme_main_setup() function further shields
applications from this issue, since they don't get control back until
after scheme_basic_env() is called.

Posted on the users mailing list.