On Mon, Dec 02, 2002 at 11:01:32PM +1000, Stephen Crawley wrote:
> In theory, the fix is simple; perform all blocking syscalls from within
> GC points.  In practice, Kissme uses the Classpath native libraries for
> Java I/O.  Therefore, we must:
> 
>   EITHER implement our own native I/O libraries,
> 
>   OR make some Kissme-specific changes to the Classpath sourcecode base.

This is not true.  You simply need considers all JNI calls as GC
points.  In other words, as soon as a thread enters native code, it is
considered GC safe, as no reference can be directly touched by that
thread (all references being hidden within native global/local
reference black structures).  The important thing is to block such
native thread if it ever calls back the JVM (through the JNIEnv
function pointers) while GC is running.

> I've explored the latter approach and found that it can be done in a
> way that should be invisible[*] to other VMs that use the Classpath native
> libraries.  Here is how this works:

Even though these changes would be invisible to other VMs, I think it
would be bad design for Kissme.  Have you considered what would happen
if a "user supplied" JNI library contained a blocking call, or some
kind of infinite loop without call-backs into the Kissme JVM?  Such a
library would deadlock the Kissme JVM if GC was required on another
thread.  Unless, of course, you had the intention to require users to
make Kissme-specific calls around such things, which defeats the
purpose of a "Standard native interface" (JNI).

SableVM uses a single atomic operation (Compare-And-Swap) around JNI
calls to manage thread GC state without causing the overhead of a full
mutex lock call.  I could explain to you the algorithm.  I am
currently putting the *final* post-defense/evaluation touch to my
Ph.D. thesis document (I have just successfully defended it last
week).  If I have time, I might add an appendix that describes the
implemented stop-the-world algorithm.


Etienne


-- 
Etienne M. Gagnon                    http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to