OSDN Git Service

* c-decl.c (set_block): Set NAMES and BLOCKS from BLOCK.
[pf3gnuchains/gcc-fork.git] / gcc / java / decl.c
index 04e0734..18b1ec5 100644 (file)
@@ -1,6 +1,7 @@
 /* Process declarations and variables for the GNU compiler for the
    Java(TM) language.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -35,7 +36,6 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "toplev.h"
 #include "function.h"
 #include "except.h"
-#include "defaults.h"
 #include "java-except.h"
 #include "ggc.h"
 
@@ -127,8 +127,7 @@ push_jvm_slot (index, decl)
   /* Now link the decl into the decl_map. */
   if (DECL_LANG_SPECIFIC (decl) == NULL)
     {
-      DECL_LANG_SPECIFIC (decl)
-       = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl_var));
+      MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
       DECL_LOCAL_START_PC (decl) = 0;
       DECL_LOCAL_END_PC (decl) = DECL_CODE_LENGTH (current_function_decl);
       DECL_LOCAL_SLOT_NUMBER (decl) = index;
@@ -400,7 +399,7 @@ builtin_function (name, type, function_code, class, library_name)
   TREE_PUBLIC (decl) = 1;
   if (library_name)
     DECL_ASSEMBLER_NAME (decl) = get_identifier (library_name);
-  make_decl_rtl (decl, NULL_PTR, 1);
+  make_decl_rtl (decl, NULL_PTR);
   pushdecl (decl);
   DECL_BUILT_IN_CLASS (decl) = class;
   DECL_FUNCTION_CODE (decl) = function_code;
@@ -418,7 +417,7 @@ create_primitive_vtable (name)
   sprintf (buf, "_Jv_%sVTable", name);
   r = build_decl (VAR_DECL, get_identifier (buf), ptr_type_node);
   DECL_EXTERNAL (r) = 1;
-  make_decl_rtl (r, buf, 1);
+  make_decl_rtl (r, buf);
   return r;
 }
 
@@ -475,7 +474,7 @@ init_decl_processing ()
   integer_one_node = build_int_2 (1, 0);
   integer_two_node = build_int_2 (2, 0);
   integer_four_node = build_int_2 (4, 0);
-  integer_negative_one_node = build_int_2 (-1, 0);
+  integer_minus_one_node = build_int_2 (-1, -1);
 
   size_zero_node = size_int (0);
   size_one_node = size_int (1);
@@ -603,6 +602,7 @@ init_decl_processing ()
   super_identifier_node = get_identifier ("super");
   continue_identifier_node = get_identifier ("continue");
   access0_identifier_node = get_identifier ("access$0");
+  classdollar_identifier_node = get_identifier ("class$");
 
   /* for lack of a better place to put this stub call */
   init_expr_processing();
@@ -673,6 +673,7 @@ init_decl_processing ()
   PUSH_FIELD (class_type_node, field, "depth", short_type_node);
   PUSH_FIELD (class_type_node, field, "ancestors", ptr_type_node);
   PUSH_FIELD (class_type_node, field, "idt", ptr_type_node);  
+  PUSH_FIELD (class_type_node, field, "arrayclass", ptr_type_node);  
   for (t = TYPE_FIELDS (class_type_node);  t != NULL_TREE;  t = TREE_CHAIN (t))
     FIELD_PRIVATE (t) = 1;
   push_super_field (class_type_node, object_type_node);
@@ -776,7 +777,7 @@ init_decl_processing ()
   t = tree_cons (NULL_TREE, int_type_node, 
                 tree_cons (NULL_TREE, int_type_node, endlink));
   soft_newarray_node
-      = builtin_function ("_Jv_NewArray",
+      = builtin_function ("_Jv_NewPrimArray",
                          build_function_type(ptr_type_node, t),
                          0, NOT_BUILT_IN, NULL_PTR);
   DECL_IS_MALLOC (soft_newarray_node) = 1;
@@ -1544,6 +1545,10 @@ set_block (block)
      register tree block;
 {
   current_binding_level->this_block = block;
+  current_binding_level->names = chainon (current_binding_level->names,
+                                         BLOCK_VARS (block));
+  current_binding_level->blocks = chainon (current_binding_level->blocks,
+                                          BLOCK_SUBBLOCKS (block));
 }
 
 /* integrate_decl_tree calls this function. */
@@ -1620,8 +1625,7 @@ give_name_to_locals (jcf)
             comments for expr.c:maybe_adjust_start_pc. */
          start_pc = maybe_adjust_start_pc (jcf, code_offset, start_pc, slot);
 
-         DECL_LANG_SPECIFIC (decl)
-           = (struct lang_decl *) ggc_alloc (sizeof (struct lang_decl_var));
+         MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl);
          DECL_LOCAL_SLOT_NUMBER (decl) = slot;
          DECL_LOCAL_START_PC (decl) = start_pc;
 #if 0
@@ -1819,8 +1823,8 @@ start_java_method (fndecl)
     {
       tree parm_name = NULL_TREE, parm_decl;
       tree parm_type = TREE_VALUE (tem);
-      if (i >= DECL_MAX_LOCALS(fndecl))
-       fatal ("function has more parameters than local slots");
+      if (i >= DECL_MAX_LOCALS (fndecl))
+       abort ();
 
       parm_decl = build_decl (PARM_DECL, parm_name, parm_type);
       DECL_CONTEXT (parm_decl) = fndecl;
@@ -1901,7 +1905,8 @@ lang_mark_tree (t)
       ggc_mark_tree (li->utf8_ref);
     }
   else if (TREE_CODE (t) == VAR_DECL
-          || TREE_CODE (t) == PARM_DECL)
+          || TREE_CODE (t) == PARM_DECL
+          || TREE_CODE (t) == FIELD_DECL)
     {
       struct lang_decl_var *ldv = 
        ((struct lang_decl_var *) DECL_LANG_SPECIFIC (t));
@@ -1909,6 +1914,8 @@ lang_mark_tree (t)
        {
          ggc_mark (ldv);
          ggc_mark_tree (ldv->slot_chain);
+         ggc_mark_tree (ldv->am);
+         ggc_mark_tree (ldv->wfl);
        }
     }
   else if (TREE_CODE (t) == FUNCTION_DECL)
@@ -1918,6 +1925,7 @@ lang_mark_tree (t)
       if (ld)
        {
          ggc_mark (ld);
+         ggc_mark_tree (ld->wfl);
          ggc_mark_tree (ld->throws_list);
          ggc_mark_tree (ld->function_decl_body);
          ggc_mark_tree (ld->called_constructor);
@@ -1937,6 +1945,7 @@ lang_mark_tree (t)
          ggc_mark_tree (lt->clinit_stmt_list);
          ggc_mark_tree (lt->ii_block);
          ggc_mark_tree (lt->dot_class);
+         ggc_mark_tree (lt->package_list);
        }
     }
 }