This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
[PATCH] Java fix ggc problem compiling compiling constant pool
- To: java-discuss at sources dot redhat dot com, gcc-patches at gcc dot gnu dot org
- Subject: [PATCH] Java fix ggc problem compiling compiling constant pool
- From: Per Bothner <per at bothner dot com>
- Date: 21 Jan 2001 13:24:04 -0800
- Cc: edgar at villanueva dot com
This should fix the "Re: Weird problems compiling bytecode" bug mentioned
yesterday. Basically, it just registers the current constant pool
as a gc root, and marks it when GC is done.
I checked this in.
2001-01-21 Per Bothner <per@bothner.com>
* jcf-parse.c (ggc_mark_jcf): New function.
(init_jcf_parse): Register current_jcf as ggc root.
Index: jcf-parse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-parse.c,v
retrieving revision 1.69
diff -u -p -r1.69 jcf-parse.c
--- jcf-parse.c 2001/01/15 08:01:21 1.69
+++ jcf-parse.c 2001/01/21 21:12:51
@@ -93,7 +93,30 @@ static int find_in_current_zip PARAMS ((
static void parse_class_file PARAMS ((void));
static void set_source_filename PARAMS ((JCF *, int));
static int predefined_filename_p PARAMS ((tree));
+static void ggc_mark_jcf PARAMS ((void**));
+/* Mark (for garbage collection) all the tree nodes that are
+ referenced from JCF's constant pool table. */
+
+static void
+ggc_mark_jcf (elt)
+ void **elt;
+{
+ JCF *jcf = *(JCF**) elt;
+ if (jcf != NULL)
+ {
+ CPool *cpool = &jcf->cpool;
+ int size = CPOOL_COUNT(cpool);
+ int index;
+ for (index = 1; index < size; index++)
+ {
+ int tag = JPOOL_TAG (jcf, index);
+ if ((tag & CONSTANT_ResolvedFlag) || tag == CONSTANT_Utf8)
+ ggc_mark_tree ((tree) cpool->data[index]);
+ }
+ }
+}
+
/* Handle "SourceFile" attribute. */
static void
@@ -1099,4 +1122,6 @@ init_jcf_parse ()
ggc_add_tree_root (¤t_field, 1);
ggc_add_tree_root (¤t_method, 1);
ggc_add_tree_root (¤t_file_list, 1);
+
+ ggc_add_root (¤t_jcf, 1, sizeof (JCF), ggc_mark_jcf);
}
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/