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: state define cleanup


I'm committing the appended patch.  It turns the JV_STATE_ macros into
an enum for easier debugging.  It also fixes a class initialization to
use JV_STATE_NOTHING instead of `0'.

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

	* java/lang/natClassLoader.cc (_Jv_NewClass): Use
	JV_STATE_NOTHING, not `0'.
	* java/lang/Class.h: Replaced JV_STATE_ defines with enum.

Tom

Index: java/lang/Class.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/Class.h,v
retrieving revision 1.5
diff -u -r1.5 Class.h
--- Class.h	1999/09/01 18:29:39	1.5
+++ Class.h	1999/09/01 20:55:26
@@ -23,25 +23,26 @@
 extern "C" void _Jv_RegisterClasses (jclass *classes);
 
 // These are the possible values for the `state' field of the class
-// structure.  Note that ordering is important here; in particular
-// `resolved' must come between `nothing' and the other states.
-// Whenever the state changes, one should notify all waiters of this
-// class.
-#define JV_STATE_NOTHING       0 // set by compiler
+// structure.  Note that ordering is important here.  Whenever the
+// state changes, one should notify all waiters of this class.
+enum
+{
+  JV_STATE_NOTHING = 0,		// Set by compiler.
 
-#define JV_STATE_PRELOADING    1 // can do _Jv_FindClass
-#define JV_STATE_LOADING       3 // has super installed
-#define JV_STATE_LOADED        5 // is complete
+  JV_STATE_PRELOADING = 1,	// Can do _Jv_FindClass.
+  JV_STATE_LOADING = 3,		// Has super installed.
+  JV_STATE_LOADED = 5,		// Is complete.
     
-#define JV_STATE_COMPILED      6 // this was a compiled class
+  JV_STATE_COMPILED = 6,	// This was a compiled class.
 
-#define JV_STATE_PREPARED      7 // layout & static init done
-#define JV_STATE_LINKED        9 // strings interned
+  JV_STATE_PREPARED = 7,	// Layout & static init done.
+  JV_STATE_LINKED = 9,		// Strings interned.
 
-#define JV_STATE_IN_PROGRESS  10 // <clinit> running
-#define JV_STATE_DONE         12 // 
+  JV_STATE_IN_PROGRESS = 10,	// <Clinit> running.
+  JV_STATE_DONE = 12,		// 
 
-#define JV_STATE_ERROR        14 // must be last
+  JV_STATE_ERROR = 14		// must be last.
+};
 
 struct _Jv_Field;
 struct _Jv_VTable;
Index: java/lang/natClassLoader.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClassLoader.cc,v
retrieving revision 1.5
diff -u -r1.5 natClassLoader.cc
--- natClassLoader.cc	1999/09/01 18:29:39	1.5
+++ natClassLoader.cc	1999/09/01 20:55:29
@@ -547,7 +547,7 @@
   ret->interfaces = NULL;
   ret->loader = loader;
   ret->interface_count = 0;
-  ret->state = 0;
+  ret->state = JV_STATE_NOTHING;
   ret->thread = NULL;
 
   _Jv_RegisterClass (ret);

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