From: Eric Blake <ebb9@email.byu.edu>
To: Nic Ferrier <nferrier@tapsellferrier.co.uk>
Cc: Bryce McKinlay <bryce@waitaki.otago.ac.nz>, java@gcc.gnu.org
Subject: Re: gcj producing bad code
Date: Sat, 06 Apr 2002 08:22:00 -0000 [thread overview]
Message-ID: <3CAF1A5E.9E1841B3@email.byu.edu> (raw)
In-Reply-To: <87y9g0c30y.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:
class A { void m() {} }
class B extends A {}
class C extends B { void foo() { super.m(); } }
class D extends C { void m() {} }
Here, the compiler must output the bytecode in class C for invokespecial
B.m(), and the VM is required to be able to resolve that at runtime to
be A.m(). If the compiler were to use invokevirtual in class C, you
would mistakenly invoke D.m(), not A.m(). And if the compiler were to
output invokespecial A.m() instead of B.m(), then recompiling B with an
added method m would fail binary compatibility rules.
--
This signature intentionally left boring.
Eric Blake ebb9@email.byu.edu
BYU student, free software programmer
next prev parent reply other threads:[~2002-04-06 15:55 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 [this message]
2002-04-06 15:47 ` Nic Ferrier
2002-04-06 17:39 ` Per Bothner
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=3CAF1A5E.9E1841B3@email.byu.edu \
--to=ebb9@email.byu.edu \
--cc=bryce@waitaki.otago.ac.nz \
--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).