Java <-> C

Matthew Fluet mfluet@intertrust.com
Wed, 22 Aug 2001 09:29:03 -0700 (PDT)


> Keeping them live is not enough, since the GC may move them.  You have to do
> what Henry says, unless the GC is non-moving:
>
> > I guess that if all the C code is required to always refer to
> > the objects through a global indirection table (so the C compiler can see
> > that its entries could change after calls to Java functions) then you would be
> > safe.

That's what I had in mind.

In any event, at some point, you have to "trust" the C code to abide by
the conventions you prescribe.  We're already doing this with _ffi calls
that take "immutable" strings or vectors as inputs.  Nothing stops C from
modifying those values.