]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* java-tree.h (method_entry): Declare. Declare VECs containing it.
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 May 2010 13:41:55 +0000 (13:41 +0000)
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 May 2010 13:41:55 +0000 (13:41 +0000)
(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

gcc/java/ChangeLog
gcc/java/class.c
gcc/java/expr.c
gcc/java/java-tree.h

index 45c1931ed95c85c4dba9e1dffa1be165e74c032f..3654ae304ebcb1907864425bc3c166c5b002b4c7 100644 (file)
@@ -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
index 49299b885cd5ed8798e7fb4c97dff648fd043b34..f346ad420f7ec54793d1c90242e54a44aef76252 100644 (file)
@@ -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,
index 0f3cf1aef4ef4094f256c4eadb090ecbe03ee90e..62598e7c6a2c3657a47911508bff255246e4044f 100644 (file)
@@ -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 
index 83f3b3d4a368a8b09d1091a11aba78164f210450..f48e4215925146508545730f5a5cb0df364174cb 100644 (file)
@@ -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);