This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: gcj class initialization fix


I'm checking this in.

This patch reorders the state values so that `error' comes before
`done'.  Without this change, code we emit incorrectly lets us use a
class which didn't properly initialize.  This patch also fixes an
oversight in the class initialization code which caused the error
state to be ignored.

Even with this patch we fail the new test at -O3.  I don't have a fix
for that.

Tom

Index: gcc/java/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java-tree.h: Move JV_STATE_ERROR before JV_STATE_DONE.

Index: gcc/java/java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.160
diff -u -r1.160 java-tree.h
--- gcc/java/java-tree.h 2 Nov 2002 21:29:36 -0000 1.160
+++ gcc/java/java-tree.h 2 Nov 2002 23:37:26 -0000
@@ -1740,9 +1740,10 @@
   JV_STATE_LINKED = 9,		/* Strings interned.  */
 
   JV_STATE_IN_PROGRESS = 10,	/* <Clinit> running.  */
-  JV_STATE_DONE = 12,
+  JV_STATE_ERROR = 12,
+
+  JV_STATE_DONE = 14		/* Must be last.  */
 
-  JV_STATE_ERROR = 14		/* must be last.  */
 };
 
 #undef DEBUG_JAVA_BINDING_LEVELS
Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/Class.h: Move JV_STATE_ERROR before JV_STATE_DONE.
	* java/lang/natClass.cc (initializeClass): Don't return just
	because self==thread.

Index: libjava/java/lang/Class.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Class.h,v
retrieving revision 1.48
diff -u -r1.48 Class.h
--- libjava/java/lang/Class.h 3 Sep 2002 21:33:46 -0000 1.48
+++ libjava/java/lang/Class.h 2 Nov 2002 23:37:31 -0000
@@ -46,9 +46,10 @@
   JV_STATE_LINKED = 9,		// Strings interned.
 
   JV_STATE_IN_PROGRESS = 10,	// <Clinit> running.
-  JV_STATE_DONE = 12,		// 
 
-  JV_STATE_ERROR = 14		// must be last.
+  JV_STATE_ERROR = 12,
+
+  JV_STATE_DONE = 14		// Must be last.
 };
 
 struct _Jv_Field;
Index: libjava/java/lang/natClass.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natClass.cc,v
retrieving revision 1.53
diff -u -r1.53 natClass.cc
--- libjava/java/lang/natClass.cc 3 Sep 2002 21:33:46 -0000 1.53
+++ libjava/java/lang/natClass.cc 2 Nov 2002 23:37:32 -0000
@@ -741,9 +741,7 @@
     wait ();
 
   // Steps 3 &  4.
-  if (state == JV_STATE_DONE
-      || state == JV_STATE_IN_PROGRESS
-      || thread == self)
+  if (state == JV_STATE_DONE || state == JV_STATE_IN_PROGRESS)
     {
       _Jv_MonitorExit (this);
       return;


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