Commit cf484e91 by Nathan Froyd Committed by Nathan Froyd

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
parent 5f0f4a3b
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> 2010-05-25 Jakub Jelinek <jakub@redhat.com>
* lang.c (java_classify_record): Return RECORD_IS_INTERFACE * lang.c (java_classify_record): Return RECORD_IS_INTERFACE
......
...@@ -930,8 +930,6 @@ hashUtf8String (const char *str, int len) ...@@ -930,8 +930,6 @@ hashUtf8String (const char *str, int len)
return hash; return hash;
} }
static GTY(()) tree utf8_decl_list = NULL_TREE;
tree tree
build_utf8_ref (tree name) build_utf8_ref (tree name)
{ {
...@@ -996,14 +994,12 @@ build_utf8_ref (tree name) ...@@ -996,14 +994,12 @@ build_utf8_ref (tree name)
} }
} }
TREE_CHAIN (decl) = utf8_decl_list;
layout_decl (decl, 0); layout_decl (decl, 0);
DECL_SIZE (decl) = TYPE_SIZE (ctype); DECL_SIZE (decl) = TYPE_SIZE (ctype);
DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (ctype); DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (ctype);
pushdecl (decl); pushdecl (decl);
rest_of_decl_compilation (decl, global_bindings_p (), 0); rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_mark_needed_node (varpool_node (decl)); varpool_mark_needed_node (varpool_node (decl));
utf8_decl_list = decl;
ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl); ref = build1 (ADDR_EXPR, utf8const_ptr_type, decl);
IDENTIFIER_UTF8_REF (name) = ref; IDENTIFIER_UTF8_REF (name) = ref;
return ref; return ref;
......
...@@ -102,10 +102,6 @@ struct JCF; ...@@ -102,10 +102,6 @@ struct JCF;
#define output_class \ #define output_class \
java_global_trees[JTI_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 /* List of virtual decls referred to by this translation unit, used to
generate virtual method offset symbol table. */ generate virtual method offset symbol table. */
...@@ -370,9 +366,6 @@ enum java_tree_index ...@@ -370,9 +366,6 @@ enum java_tree_index
JTI_MAIN_CLASS, JTI_MAIN_CLASS,
JTI_CURRENT_CLASS, JTI_CURRENT_CLASS,
JTI_OUTPUT_CLASS, JTI_OUTPUT_CLASS,
JTI_ALL_CLASS_LIST,
JTI_PREDEF_FILENAMES,
JTI_MAX JTI_MAX
}; };
...@@ -630,9 +623,6 @@ extern GTY(()) tree java_global_trees[JTI_MAX]; ...@@ -630,9 +623,6 @@ extern GTY(()) tree java_global_trees[JTI_MAX];
#define nativecode_ptr_array_type_node \ #define nativecode_ptr_array_type_node \
java_global_trees[JTI_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 #define nativecode_ptr_type_node ptr_type_node
/* The decl for "_Jv_ResolvePoolEntry". */ /* The decl for "_Jv_ResolvePoolEntry". */
......
...@@ -71,7 +71,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -71,7 +71,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
extern struct obstack temporary_obstack; extern struct obstack temporary_obstack;
static GTY(()) tree parse_roots[3]; static GTY(()) tree parse_roots[2];
/* The FIELD_DECL for the current field. */ /* The FIELD_DECL for the current field. */
#define current_field parse_roots[0] #define current_field parse_roots[0]
...@@ -80,7 +80,7 @@ static GTY(()) tree parse_roots[3]; ...@@ -80,7 +80,7 @@ static GTY(()) tree parse_roots[3];
#define current_method parse_roots[1] #define current_method parse_roots[1]
/* A list of TRANSLATION_UNIT_DECLs for the files to be compiled. */ /* 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. */ /* Line 0 in current file, if compiling from bytecode. */
static location_t file_start_location; static location_t file_start_location;
...@@ -88,6 +88,9 @@ 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. */ /* The Java archive that provides main_class; the main input file. */
static GTY(()) struct JCF * main_jcf; 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 /* The number of source files passed to us by -fsource-filename and an
array of pointers to each name. Used by find_sourcefile(). */ array of pointers to each name. Used by find_sourcefile(). */
static int num_files = 0; static int num_files = 0;
...@@ -1479,8 +1482,7 @@ jcf_parse (JCF* jcf) ...@@ -1479,8 +1482,7 @@ jcf_parse (JCF* jcf)
if (current_class == object_type_node) if (current_class == object_type_node)
layout_class_methods (object_type_node); layout_class_methods (object_type_node);
else else
all_class_list = tree_cons (NULL_TREE, VEC_safe_push (tree, gc, all_class_list, TYPE_NAME (current_class));
TYPE_NAME (current_class), all_class_list );
} }
/* If we came across inner classes, load them now. */ /* If we came across inner classes, load them now. */
...@@ -1511,16 +1513,17 @@ duplicate_class_warning (const char *filename) ...@@ -1511,16 +1513,17 @@ duplicate_class_warning (const char *filename)
static void static void
java_layout_seen_class_methods (void) java_layout_seen_class_methods (void)
{ {
tree previous_list = all_class_list; unsigned start = 0;
tree end = NULL_TREE; unsigned end = VEC_length (tree, all_class_list);
tree current;
while (1) while (1)
{ {
for (current = previous_list; unsigned ix;
current != end; current = TREE_CHAIN (current)) 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); tree cls = TREE_TYPE (decl);
input_location = DECL_SOURCE_LOCATION (decl); input_location = DECL_SOURCE_LOCATION (decl);
...@@ -1533,11 +1536,11 @@ java_layout_seen_class_methods (void) ...@@ -1533,11 +1536,11 @@ java_layout_seen_class_methods (void)
/* Note that new classes might have been added while laying out /* Note that new classes might have been added while laying out
methods, changing the value of all_class_list. */ methods, changing the value of all_class_list. */
new_length = VEC_length (tree, all_class_list);
if (previous_list != all_class_list) if (end != new_length)
{ {
end = previous_list; start = end;
previous_list = all_class_list; end = new_length;
} }
else else
break; break;
...@@ -1664,22 +1667,24 @@ parse_class_file (void) ...@@ -1664,22 +1667,24 @@ parse_class_file (void)
input_location = save_location; input_location = save_location;
} }
static VEC(tree,gc) *predefined_filenames;
void void
add_predefined_file (tree name) add_predefined_file (tree name)
{ {
predef_filenames = tree_cons (NULL_TREE, name, predef_filenames); VEC_safe_push (tree, gc, predefined_filenames, name);
} }
int int
predefined_filename_p (tree node) 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; return 0;
} }
...@@ -1735,6 +1740,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -1735,6 +1740,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
tree node; tree node;
FILE *finput = NULL; FILE *finput = NULL;
int in_quotes = 0; int in_quotes = 0;
unsigned ix;
bitmap_obstack_initialize (&bit_obstack); bitmap_obstack_initialize (&bit_obstack);
field_offsets = BITMAP_ALLOC (&bit_obstack); field_offsets = BITMAP_ALLOC (&bit_obstack);
...@@ -1834,8 +1840,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -1834,8 +1840,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
{ {
tree file_decl = build_decl (input_location, tree file_decl = build_decl (input_location,
TRANSLATION_UNIT_DECL, node, NULL); TRANSLATION_UNIT_DECL, node, NULL);
TREE_CHAIN (file_decl) = current_file_list; VEC_safe_push (tree, gc, current_file_list, file_decl);
current_file_list = file_decl;
IS_A_COMMAND_LINE_FILENAME_P (node) = 1; IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
} }
} }
...@@ -1853,17 +1858,16 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -1853,17 +1858,16 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
const char *resource_filename; const char *resource_filename;
/* Only one resource file may be compiled at a time. */ /* 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); compile_resource_file (resource_name, resource_filename);
goto finish; goto finish;
} }
current_jcf = main_jcf; current_jcf = main_jcf;
current_file_list = nreverse (current_file_list); for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
for (node = current_file_list; node; node = TREE_CHAIN (node))
{ {
unsigned char magic_string[4]; unsigned char magic_string[4];
char *real_path; char *real_path;
...@@ -1952,7 +1956,7 @@ java_parse_file (int set_yydebug ATTRIBUTE_UNUSED) ...@@ -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); input_location = DECL_SOURCE_LOCATION (node);
if (CLASS_FILE_P (node)) if (CLASS_FILE_P (node))
......
...@@ -43,7 +43,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -43,7 +43,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#endif #endif
/* A list of all the resources files. */ /* A list of all the resources files. */
static GTY(()) tree resources = NULL; static GTY(()) VEC(tree,gc) *resources;
void void
compile_resource_data (const char *name, const char *buffer, int length) 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) ...@@ -86,13 +86,14 @@ compile_resource_data (const char *name, const char *buffer, int length)
rest_of_decl_compilation (decl, global_bindings_p (), 0); rest_of_decl_compilation (decl, global_bindings_p (), 0);
varpool_finalize_decl (decl); varpool_finalize_decl (decl);
resources = tree_cons (NULL_TREE, decl, resources); VEC_safe_push (tree, gc, resources, decl);
} }
void void
write_resource_constructor (tree *list_p) write_resource_constructor (tree *list_p)
{ {
tree iter, t, register_resource_fn; tree decl, t, register_resource_fn;
unsigned ix;
if (resources == NULL) if (resources == NULL)
return; return;
...@@ -105,9 +106,9 @@ write_resource_constructor (tree *list_p) ...@@ -105,9 +106,9 @@ write_resource_constructor (tree *list_p)
register_resource_fn = t; register_resource_fn = t;
/* Write out entries in the same order in which they were defined. */ /* 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); t = build_call_expr (register_resource_fn, 1, t);
append_to_statement_list (t, list_p); append_to_statement_list (t, list_p);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment