This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Java: fix for PR #71


This patch fixes the PR #71:

  http://sourceware.cygnus.com/ml/java-prs/1999-q4/msg00040.html

I'm checking it in.

./A

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

	* jcf-write.c (generate_bytecode_insns): At invokation time,
	alway relate an interface method to the type of its selector.
	
Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/jcf-write.c,v
retrieving revision 1.53
diff -u -p -r1.53 jcf-write.c
--- jcf-write.c	2000/03/28 08:33:45	1.53
+++ jcf-write.c	2000/04/06 03:36:25
@@ -2534,8 +2534,8 @@ generate_bytecode_insns (exp, target, st
 	  NOTE_POP (1);  /* Pop implicit this. */
 	if (TREE_CODE (f) == FUNCTION_DECL && DECL_CONTEXT (f) != NULL_TREE)
 	  {
-	    int index = find_methodref_index (&state->cpool, f);
-	    int interface = 0;
+	    tree saved_context;
+	    int index, interface = 0;
 	    RESERVE (5);
 	    if (METHOD_STATIC (f))
 	      OP1 (OPCODE_invokestatic);
@@ -2549,6 +2549,15 @@ generate_bytecode_insns (exp, target, st
 	      }
 	    else
 	      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);
 	    f = TREE_TYPE (TREE_TYPE (f));
 	    if (TREE_CODE (f) != VOID_TYPE)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]