public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Nic Ferrier <nferrier@tapsellferrier.co.uk>
Cc: java@gcc.gnu.org
Subject: Re: gcj producing bad code
Date: Sat, 06 Apr 2002 17:39:00 -0000	[thread overview]
Message-ID: <3CAF8956.6040309@bothner.com> (raw)
In-Reply-To: <87vgb4bdtk.fsf@pooh-sticks-bridge.tapsellferrier.co.uk>

Nic Ferrier wrote:
>>>GCJ is not compiling method calls quite right... it seems that all 
>>>super invocations are done through invokespecial. invokespecial 
>>>cannot be used when the target needs to be called through virtual 
>>>dispatch however. 
>>
>> 
>>I'm not quite sure you said that right.  Any call to super.method() is 
>>required to compile to invokespecial (unless method is static, in which 
>>case invokestatic is appropriate).  By the way, in the case of 
>>EnclosingClass.super.method(), it may require the assistance of an 
>>accessor method to use invokespecial while still obeying access rules.  
>>Consider this example, from the point of view of class C: 
> 
> 
> The case I'm referring to is a metjod invocation on a property of the
> super class, thus:
> 
>   class A
>    X x;
>    public X getX() { return x; }
> 
> 
>   class B extends A
>    public Y getY() { return super.getX().getY(); }
> 
> 
> The method B::getY() must compile to call getY() through a virtual
> dispatch even though X is in super.

The getY() isn't a super invocation - it's the same as
   (super.getX()).getY()
or even:
   X t = super.getX();
   return t.getY();

If we're emitting invokespecial to call getY, then I don't think
the flaw in actually in the bytecode-generation, but more likely
the front-end (resolve_qualified_expression_name in parse.y)
incorrectly setting CALL_WITH_SUPER.

I suspect the problem is that the variable 'from_super' isn't
being reset in resolve_qualified_expression_name.  Alex?
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/

  reply	other threads:[~2002-04-06 23:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-05 15:29 Nic Ferrier
2002-04-05 18:51 ` Bryce McKinlay
2002-04-06  7:55   ` Nic Ferrier
2002-04-06  8:22     ` Eric Blake
2002-04-06 15:47       ` Nic Ferrier
2002-04-06 17:39         ` Per Bothner [this message]
2002-04-06 19:34           ` Bryce McKinlay
2002-04-07 14:31           ` Java patch: " Bryce McKinlay
2002-04-08  2:04             ` Alexandre Petit-Bianco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CAF8956.6040309@bothner.com \
    --to=per@bothner.com \
    --cc=java@gcc.gnu.org \
    --cc=nferrier@tapsellferrier.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).