Patch: don't mark RawData fields

Tom Tromey tromey@cygnus.com
Thu May 4 21:44:00 GMT 2000


We currently mark RawData fields, but we shouldn't.  This patch fixes
that.  It also fixes a couple minor problems in boehm.cc.

2000-05-04  Tom Tromey  <tromey@cygnus.com>

	* gcj/field.h (JvFieldIsRef): Return false for gnu.gcj.RawData
	field.
	* boehm.cc (_Jv_MarkObj): Removed dead code.  Use `STATIC', not
	`0x0008'.
	Include Modifier.h.

Tom

Index: gcj/field.h
===================================================================
RCS file: /cvs/java/libgcj/libjava/gcj/field.h,v
retrieving revision 1.6
diff -u -r1.6 field.h
--- field.h	2000/03/07 19:55:24	1.6
+++ field.h	2000/05/05 04:32:14
@@ -175,7 +175,9 @@
 extern inline jboolean
 JvFieldIsRef (jfieldID field)
 {
-  return field->isRef ();
+  // gnu.gcj.RawData.class is  _CL_Q33gnu3gcj7RawData
+  extern java::lang::Class _CL_Q33gnu3gcj7RawData;
+  return field->isRef () && field->type != &_CL_Q33gnu3gcj7RawData;
 }
 
 extern inline jobject
Index: boehm.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/boehm.cc,v
retrieving revision 1.18
diff -u -r1.18 boehm.cc
--- boehm.cc	2000/04/22 17:09:39	1.18
+++ boehm.cc	2000/05/05 04:32:14
@@ -16,6 +16,7 @@
 #include <gcj/cni.h>
 
 #include <java/lang/Class.h>
+#include <java/lang/reflect/Modifier.h>
 #include <java-interp.h>
 
 // More nastiness: the GC wants to define TRUE and FALSE.  We don't
@@ -102,14 +103,6 @@
     {
       jclass c = (jclass) addr;
 
-#if 0
-      // The next field should probably not be marked, since this is
-      // only used in the class hash table.  Marking this field
-      // basically prohibits class unloading. --Kresten
-      p = (ptr_t) c->next;
-      MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c2label);
-#endif
-
       p = (ptr_t) c->name;
       MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c3label);
       p = (ptr_t) c->superclass;
@@ -182,7 +175,7 @@
 
 	  // For the interpreter, we also need to mark the memory
 	  // containing static members
-	  if (field->flags & 0x0008)
+	  if ((field->flags & java::lang::reflect::Modifier::STATIC))
 	    {
 	      p = (ptr_t) field->u.addr;
 	      MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8clabel);


More information about the Java-patches mailing list