Patch: type cleanups

Tom Tromey tromey@cygnus.com
Tue Jan 25 16:55:00 GMT 2000


I'm commmitting the appended patch.  It changes parts of the libgcj
implementation to use Java types instead of C++ types where
appropriate.

Tue Jan 25 08:51:16 2000  Tom Tromey  <tromey@ferrule.cygnus.com>

	* gcj/field.h (struct _Jv_Field): Use "jshort" as type for
	nameIndex.  Use "jint" as type for boffset.
	* java/lang/Class.h (struct _Jv_Method): Made accflags a
	_Jv_ushort.
	(Class): Likewise.  Also changed type of method_count,
	vtable_method_count, size_in_bytes, field_count,
	static_field_count, interface_count.
	* gcj/array.h (__JArray): Made `length' a const jsize, not an
	int.

Tom


Index: gcj/array.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/array.h,v
retrieving revision 1.4
diff -u -r1.4 array.h
--- array.h	2000/01/19 18:39:23	1.4
+++ array.h	2000/01/26 00:54:40
@@ -18,7 +18,9 @@
 class __JArray : public java::lang::Object
 {
 public:
-  int length;
+  // FIXME: we'd like this to be `const' but that causes problems with
+  // the C++ compiler.
+  jsize length;
   friend jsize JvGetArrayLength (__JArray*);
 };
 
Index: gcj/field.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/field.h,v
retrieving revision 1.3
diff -u -r1.3 field.h
--- field.h	2000/01/21 23:50:30	1.3
+++ field.h	2000/01/26 00:54:40
@@ -30,13 +30,13 @@
   _Jv_ushort		flags;
 
 #ifdef COMPACT_FIELDS
-  short			nameIndex;  /* offset in class's name table */
+  jshort		nameIndex;  /* offset in class's name table */
 #else
   _Jv_ushort		bsize;  /* not really needed ... */
 #endif
 
   union {
-    int			boffset;  /* offset in bytes for instance field */
+    jint		boffset;  /* offset in bytes for instance field */
     void*		addr;  /* address of static field */
   } u;
 
Index: java/lang/Class.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/Class.h,v
retrieving revision 1.13
diff -u -r1.13 Class.h
--- Class.h	2000/01/21 23:50:31	1.13
+++ Class.h	2000/01/26 00:54:40
@@ -58,7 +58,7 @@
 {
   _Jv_Utf8Const *name;
   _Jv_Utf8Const *signature;
-  unsigned short accflags;
+  _Jv_ushort accflags;
   void *ncode;
 
   _Jv_Method *getNextMethod ()
@@ -229,7 +229,7 @@
   // Name of class.
   _Jv_Utf8Const *name;
   // Access flags for class.
-  unsigned short accflags;
+  _Jv_ushort accflags;
   // The superclass, or null for Object.
   jclass superclass;
   // Class constants.
@@ -240,17 +240,17 @@
   _Jv_Method *methods;
   // Number of methods.  If this class is primitive, this holds the
   // character used to represent this type in a signature.
-  short method_count;
+  jshort method_count;
   // Number of methods in the vtable.
-  short vtable_method_count;
+  jshort vtable_method_count;
   // The fields.
   _Jv_Field *fields;
   // Size of instance fields, in bytes.
-  int size_in_bytes;
+  jint size_in_bytes;
   // Total number of fields (instance and static).
-  short field_count;
+  jshort field_count;
   // Number of static fields.
-  short static_field_count;
+  jshort static_field_count;
   // The vtbl for all objects of this class.
   _Jv_VTable *vtable;
   // Interfaces implemented by this class.
@@ -258,7 +258,7 @@
   // The class loader for this class.
   java::lang::ClassLoader *loader;
   // Number of interfaces.
-  short interface_count;
+  jshort interface_count;
   // State of this class.
   jbyte state;
   // The thread which has locked this class.  Used during class


More information about the Java-patches mailing list