Hi, I was encountering wacky behavior in my hacked copy of Kaffe when running lots of threads in some simple tests. (I couldn't get the release version to duplicate the problem, but I think its still a problem in 0.9.2.) Basically, a bunch of stack variables were getting trashed in intrp/machine.c::virtualMachine() (the interpreter loop.) I ran 'gcc -O2 -Wall' on it, and gcc tells me that a bunch of variables might get trashed by longjmp()---exactly the variables that were getting trashed. There is a single setjmp() in virtualMachine(). I got rid of the warnings (and the problem!) by putting the setjmp in a separate function (I read that the problems with setjmp/longjmp are limited to the active stack frame). Attached is a patch for intrp/machine.c. Anyone with more experience with setjmp/longjmp care to explain what was going on? ;) -Pat --- /home/grad/tullmann/java/kaffe-0.9.2/kaffe/kaffevm/intrp/machine.c Sat Oct 4 04:26:57 1997 +++ /home/grad/tullmann/tmp/machine.c Wed Oct 22 11:59:46 1997 @@ -68,6 +68,12 @@ /* Misc stuff */ Hjava_lang_Object* exceptionObject; +static int +exceptionSetjmp(vmException *mjbuf) +{ + return setjmp(mjbuf->jbuf); +} + void virtualMachine(methods* meth, slots* arg, slots* retval) { @@ -140,7 +146,7 @@ TCTX(currentThread)->exceptPtr = &mjbuf; } if (meth->exception_table != 0 || (methaccflags & ACC_SYNCHRONISED)) { - if (setjmp(mjbuf.jbuf) != 0) { + if (exceptionSetjmp(&mjbuf) != 0) { assert(TCTX(currentThread)->exceptPtr == &mjbuf); npc = mjbuf.pc; sp = &lcl[meth->localsz + meth->stacksz - 1];