[kaffe] Unexpected java.lang.IllegalMonitorStateException

Ito Kazumitsu kaz@maczuka.gcd.org
Thu Apr 8 08:27:03 2004


>>>>> ":" == Ito Kazumitsu <ito.kazumitsu@hitachi-cable.co.jp> writes:

:> It seems that the problem occurs when "synchronized" is nested.

Although I am not fully confident,  I think the following patch
makes sense.  At least, the test program passes and "make check"
shows "All 144 tests passed."  I would like kaffevm experts to
check this.

--- kaffe/kaffevm/locks.c.orig	Tue Feb  3 00:31:48 2004
+++ kaffe/kaffevm/locks.c	Fri Apr  9 00:15:41 2004
@@ -220,7 +220,7 @@
 	lk = getHeavyLock(lkp, heavyLock);
 
 	/* Only the lock holder can be doing an unlock */
-	if (!jthread_on_current_stack(lk->holder)) {
+	if ((lk->holder != NULL) && (!jthread_on_current_stack(lk->holder))) {
 		putHeavyLock(lkp, lk);
 		jthread_enable_stop();
 		throwException(IllegalMonitorStateException);