aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-05-26 13:55:30 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-05-26 13:55:30 +0000
commitcf484e9170ac7734b57a294d40dad8a51233ae32 (patch)
treed7090aa8ea8d699205d27a0d02e5b8fbb2502533 /gcc
parent5f0f4a3bc5e8f25e586b6983d6c8138a89aa030e (diff)
downloadgcc-cf484e9170ac7734b57a294d40dad8a51233ae32.zip
gcc-cf484e9170ac7734b57a294d40dad8a51233ae32.tar.gz
gcc-cf484e9170ac7734b57a294d40dad8a51233ae32.tar.bz2
class.c (utf8_decl_list): Delete.
* class.c (utf8_decl_list): Delete. (build_utf8_ref): Remove references to it. * java-tree.h (all_class_list): Delete. (predef_filenames): Delete. (enum java_tree_index) [JTI ALL_CLASS_LIST,JTI_PREDEF_FILENAMES]: Delete. * jcf-parse.c (parse_roots): Decrease size to 2. (current_file_list): Convert to a VEC. (all_class_list): Declare. (jcf_parse): Adjust for new type of all_class_list. (java_layout_seen_class_methods): Likewise. (predefined_filenames): Declare. (add_predefined_file): Use it. (predefined_filename_p): Likewise. (java_parse_file): Adjust for new type of current_file_list. * From-SVN: r159870
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog18
-rw-r--r--gcc/java/class.c4
-rw-r--r--gcc/java/java-tree.h10
-rw-r--r--gcc/java/jcf-parse.c60
-rw-r--r--gcc/java/resource.c11
5 files changed, 56 insertions, 47 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index c0d6ccd..6b8100d 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,21 @@
+2010-05-26 Nathan Froyd <froydnj@codesourcery.com>
+
+ * class.c (utf8_decl_list): Delete.
+ (build_utf8_ref): Remove references to it.
+ * java-tree.h (all_class_list): Delete.
+ (predef_filenames): Delete.
+ (enum java_tree_index) [JTI ALL_CLASS_LIST,JTI_PREDEF_FILENAMES]:
+ Delete.
+ * jcf-parse.c (parse_roots): Decrease size to 2.
+ (current_file_list): Convert to a VEC.
+ (all_class_list): Declare.
+ (jcf_parse): Adjust for new type of all_class_list.
+ (java_layout_seen_class_methods): Likewise.
+ (predefined_filenames): Declare.
+ (add_predefined_file): Use it.
+ (predefined_filename_p): Likewise.
+ (java_parse_file): Adjust for new type of current_file_list. *
+
2010-05-25 Jakub Jelinek <jakub@redhat.com>
* lang.c (java_classify_record): Return RECORD_IS_INTERFACE
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 919d698..5f91ddc 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -930,8 +930,6 @@ hashUtf8String (const char *str, int len)
return hash;
}
-static GTY(()) tree utf8_decl_list = NULL_TREE;
-
tree
build_utf8_ref (tree name)
{
@@ -996,14 +994,12 @@ build_utf8_ref (tree name)
}
}
- TREE_CHAIN (decl) = utf8_decl_list;
layout_decl (decl, 0);
DECL_SIZE (decl) = TYPE_SIZE (ctype);
DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (ctype);
pushdecl (decl);
rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_mark_needed_node (varpool_node (decl));
- utf8_decl_list = decl;
ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl);
IDENTIFIER_UTF8_REF (name) = ref;
return ref;
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index dc16eb2..0482abe 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -102,10 +102,6 @@ struct JCF;
#define output_class \
java_global_trees[JTI_OUTPUT_CLASS]
-/* List of all class DECLs seen so far. */
-#define all_class_list \
- java_global_trees[JTI_ALL_CLASS_LIST]
-
/* List of virtual decls referred to by this translation unit, used to
generate virtual method offset symbol table. */
@@ -370,9 +366,6 @@ enum java_tree_index
JTI_MAIN_CLASS,
JTI_CURRENT_CLASS,
JTI_OUTPUT_CLASS,
- JTI_ALL_CLASS_LIST,
-
- JTI_PREDEF_FILENAMES,
JTI_MAX
};
@@ -630,9 +623,6 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
#define nativecode_ptr_array_type_node \
java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
-#define predef_filenames \
- java_global_trees[JTI_PREDEF_FILENAMES]
-
#define nativecode_ptr_type_node ptr_type_node
/* The decl for "_Jv_ResolvePoolEntry". */
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index a85e653..9ce5561 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -71,7 +71,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
extern struct obstack temporary_obstack;
-static GTY(()) tree parse_roots[3];
+static GTY(()) tree parse_roots[2];
/* The FIELD_DECL for the current field. */
#define current_field parse_roots[0]
@@ -80,7 +80,7 @@ static GTY(()) tree parse_roots[3];
#define current_method parse_roots[1]
/* A list of TRANSLATION_UNIT_DECLs for the files to be compiled. */
-#define current_file_list parse_roots[2]
+static GTY(()) VEC(tree,gc) *current_file_list;
/* Line 0 in current file, if compiling from bytecode. */
static location_t file_start_location;
@@ -88,6 +88,9 @@ static location_t file_start_location;
/* The Java archive that provides main_class; the main input file. */
static GTY(()) struct JCF * main_jcf;
+/* A list of all the class DECLs seen so far. */
+static GTY(()) VEC(tree,gc) *all_class_list;
+
/* The number of source files passed to us by -fsource-filename and an
array of pointers to each name. Used by find_sourcefile(). */
static int num_files = 0;
@@ -1479,8 +1482,7 @@ jcf_parse (JCF* jcf)
if (current_class == object_type_node)
layout_class_methods (object_type_node);
else
- all_class_list = tree_cons (NULL_TREE,
- TYPE_NAME (current_class), all_class_list );
+ VEC_safe_push (tree, gc, all_class_list, TYPE_NAME (current_class));
}
/* If we came across inner classes, load them now. */
@@ -1511,16 +1513,17 @@ duplicate_class_warning (const char *filename)
static void
java_layout_seen_class_methods (void)
{
- tree previous_list = all_class_list;
- tree end = NULL_TREE;
- tree current;
+ unsigned start = 0;
+ unsigned end = VEC_length (tree, all_class_list);
while (1)
{
- for (current = previous_list;
- current != end; current = TREE_CHAIN (current))
+ unsigned ix;
+ unsigned new_length;
+
+ for (ix = start; ix != end; ix++)
{
- tree decl = TREE_VALUE (current);
+ tree decl = VEC_index (tree, all_class_list, ix);
tree cls = TREE_TYPE (decl);
input_location = DECL_SOURCE_LOCATION (decl);
@@ -1533,11 +1536,11 @@ java_layout_seen_class_methods (void)
/* Note that new classes might have been added while laying out
methods, changing the value of all_class_list. */
-
- if (previous_list != all_class_list)
+ new_length = VEC_length (tree, all_class_list);
+ if (end != new_length)
{
- end = previous_list;
- previous_list = all_class_list;
+ start = end;
+ end = new_length;
}
else
break;
@@ -1664,22 +1667,24 @@ parse_class_file (void)
input_location = save_location;
}
+static VEC(tree,gc) *predefined_filenames;
+
void
add_predefined_file (tree name)
{
- predef_filenames = tree_cons (NULL_TREE, name, predef_filenames);
+ VEC_safe_push (tree, gc, predefined_filenames, name);
}
int
predefined_filename_p (tree node)
{
- tree iter;
+ unsigned ix;
+ tree f;
+
+ for (ix = 0; VEC_iterate (tree, predefined_filenames, ix, f); ix++)
+ if (f == node)
+ return 1;
- for (iter = predef_filenames; iter != NULL_TREE; iter = TREE_CHAIN (iter))
- {
- if (TREE_VALUE (iter) == node)
- return 1;
- }
return 0;
}
@@ -1735,6 +1740,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
tree node;
FILE *finput = NULL;
int in_quotes = 0;
+ unsigned ix;
bitmap_obstack_initialize (&bit_obstack);
field_offsets = BITMAP_ALLOC (&bit_obstack);
@@ -1834,8 +1840,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
{
tree file_decl = build_decl (input_location,
TRANSLATION_UNIT_DECL, node, NULL);
- TREE_CHAIN (file_decl) = current_file_list;
- current_file_list = file_decl;
+ VEC_safe_push (tree, gc, current_file_list, file_decl);
IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
}
}
@@ -1853,17 +1858,16 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
const char *resource_filename;
/* Only one resource file may be compiled at a time. */
- assert (TREE_CHAIN (current_file_list) == NULL);
+ assert (VEC_length (tree, current_file_list) == 1);
- resource_filename = IDENTIFIER_POINTER (DECL_NAME (current_file_list));
+ resource_filename = IDENTIFIER_POINTER (DECL_NAME (VEC_index (tree, current_file_list, 0)));
compile_resource_file (resource_name, resource_filename);
goto finish;
}
current_jcf = main_jcf;
- current_file_list = nreverse (current_file_list);
- for (node = current_file_list; node; node = TREE_CHAIN (node))
+ for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
{
unsigned char magic_string[4];
char *real_path;
@@ -1952,7 +1956,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
}
}
- for (node = current_file_list; node; node = TREE_CHAIN (node))
+ for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
{
input_location = DECL_SOURCE_LOCATION (node);
if (CLASS_FILE_P (node))
diff --git a/gcc/java/resource.c b/gcc/java/resource.c
index 96fc087..56a0a1b 100644
--- a/gcc/java/resource.c
+++ b/gcc/java/resource.c
@@ -43,7 +43,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#endif
/* A list of all the resources files. */
-static GTY(()) tree resources = NULL;
+static GTY(()) VEC(tree,gc) *resources;
void
compile_resource_data (const char *name, const char *buffer, int length)
@@ -86,13 +86,14 @@ compile_resource_data (const char *name, const char *buffer, int length)
rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_finalize_decl (decl);
- resources = tree_cons (NULL_TREE, decl, resources);
+ VEC_safe_push (tree, gc, resources, decl);
}
void
write_resource_constructor (tree *list_p)
{
- tree iter, t, register_resource_fn;
+ tree decl, t, register_resource_fn;
+ unsigned ix;
if (resources == NULL)
return;
@@ -105,9 +106,9 @@ write_resource_constructor (tree *list_p)
register_resource_fn = t;
/* Write out entries in the same order in which they were defined. */
- for (iter = nreverse (resources); iter ; iter = TREE_CHAIN (iter))
+ for (ix = 0; VEC_iterate (tree, resources, ix, decl); ix++)
{
- t = build_fold_addr_expr (TREE_VALUE (iter));
+ t = build_fold_addr_expr (decl);
t = build_call_expr (register_resource_fn, 1, t);
append_to_statement_list (t, list_p);
}