summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-28 13:41:55 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-28 13:41:55 +0000
commitc9d228b7caffdcdd8753641944c5af49ad360513 (patch)
treef6ffb6a81a45d1ae93105382f342bf023cae3ccd /gcc
parent93f85900e6d276be74c6d0a3e649b25cba4abbc7 (diff)
downloadgcc-c9d228b7caffdcdd8753641944c5af49ad360513.tar.gz
* java-tree.h (method_entry): Declare. Declare VECs containing it.
(struct lang_type): Change type of otable_methods, atable_methods, and itable_methods to VECs. Fix comment for atable_methods. (emit_symbol_table): Take a VEC instead of a tree. (get_symbol_table_index): Take a VEC * instead of a tree *. * class.c (add_table_and_syms): Take a VEC instead of a tree. (emit_symbol_table): Update for changed parameter type. * expr.c (get_symbol_table_index): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159974 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog11
-rw-r--r--gcc/java/class.c30
-rw-r--r--gcc/java/expr.c38
-rw-r--r--gcc/java/java-tree.h25
4 files changed, 54 insertions, 50 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 45c1931ed95..3654ae304eb 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,14 @@
+2010-05-28 Nathan Froyd <froydnj@codesourcery.com>
+
+ * java-tree.h (method_entry): Declare. Declare VECs containing it.
+ (struct lang_type): Change type of otable_methods, atable_methods, and
+ itable_methods to VECs. Fix comment for atable_methods.
+ (emit_symbol_table): Take a VEC instead of a tree.
+ (get_symbol_table_index): Take a VEC * instead of a tree *.
+ * class.c (add_table_and_syms): Take a VEC instead of a tree.
+ (emit_symbol_table): Update for changed parameter type.
+ * expr.c (get_symbol_table_index): Likewise.
+
2010-05-27 Steven Bosscher <steven@gcc.gnu.org>
* buildings.c: Pretend to be a backend file by undefining
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 49299b885cd..f346ad420f7 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1720,11 +1720,11 @@ supers_all_compiled (tree type)
static void
add_table_and_syms (VEC(constructor_elt,gc) **v,
- tree method_slot,
+ VEC(method_entry,gc) *methods,
const char *table_name, tree table_slot, tree table_type,
const char *syms_name, tree syms_slot)
{
- if (method_slot == NULL_TREE)
+ if (methods == NULL)
{
PUSH_FIELD_VALUE (*v, table_name, null_pointer_node);
PUSH_FIELD_VALUE (*v, syms_name, null_pointer_node);
@@ -2886,31 +2886,27 @@ build_symbol_entry (tree decl, tree special)
/* Emit a symbol table: used by -findirect-dispatch. */
tree
-emit_symbol_table (tree name, tree the_table, tree decl_list,
+emit_symbol_table (tree name, tree the_table,
+ VEC(method_entry,gc) *decl_table,
tree the_syms_decl, tree the_array_element_type,
int element_size)
{
- tree method_list, method, table, list, null_symbol;
+ tree table, list, null_symbol;
tree table_size, the_array_type;
- int index;
+ unsigned index;
+ method_entry *e;
/* Only emit a table if this translation unit actually made any
references via it. */
- if (decl_list == NULL_TREE)
+ if (decl_table == NULL)
return the_table;
/* Build a list of _Jv_MethodSymbols for each entry in otable_methods. */
- index = 0;
- method_list = decl_list;
- list = NULL_TREE;
- while (method_list != NULL_TREE)
- {
- tree special = TREE_PURPOSE (method_list);
- method = TREE_VALUE (method_list);
- list = tree_cons (NULL_TREE, build_symbol_entry (method, special), list);
- method_list = TREE_CHAIN (method_list);
- index++;
- }
+ list = NULL_TREE;
+ for (index = 0; VEC_iterate (method_entry, decl_table, index, e); index++)
+ list = tree_cons (NULL_TREE,
+ build_symbol_entry (e->method, e->special),
+ list);
/* Terminate the list with a "null" entry. */
null_symbol = build_symbol_table_entry (null_pointer_node,
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 0f3cf1aef4e..62598e7c6a2 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2289,34 +2289,22 @@ invoke_build_dtable (int is_invoke_interface, VEC(tree,gc) *arg_list)
reused. */
int
-get_symbol_table_index (tree t, tree special, tree *symbol_table)
+get_symbol_table_index (tree t, tree special,
+ VEC(method_entry,gc) **symbol_table)
{
- int i = 1;
- tree method_list;
+ method_entry *e;
+ unsigned i;
- if (*symbol_table == NULL_TREE)
- {
- *symbol_table = build_tree_list (special, t);
- return 1;
- }
-
- method_list = *symbol_table;
-
- while (1)
- {
- tree value = TREE_VALUE (method_list);
- tree purpose = TREE_PURPOSE (method_list);
- if (value == t && purpose == special)
- return i;
- i++;
- if (TREE_CHAIN (method_list) == NULL_TREE)
- break;
- else
- method_list = TREE_CHAIN (method_list);
- }
+ for (i = 0; VEC_iterate (method_entry, *symbol_table, i, e); i++)
+ if (t == e->method && special == e->special)
+ goto done;
+
+ e = VEC_safe_push (method_entry, gc, *symbol_table, NULL);
+ e->method = t;
+ e->special = special;
- TREE_CHAIN (method_list) = build_tree_list (special, t);
- return i;
+ done:
+ return i+1;
}
tree
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 83f3b3d4a36..f48e4215925 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -916,6 +916,14 @@ struct GTY(()) lang_decl {
#define TYPE_REFLECTION_DATASIZE(T) \
(TYPE_LANG_SPECIFIC (T)->reflection_datasize)
+typedef struct GTY(()) method_entry_d {
+ tree method;
+ tree special;
+} method_entry;
+
+DEF_VEC_O(method_entry);
+DEF_VEC_ALLOC_O(method_entry,gc);
+
struct GTY(()) lang_type {
tree signature;
struct JCF *jcf;
@@ -923,18 +931,18 @@ struct GTY(()) lang_type {
tree cpool_data_ref; /* Cached */
tree package_list; /* List of package names, progressive */
- tree otable_methods; /* List of static decls referred to by this
- class. */
+ VEC(method_entry,gc) *otable_methods; /* List of static decls referred
+ to by this class. */
tree otable_decl; /* The static address table. */
tree otable_syms_decl;
- tree atable_methods; /* List of static decls referred to by this
- class. */
+ VEC(method_entry,gc) *atable_methods; /* List of abstract methods
+ referred to by this class. */
tree atable_decl; /* The static address table. */
tree atable_syms_decl;
- tree itable_methods; /* List of interfaces methods referred
- to by this class. */
+ VEC(method_entry,gc) *itable_methods; /* List of interface methods
+ referred to by this class. */
tree itable_decl; /* The interfaces table. */
tree itable_syms_decl;
@@ -1103,7 +1111,8 @@ extern void make_class_data (tree);
extern int alloc_name_constant (int, tree);
extern int alloc_constant_fieldref (tree, tree);
extern void emit_register_classes (tree *);
-extern tree emit_symbol_table (tree, tree, tree, tree, tree, int);
+extern tree emit_symbol_table (tree, tree, VEC(method_entry,gc) *,
+ tree, tree, int);
extern void lang_init_source (int);
extern void write_classfile (tree);
extern char *print_int_node (tree);
@@ -1206,7 +1215,7 @@ extern void register_exception_range(struct eh_range *, int, int);
extern void finish_method (tree);
extern void java_expand_body (tree);
-extern int get_symbol_table_index (tree, tree, tree *);
+extern int get_symbol_table_index (tree, tree, VEC(method_entry,gc) **);
extern tree make_catch_class_record (tree, tree);
extern tree emit_catch_table (tree);