From 85fd2947bd37c39eb2b8b237359743ae0ecbb657 Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <nathan@gcc.gnu.org>
Date: Fri, 9 Jul 2004 18:36:02 +0000
Subject: [PATCH] class.c (make_class): Do not create binfo here.

	* class.c (make_class): Do not create binfo here.
	(set_super_info): Create it here.
	* java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.

From-SVN: r84388
---
 gcc/java/ChangeLog   | 8 +++++++-
 gcc/java/class.c     | 5 +++--
 gcc/java/java-tree.h | 3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index b0bdd58aade5..8c6a0b291cc5 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+2004-07-09  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* class.c (make_class): Do not create binfo here.
+	(set_super_info): Create it here.
+	* java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.
+
 2004-07-08  Richard Henderson  <rth@redhat.com>
 
 	* expr.c (case_identity, get_primitive_array_vtable,
@@ -8207,7 +8213,7 @@
 	properly initialize `finished_label'. Don't emit gotos for empty
 	try statements.
 
-2000-03-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
+2000-03-19  Martin v. LĂświs  <loewis@informatik.hu-berlin.de>
 
 	* except.c (emit_handlers): Clear catch_clauses_last.
 
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 5e7c2b9422b6..c09e2e5b3b68 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -318,7 +318,6 @@ make_class (void)
 {
   tree type;
   type = make_node (RECORD_TYPE);
-  TYPE_BINFO (type) = make_tree_binfo (0);
   MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
 
   return type;
@@ -473,9 +472,11 @@ set_super_info (int access_flags, tree this_class,
 {
   int total_supers = interfaces_count;
   tree class_decl = TYPE_NAME (this_class);
+  
   if (super_class)
     total_supers++;
 
+  TYPE_BINFO (this_class) = make_tree_binfo (0);
   TYPE_VFIELD (this_class) = TYPE_VFIELD (object_type_node);
   BINFO_BASE_BINFOS (TYPE_BINFO (this_class)) = make_tree_vec (total_supers);
   if (super_class)
@@ -485,7 +486,7 @@ set_super_info (int access_flags, tree this_class,
       BINFO_OFFSET (super_binfo) = integer_zero_node;
       TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (this_class)), 0)
 	= super_binfo;
-      CLASS_HAS_SUPER (this_class) = 1;
+      CLASS_HAS_SUPER_FLAG (TYPE_BINFO (this_class)) = 1;
     }
 
   set_class_decl_access_flags (access_flags, class_decl);
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 1920232c38cb..1fef83260d03 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -122,7 +122,8 @@ struct JCF;
 /* True if the class whose TYPE_BINFO this is has a superclass.
    (True of all classes except Object.) */
 #define CLASS_HAS_SUPER_FLAG(BINFO) BINFO_FLAG_1 (BINFO)
-#define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
+#define CLASS_HAS_SUPER(TYPE) \
+  (TYPE_BINFO (TYPE) && CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE)))
 
 /* Return the supertype of class TYPE, or NULL_TREE is it has none. */
 #define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) \
-- 
GitLab