diff options
author | Per Bothner <per@bothner.com> | 2001-01-21 13:18:04 -0800 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2001-01-21 13:18:04 -0800 |
commit | 3432b91b650d7b134217ee74392840f6a4d85c4b (patch) | |
tree | 60e3765a53fc7ebe77e1ad4d822cdd97fe9ff500 /gcc/java/jcf-parse.c | |
parent | 2c36c7fd96326df139342000fb52fa7772d0849f (diff) | |
download | gcc-3432b91b650d7b134217ee74392840f6a4d85c4b.zip gcc-3432b91b650d7b134217ee74392840f6a4d85c4b.tar.gz gcc-3432b91b650d7b134217ee74392840f6a4d85c4b.tar.bz2 |
jcf-parse.c (ggc_mark_jcf): New function.
* jcf-parse.c (ggc_mark_jcf): New function.
(init_jcf_parse): Register current_jcf as ggc root.
From-SVN: r39173
Diffstat (limited to 'gcc/java/jcf-parse.c')
-rw-r--r-- | gcc/java/jcf-parse.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index e917d1d..b1214d4 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -93,6 +93,29 @@ static int find_in_current_zip PARAMS ((const char *, struct JCF **)); 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. */ @@ -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); } |