Commit cedea510 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

re GNATS gcj/71 (failure to compile an interface method invocation on a sub-interface)

2000-04-05  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* jcf-write.c (generate_bytecode_insns): At invokation time,
	always relate an interface method to the type of its selector.

(Fix to the PR #71:
 http://sourceware.cygnus.com/ml/java-prs/1999-q4/msg00040.html)

From-SVN: r34330
parent 92d83515
...@@ -304,6 +304,11 @@ Thu Apr 20 18:20:58 2000 Jason Schroeder <shrode@subnature.com> ...@@ -304,6 +304,11 @@ Thu Apr 20 18:20:58 2000 Jason Schroeder <shrode@subnature.com>
(patch_binop): New temp `cn'. Call patch_string on LHS/RHS of (patch_binop): New temp `cn'. Call patch_string on LHS/RHS of
the `==' and `!=' operators. the `==' and `!=' operators.
2000-04-05 Alexandre Petit-Bianco <apbianco@cygnus.com>
* jcf-write.c (generate_bytecode_insns): At invokation time,
always relate an interface method to the type of its selector.
2000-04-05 Tom Tromey <tromey@cygnus.com> 2000-04-05 Tom Tromey <tromey@cygnus.com>
Fix for PR gcj/2: Fix for PR gcj/2:
......
...@@ -2534,8 +2534,8 @@ generate_bytecode_insns (exp, target, state) ...@@ -2534,8 +2534,8 @@ generate_bytecode_insns (exp, target, state)
NOTE_POP (1); /* Pop implicit this. */ NOTE_POP (1); /* Pop implicit this. */
if (TREE_CODE (f) == FUNCTION_DECL && DECL_CONTEXT (f) != NULL_TREE) if (TREE_CODE (f) == FUNCTION_DECL && DECL_CONTEXT (f) != NULL_TREE)
{ {
int index = find_methodref_index (&state->cpool, f); tree saved_context;
int interface = 0; int index, interface = 0;
RESERVE (5); RESERVE (5);
if (METHOD_STATIC (f)) if (METHOD_STATIC (f))
OP1 (OPCODE_invokestatic); OP1 (OPCODE_invokestatic);
...@@ -2549,6 +2549,15 @@ generate_bytecode_insns (exp, target, state) ...@@ -2549,6 +2549,15 @@ generate_bytecode_insns (exp, target, state)
} }
else else
OP1 (OPCODE_invokevirtual); OP1 (OPCODE_invokevirtual);
if (interface)
{
saved_context = DECL_CONTEXT (f);
DECL_CONTEXT (f) =
TREE_TYPE (TREE_TYPE (TREE_VALUE (TREE_OPERAND (exp, 1))));
}
index = find_methodref_index (&state->cpool, f);
if (interface)
DECL_CONTEXT (f) = saved_context;
OP2 (index); OP2 (index);
f = TREE_TYPE (TREE_TYPE (f)); f = TREE_TYPE (TREE_TYPE (f));
if (TREE_CODE (f) != VOID_TYPE) if (TREE_CODE (f) != VOID_TYPE)
......
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