From 13107ec07cbc19decd1e47dde519b5ba96465d97 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 28 Jul 2000 06:57:31 +0000 Subject: [PATCH] class.c (make_class_data): Create vtable for abstract classes. 2000-07-27 Tom Tromey Anthony Green Alexandre Petit-Bianco * class.c (make_class_data): Create vtable for abstract classes. (get_dispatch_table): Changed to cope with abstract classes. Co-Authored-By: Alexandre Petit-Bianco Co-Authored-By: Anthony Green From-SVN: r35313 --- gcc/java/ChangeLog | 7 +++++++ gcc/java/class.c | 21 +++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 31475c8ed2ee..9c7c1e4a2f7c 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +2000-07-27 Tom Tromey + Anthony Green + Alexandre Petit-Bianco + + * class.c (make_class_data): Create vtable for abstract classes. + (get_dispatch_table): Changed to cope with abstract classes. + 2000-07-27 Tom Tromey * parse.y (patch_method_invocation): Don't reverse the argument diff --git a/gcc/java/class.c b/gcc/java/class.c index f99d0e5bd04b..a291c5723a9b 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1218,6 +1218,7 @@ static tree get_dispatch_table (type, this_class_addr) tree type, this_class_addr; { + int abstract_p = CLASS_ABSTRACT (TYPE_NAME (type)); tree vtable = get_dispatch_vector (type); int i; tree list = NULL_TREE; @@ -1226,12 +1227,20 @@ get_dispatch_table (type, this_class_addr) { tree method = TREE_VEC_ELT (vtable, i); if (METHOD_ABSTRACT (method)) - warning_with_decl (method, "abstract method in non-abstract class"); - if (DECL_RTL (method) == 0) - make_decl_rtl (method, NULL, 1); + { + if (! abstract_p) + warning_with_decl (method, + "abstract method in non-abstract class"); + method = null_pointer_node; + } + else + { + if (DECL_RTL (method) == 0) + make_decl_rtl (method, NULL, 1); + method = build1 (ADDR_EXPR, nativecode_ptr_type_node, method); + } list = tree_cons (NULL_TREE /*DECL_VINDEX (method) + 2*/, - build1 (ADDR_EXPR, nativecode_ptr_type_node, method), - list); + method, list); } /* Dummy entry for compatibility with G++ -fvtable-thunks. When using the Boehm GC we sometimes stash a GC type descriptor @@ -1345,7 +1354,7 @@ make_class_data (type) rest_of_decl_compilation (methods_decl, (char*) 0, 1, 0); if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (type_decl))) - && ! CLASS_ABSTRACT (type_decl) && ! CLASS_INTERFACE (type_decl)) + && ! CLASS_INTERFACE (type_decl)) { tree dtable = get_dispatch_table (type, this_class_addr); dtable_decl = build_dtable_decl (type);