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]

Java PATCH: bitmap marking descriptors vs. ClassClass


I'm checking in this patch from Hans Boehm, which was approved in
private mail by Alex Petit-Bianco. It changes the marking bitmap
descriptor generator to use the procedure based descriptor for the
java.lang.Class class, and makes a "correctness" fix for handling
multiple-word pointer fields.

This patch is a prerequisite for the latest libgcj bitmap marking patch,
which I will commit in a day or two once I'm sure that gcc can build a
working libgcj again.

regards

  [ bryce ]


2000-08-07  Hans Boehm  <boehm@acm.org>

	* boehm.c (mark_reference_fields): Set marking bits for all words in
	a multiple-word record.
	(get_boehm_type_descriptor): Use the procedure marking descriptor for
	java.lang.Class.

Index: boehm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/boehm.c,v
retrieving revision 1.7
diff -u -r1.7 boehm.c
--- boehm.c	2000/05/05 04:23:22	1.7
+++ boehm.c	2000/09/05 11:27:58
@@ -95,17 +95,21 @@
   for (; field != NULL_TREE; field = TREE_CHAIN (field))
     {
       HOST_WIDE_INT offset;
+      HOST_WIDE_INT size_bytes;
 
       if (FIELD_STATIC (field))
 	continue;
 
       offset = int_byte_position (field);
+      size_bytes = int_size_in_bytes (TREE_TYPE (field));
       if (JREFERENCE_TYPE_P (TREE_TYPE (field))
 	  /* An `object' of type gnu.gcj.RawData is actually non-Java
 	     data.  */
 	  && TREE_TYPE (field) != rawdata_ptr_type_node)
 	{
 	  unsigned int count;
+	  unsigned int size_words;
+	  unsigned int i;
 
 	  /* If this reference slot appears to overlay a slot we think
 	     we already covered, then we are doomed.  */
@@ -113,11 +117,19 @@
 	    abort ();
 
 	  count = offset * BITS_PER_UNIT / POINTER_SIZE;
+	  size_words = size_bytes * BITS_PER_UNIT / POINTER_SIZE;
 
 	  *last_set_index = count;
-	  /* First word in object corresponds to most significant byte
-	     of bitmap.  */
-	  set_bit (low, high, ubit - count - 1);
+	     
+	  /* First word in object corresponds to most significant byte of 
+	     bitmap. 
+	     
+	     In the case of a multiple-word record, we set pointer 
+	     bits for all words in the record. This is conservative, but the 
+	     size_words != 1 case is impossible in regular java code. */
+	  for (i = 0; i < size_words; ++i)
+	    set_bit (low, high, ubit - count - i - 1);
+
 	  if (count > ubit - 2)
 	    *pointer_after_end = 1;
 
@@ -172,6 +184,9 @@
 
   /* Warning avoidance.  */
   ubit = (unsigned int) bit;
+
+  if (type == class_type_node)
+    return PROCEDURE_OBJECT_DESCRIPTOR;
 
   field = TYPE_FIELDS (type);
   mark_reference_fields (field, &low, &high, ubit,

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