aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2004-05-10 16:21:08 +0000
committerAndrew Haley <aph@gcc.gnu.org>2004-05-10 16:21:08 +0000
commitaf434fa7a17e1dadd41821663b754cde38ab3810 (patch)
tree3371d9b0ed0043b145595a1f169b8e3a0f013876 /gcc/java/expr.c
parent5950a3ac274c2c85e38a959e1231c75c564c9c2f (diff)
downloadgcc-af434fa7a17e1dadd41821663b754cde38ab3810.zip
gcc-af434fa7a17e1dadd41821663b754cde38ab3810.tar.gz
gcc-af434fa7a17e1dadd41821663b754cde38ab3810.tar.bz2
parse.y (create_class): Set TYPE_VFIELD.
2004-05-10 Andrew Haley <aph@redhat.com> * 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. From-SVN: r81672
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 839480b..11f6c94 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));