From eab4ad60e30f2629eb357673b3b2dd0084bbd12e Mon Sep 17 00:00:00 2001 From: aph Date: Mon, 10 May 2004 16:21:08 +0000 Subject: 2004-05-10 Andrew Haley * parse.y (create_class): Set TYPE_VFIELD. * decl.c (java_init_decl_processing): Likewise. * expr.c (build_invokevirtual): Remove DECL_VINDEX offset adjustment. * class.c (make_method_value): Replace DECL_VINDEX with call to get_method_index(). (get_dispatch_vector): Likewise. (layout_class_method): Likewise. Replace set of DECL_VINDEX with call to set_method_index(). (set_method_index): New function. (get_method_index): New function. * java-tree.h (set_method_index): New function decl. (get_method_index): New function decl. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81672 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/java/expr.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'gcc/java/expr.c') diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 839480b5b64..11f6c94643c 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1905,18 +1905,13 @@ build_invokevirtual (tree dtable, tree method) } else { - method_index = convert (sizetype, DECL_VINDEX (method)); - - if (TARGET_VTABLE_USES_DESCRIPTORS) - /* Add one to skip bogus descriptor for class and GC descriptor. */ - method_index = size_binop (PLUS_EXPR, method_index, size_int (1)); - else - /* Add 1 to skip "class" field of dtable, and 1 to skip GC descriptor. */ - method_index = size_binop (PLUS_EXPR, method_index, size_int (2)); - + /* We fetch the DECL_VINDEX field directly here, rather than + using get_method_index(). DECL_VINDEX is the true offset + from the vtable base to a method, regrdless of any extra + words inserted at the start of the vtable. */ + method_index = DECL_VINDEX (method); method_index = size_binop (MULT_EXPR, method_index, TYPE_SIZE_UNIT (nativecode_ptr_ptr_type_node)); - if (TARGET_VTABLE_USES_DESCRIPTORS) method_index = size_binop (MULT_EXPR, method_index, size_int (TARGET_VTABLE_USES_DESCRIPTORS)); -- cgit v1.2.3