Fix a problem where rest_of_decl_compilation applied to class_dtable_decl causes...
authorPer Bothner <per@bothner.com>
Tue, 6 Mar 2001 07:29:31 +0000 (23:29 -0800)
committerPer Bothner <bothner@gcc.gnu.org>
Tue, 6 Mar 2001 07:29:31 +0000 (23:29 -0800)
Fix a problem where rest_of_decl_compilation applied to
class_dtable_decl causes problems because it was done too early,
before output file was opened.
* decl.c (init_decl_processing):  Remove init of class_dtable_decl.
* class.c (class_dtable_decl):  Add macro - element of class_roots.
(make_class_data):  Define class_dtable_decl.
* java-tree.h (JTI_CLASS_DTABLE_DECL, class_dtable_decl):  Removed.

From-SVN: r40256

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

index 48ce71547562b36a4e78637473344cfc426780f5..7a436e5de9dae9f7f812b2dd0ccbfc0e2b9142fc 100644 (file)
@@ -1,3 +1,13 @@
+2001-03-05  Per Bothner  <per@bothner.com>
+
+       Fix a problem where rest_of_decl_compilation applied to
+       class_dtable_decl causes problems because it was done too early,
+       before output file was opened.
+       * decl.c (init_decl_processing):  Remove init of class_dtable_decl.
+       * class.c (class_dtable_decl):  Add macro - element of class_roots.
+       (make_class_data):  Define class_dtable_decl.
+       * java-tree.h (JTI_CLASS_DTABLE_DECL, class_dtable_decl):  Removed.
+
 2001-03-01  Zack Weinberg  <zackw@stanford.edu>
 
        * java/class.c, java/decl.c, java/java-tree.h: Replace all
index be2e5a4c23eb777651fe908fbbb4ab07cce2ee2f..698ca04bb4fbc174d60e01d0517d2163dfa81054 100644 (file)
@@ -84,11 +84,13 @@ static assume_compiled_node *find_assume_compiled_node
 
 static assume_compiled_node *assume_compiled_tree;
 
-static tree class_roots[4] = { NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE };
+static tree class_roots[5]
+= { NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE };
 #define registered_class class_roots[0]
 #define fields_ident class_roots[1]  /* get_identifier ("fields") */
 #define info_ident class_roots[2]  /* get_identifier ("info") */
 #define class_list class_roots[3]
+#define class_dtable_decl class_roots[4]
 
 /* Return the node that most closely represents the class whose name
    is IDENT.  Start the search from NODE.  Return NULL if an
@@ -1347,6 +1349,17 @@ make_class_data (type)
       DECL_IGNORED_P (dtable_decl) = 1;
       TREE_PUBLIC (dtable_decl) = 1;
       rest_of_decl_compilation (dtable_decl, (char*) 0, 1, 0);
+      if (type == class_type_node)
+       class_dtable_decl = dtable_decl;
+    }
+
+  if (class_dtable_decl == NULL_TREE)
+    {
+      class_dtable_decl = build_dtable_decl (class_type_node);
+      TREE_STATIC (class_dtable_decl) = 1;
+      DECL_ARTIFICIAL (class_dtable_decl) = 1;
+      DECL_IGNORED_P (class_dtable_decl) = 1;
+      rest_of_decl_compilation (class_dtable_decl, (char*) 0, 1, 0);
     }
 
   super = CLASSTYPE_SUPER (type);
index 739ddee285dedf233d7c469762fe3818a70da25a..32e6976ab72c9e61d142d747019ca1f0cb042d3f 100644 (file)
@@ -636,12 +636,6 @@ init_decl_processing ()
     FIELD_PRIVATE (t) = 1;
   FINISH_RECORD (object_type_node);
 
-  class_dtable_decl = build_dtable_decl (class_type_node);
-  TREE_STATIC (class_dtable_decl) = 1;
-  DECL_ARTIFICIAL (class_dtable_decl) = 1;
-  DECL_IGNORED_P (class_dtable_decl) = 1;
-  rest_of_decl_compilation (class_dtable_decl, (char*) 0, 1, 0);
-
   field_type_node = make_node (RECORD_TYPE);
   field_ptr_type_node = build_pointer_type (field_type_node);
   method_type_node = make_node (RECORD_TYPE);
index 9273ca4ec6f1f05b83c001e9e1b6fcea5e3342c5..f804a37cc4df9fbaa6652636b11f2378fae23784 100644 (file)
@@ -335,8 +335,6 @@ enum java_tree_index
 
   JTI_ACCESS_FLAGS_TYPE_NODE,
 
-  JTI_CLASS_DTABLE_DECL,
-
   JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
 
   JTI_WFL_OPERATOR,
@@ -584,9 +582,6 @@ extern tree throw_node[];
 #define access_flags_type_node \
   java_global_trees[JTI_ACCESS_FLAGS_TYPE_NODE]
 
-#define class_dtable_decl \
-  java_global_trees[JTI_CLASS_DTABLE_DECL]
-
 #define nativecode_ptr_array_type_node \
   java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]