Commit b32d6f93 by Tom Tromey Committed by Tom Tromey

jcf-write.c (generate_bytecode_insns): Use qualifying type for non-static method calls.

gcc/java
	* jcf-write.c (generate_bytecode_insns): Use qualifying type for
	non-static method calls.
libjava
	* testsuite/libjava.jacks/jacks.xfail: Removed
	13.1-runtime-method-5.

From-SVN: r112102
parent 34a9f549
2006-03-15 Tom Tromey <tromey@redhat.com>
* jcf-write.c (generate_bytecode_insns): Use qualifying type for
non-static method calls.
2006-03-15 David Daney <ddaney@avtrex.com> 2006-03-15 David Daney <ddaney@avtrex.com>
* java-tree.h : Moved comment for TYPE_DOT_CLASS adjacent to its * java-tree.h : Moved comment for TYPE_DOT_CLASS adjacent to its
......
/* Write out a Java(TM) class file. /* Write out a Java(TM) class file.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -2610,6 +2610,19 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) ...@@ -2610,6 +2610,19 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
tree context = DECL_CONTEXT (f); tree context = DECL_CONTEXT (f);
int index, interface = 0; int index, interface = 0;
RESERVE (5); RESERVE (5);
/* If the method is not static, use the qualifying type.
However, don't use the qualifying type if the method
was declared in Object. */
if (! METHOD_STATIC (f)
&& ! DECL_CONSTRUCTOR_P (f)
&& ! METHOD_PRIVATE (f)
&& DECL_CONTEXT (f) != object_type_node)
{
tree arg1 = TREE_VALUE (TREE_OPERAND (exp, 1));
context = TREE_TYPE (TREE_TYPE (arg1));
}
if (METHOD_STATIC (f)) if (METHOD_STATIC (f))
OP1 (OPCODE_invokestatic); OP1 (OPCODE_invokestatic);
else if (DECL_CONSTRUCTOR_P (f) || CALL_USING_SUPER (exp) else if (DECL_CONSTRUCTOR_P (f) || CALL_USING_SUPER (exp)
...@@ -2618,18 +2631,15 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) ...@@ -2618,18 +2631,15 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
else else
{ {
if (CLASS_INTERFACE (TYPE_NAME (context))) if (CLASS_INTERFACE (TYPE_NAME (context)))
{
tree arg1 = TREE_VALUE (TREE_OPERAND (exp, 1));
context = TREE_TYPE (TREE_TYPE (arg1));
if (CLASS_INTERFACE (TYPE_NAME (context)))
interface = 1; interface = 1;
}
if (interface) if (interface)
OP1 (OPCODE_invokeinterface); OP1 (OPCODE_invokeinterface);
else else
OP1 (OPCODE_invokevirtual); OP1 (OPCODE_invokevirtual);
} }
index = find_methodref_with_class_index (&state->cpool, f, context);
index = find_methodref_with_class_index (&state->cpool, f,
context);
OP2 (index); OP2 (index);
if (interface) if (interface)
{ {
......
2006-03-15 Tom Tromey <tromey@redhat.com> 2006-03-15 Tom Tromey <tromey@redhat.com>
* testsuite/libjava.jacks/jacks.xfail: Removed
13.1-runtime-method-5.
2006-03-15 Tom Tromey <tromey@redhat.com>
PR java/26638: PR java/26638:
* link.cc (get_interfaces): Skip <clinit>. * link.cc (get_interfaces): Skip <clinit>.
(append_partial_itable): Likewise. (append_partial_itable): Likewise.
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
13.1-runtime-constant-1 13.1-runtime-constant-1
13.1-runtime-constant-3 13.1-runtime-constant-3
13.1-runtime-field-1 13.1-runtime-field-1
13.1-runtime-method-5
13.1-runtime-method-6 13.1-runtime-method-6
13.4.8-constant-runtime-1 13.4.8-constant-runtime-1
13.4.8-constant-runtime-2 13.4.8-constant-runtime-2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment