This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: _Jv_PrepareCompiledClass


We must always call _Jv_PrepareCompiledClass while holding the class'
mutex.  I've found a case where this isn't so, and I'm checking in
this patch to fix it.  This patch actually doesn't affect runtime
behavior, since _Jv_PrepareCompiledClass simply returns in this
situation anyway.  I don't understand what is really going on here, so
I elected to make the fix for correctness and not simply remove the
call.

1999-09-02  Tom Tromey  <tromey@cygnus.com>

	* java/lang/natClassLoader.cc (_Jv_WaitForState): Call
	_Jv_PrepareCompiledClass while holding class mutex.

Tom

Index: java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.7
diff -u -r1.7 natClassLoader.cc
--- natClassLoader.cc	1999/09/01 22:02:19	1.7
+++ natClassLoader.cc	1999/09/02 19:29:58
@@ -144,8 +144,10 @@
 
   if (state == JV_STATE_LINKED)
     {
-      _Jv_MonitorExit (klass);
+      // Must call _Jv_PrepareCompiledClass while holding the class
+      // mutex.
       _Jv_PrepareCompiledClass (klass);
+      _Jv_MonitorExit (klass);
       return;
     }
 	
@@ -217,7 +219,7 @@
   if (klass->state >= JV_STATE_LINKED)
     return;
 
-  // short-circuit, so that mutually dependent classes are ok
+  // Short-circuit, so that mutually dependent classes are ok.
   klass->state = JV_STATE_LINKED;
 
   _Jv_Constants *pool = &klass->constants;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]