public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][JAVA] Build a correct tree for rewritten method invocations
@ 2011-08-02 19:56 Peter Collingbourne
  2011-08-03  8:41 ` Andrew Haley
  2011-08-03 20:03 ` Tom Tromey
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Collingbourne @ 2011-08-02 19:56 UTC (permalink / raw)
  To: gcc-patches, java-patches; +Cc: Peter Collingbourne

The Java frontend currently produces an incorrectly typed tree if
a method call is rewritten.  Specifically, the callee operand is a
NOP_EXPR casting the address of the target method to the original
method type.  This patch causes the NOP_EXPR cast to use the type of
the target method instead.

The bug is exposed by dragonegg which requires the callee type to be
correct.

libjava tested, x86_64-unknown-linux-gnu.

2011-08-02  Peter Collingbourne  <peter@pcc.me.uk>

        * expr.c (expand_invoke) Use the type of the method rewrite target.
---
 gcc/java/expr.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 4686f30..ec2d9b6 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -2544,12 +2544,12 @@ expand_invoke (int opcode, int method_ref_index, int nargs ATTRIBUTE_UNUSED)
       return;
     }
 
-  method_type = TREE_TYPE (method);
-  arg_list = pop_arguments (method_type);
+  arg_list = pop_arguments (TREE_TYPE (method));
   flush_quick_stack ();
 
   maybe_rewrite_invocation (&method, &arg_list, &method_signature,
 			    &special);
+  method_type = TREE_TYPE (method);
 
   func = NULL_TREE;
   if (opcode == OPCODE_invokestatic)
-- 
1.7.5.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][JAVA] Build a correct tree for rewritten method invocations
  2011-08-02 19:56 [PATCH][JAVA] Build a correct tree for rewritten method invocations Peter Collingbourne
@ 2011-08-03  8:41 ` Andrew Haley
  2011-08-03 20:03 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2011-08-03  8:41 UTC (permalink / raw)
  To: java-patches

On 08/02/2011 08:56 PM, Peter Collingbourne wrote:
> The Java frontend currently produces an incorrectly typed tree if
> a method call is rewritten.  Specifically, the callee operand is a
> NOP_EXPR casting the address of the target method to the original
> method type.  This patch causes the NOP_EXPR cast to use the type of
> the target method instead.
> 
> The bug is exposed by dragonegg which requires the callee type to be
> correct.
> 
> libjava tested, x86_64-unknown-linux-gnu.
> 
> 2011-08-02  Peter Collingbourne  <peter@pcc.me.uk>
> 
>         * expr.c (expand_invoke) Use the type of the method rewrite target.

Yes, I see.  This looks OK.

Two questions:

Did you run the libjava test suite?
Do you have commit access?

Andrew.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][JAVA] Build a correct tree for rewritten method invocations
  2011-08-02 19:56 [PATCH][JAVA] Build a correct tree for rewritten method invocations Peter Collingbourne
  2011-08-03  8:41 ` Andrew Haley
@ 2011-08-03 20:03 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2011-08-03 20:03 UTC (permalink / raw)
  To: Peter Collingbourne; +Cc: gcc-patches, java-patches

>>>>> "Peter" == Peter Collingbourne <peter@pcc.me.uk> writes:

Peter> 2011-08-02  Peter Collingbourne  <peter@pcc.me.uk>
Peter>         * expr.c (expand_invoke) Use the type of the method rewrite target.

Ok.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-03 20:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-02 19:56 [PATCH][JAVA] Build a correct tree for rewritten method invocations Peter Collingbourne
2011-08-03  8:41 ` Andrew Haley
2011-08-03 20:03 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).