OSDN Git Service

PR middle-end/46314
[pf3gnuchains/gcc-fork.git] / gcc / java / expr.c
index 0f3cf1a..85cf1a2 100644 (file)
@@ -35,6 +35,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "jcf.h"
 #include "java-except.h"
 #include "parse.h"
+#include "diagnostic-core.h"
 #include "toplev.h"
 #include "ggc.h"
 #include "tree-iterator.h"
@@ -463,7 +464,7 @@ add_type_assertion (tree klass, int assertion_code, tree op1, tree op2)
   if (*as_pp)
     return;
 
-  *as_pp = ggc_alloc (sizeof (type_assertion));
+  *as_pp = ggc_alloc_type_assertion ();
   **(type_assertion **)as_pp = as;
 }
 
@@ -1633,7 +1634,7 @@ lookup_field (tree *typep, tree name)
       tree save_field;
       int i;
 
-      for (field = TYPE_FIELDS (*typep); field; field = TREE_CHAIN (field))
+      for (field = TYPE_FIELDS (*typep); field; field = DECL_CHAIN (field))
        if (DECL_NAME (field) == name)
          return field;
 
@@ -1762,7 +1763,8 @@ lookup_label (int pc)
   char buf[32];
   if (pc > highest_label_pc_this_method)
     highest_label_pc_this_method = pc;
-  ASM_GENERATE_INTERNAL_LABEL(buf, "LJpc=", start_label_pc_this_method + pc);
+  targetm.asm_out.generate_internal_label (buf, "LJpc=",
+                                          start_label_pc_this_method + pc);
   name = get_identifier (buf);
   if (IDENTIFIER_LOCAL_VALUE (name))
     return IDENTIFIER_LOCAL_VALUE (name);
@@ -1782,7 +1784,7 @@ generate_name (void)
 {
   static int l_number = 0;
   char buff [32];
-  ASM_GENERATE_INTERNAL_LABEL(buff, "LJv", l_number);
+  targetm.asm_out.generate_internal_label (buff, "LJv", l_number);
   l_number++;
   return get_identifier (buff);
 }
@@ -1951,7 +1953,7 @@ attach_init_test_initialization_flags (void **entry, void *ptr)
       if (TREE_CODE (block) == BIND_EXPR)
         {
          tree body = BIND_EXPR_BODY (block);
-         TREE_CHAIN (ite->value) = BIND_EXPR_VARS (block);
+         DECL_CHAIN (ite->value) = BIND_EXPR_VARS (block);
          BIND_EXPR_VARS (block) = ite->value;
          body = build2 (COMPOUND_EXPR, void_type_node,
                         build1 (DECL_EXPR, void_type_node, ite->value), body);
@@ -2238,7 +2240,7 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
                    lookup_field (&class_type_node, methods_ident),
                    NULL_TREE);
       for (meth = TYPE_METHODS (self_type);
-          ; meth = TREE_CHAIN (meth))
+          ; meth = DECL_CHAIN (meth))
        {
          if (method == meth)
            break;
@@ -2289,34 +2291,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_EACH_VEC_ELT (method_entry, *symbol_table, i, e)
+    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 
@@ -2654,7 +2644,7 @@ build_jni_stub (tree method)
       res_var = build_decl (input_location, VAR_DECL, get_identifier ("res"),
                            TREE_TYPE (TREE_TYPE (method)));
       DECL_CONTEXT (res_var) = method;
-      TREE_CHAIN (env_var) = res_var;
+      DECL_CHAIN (env_var) = res_var;
     }
 
   method_args = DECL_ARGUMENTS (method);
@@ -2684,7 +2674,7 @@ build_jni_stub (tree method)
   /* All the arguments to this method become arguments to the
      underlying JNI function.  If we had to wrap object arguments in a
      special way, we would do that here.  */
-  for (tem = method_args; tem != NULL_TREE; tem = TREE_CHAIN (tem))
+  for (tem = method_args; tem != NULL_TREE; tem = DECL_CHAIN (tem))
     {
       int arg_bits = TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)));
 #ifdef PARM_BOUNDARY
@@ -3790,7 +3780,7 @@ promote_arguments (void)
   int i;
   tree arg;
   for (arg = DECL_ARGUMENTS (current_function_decl), i = 0;
-       arg != NULL_TREE;  arg = TREE_CHAIN (arg), i++)
+       arg != NULL_TREE;  arg = DECL_CHAIN (arg), i++)
     {
       tree arg_type = TREE_TYPE (arg);
       if (INTEGRAL_TYPE_P (arg_type)