This is the mail archive of the java-patches@gcc.gnu.org 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]
Other format: [Raw text]

Patch: gcj ggc patch


I don't really know whether this patch is necessary.  I found other
occurrences of ggc_add_tree_root in similar situations in jcf-write.c.
And as far as I can tell these static variables weren't otherwise
marked as roots.

Is this required?  If so, is it ok to commit?

I haven't observed an actual bug resulting from the lack of this
patch.  I found it by inspection only.

Tom

2002-02-26  Tom Tromey  <tromey@redhat.com>

	* jcf-write.c (generate_classfile): Add ConstantValue_node,
	Code_node, LineNumberTable_node, LocalVariableTable_node,
	Exceptions_node as roots.

Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.99
diff -u -r1.99 jcf-write.c
--- jcf-write.c 2002/02/18 04:55:07 1.99
+++ jcf-write.c 2002/03/06 22:15:59
@@ -2937,7 +2937,10 @@
 	    fatal_error ("field initializer type mismatch");
 	  ptr = append_chunk (NULL, 8, state);
 	  if (ConstantValue_node == NULL_TREE)
-	    ConstantValue_node = get_identifier ("ConstantValue");
+	    {
+	      ConstantValue_node = get_identifier ("ConstantValue");
+	      ggc_add_tree_root (&ConstantValue_node, 1);
+	    }
 	  i = find_utf8_constant (&state->cpool, ConstantValue_node);
 	  PUT2 (i);  /* attribute_name_index */
 	  PUT4 (2); /* attribute_length */
@@ -2995,7 +2998,10 @@
 	  char *attr_len_ptr;
 	  struct jcf_handler *handler;
 	  if (Code_node == NULL_TREE)
-	    Code_node = get_identifier ("Code");
+	    {
+	      Code_node = get_identifier ("Code");
+	      ggc_add_tree_root (&Code_node, 1);
+	    }
 	  ptr = append_chunk (NULL, 14, state);
 	  i = find_utf8_constant (&state->cpool, Code_node);  PUT2 (i);
 	  attr_len_ptr = ptr;
@@ -3063,7 +3069,10 @@
 	      ptr = append_chunk (NULL, 
 				  8 + 4 * state->linenumber_count, state);
 	      if (LineNumberTable_node == NULL_TREE)
-		LineNumberTable_node = get_identifier ("LineNumberTable");
+		{
+		  LineNumberTable_node = get_identifier ("LineNumberTable");
+		  ggc_add_tree_root (&LineNumberTable_node, 1);
+		}
 	      i = find_utf8_constant (&state->cpool, LineNumberTable_node);
 	      PUT2 (i);  /* attribute_name_index */
 	      i = 2+4*state->linenumber_count;  PUT4(i); /* attribute_length */
@@ -3086,7 +3095,11 @@
 	      struct localvar_info *lvar = state->first_lvar;
 	      ptr = append_chunk (NULL, 8 + 10 * state->lvar_count, state);
 	      if (LocalVariableTable_node == NULL_TREE)
-		LocalVariableTable_node = get_identifier("LocalVariableTable");
+		{
+		  LocalVariableTable_node
+		    = get_identifier("LocalVariableTable");
+		  ggc_add_tree_root (&LocalVariableTable_node, 1);
+		}
 	      i = find_utf8_constant (&state->cpool, LocalVariableTable_node);
 	      PUT2 (i);  /* attribute_name_index */
 	      i = 2 + 10 * state->lvar_count;  PUT4 (i); /* attribute_length */
@@ -3109,7 +3122,10 @@
 	  int throws_count = list_length (t);
 	  static tree Exceptions_node = NULL_TREE;
 	  if (Exceptions_node == NULL_TREE)
-	    Exceptions_node = get_identifier ("Exceptions");
+	    {
+	      Exceptions_node = get_identifier ("Exceptions");
+	      ggc_add_tree_root (&Exceptions_node, 1);
+	    }
 	  ptr = append_chunk (NULL, 8 + 2 * throws_count, state);
 	  i = find_utf8_constant (&state->cpool, Exceptions_node);
 	  PUT2 (i);  /* attribute_name_index */ 


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