Bug 11470 - bytecode created with gcj -C doesn't cache lookup from synthetic class$ member
Summary: bytecode created with gcj -C doesn't cache lookup from synthetic class$ member
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 3.4.0
: P3 enhancement
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: missed-optimization
Depends on: 28067
  Show dependency treegraph
Reported: 2003-07-09 05:26 UTC by Jeff Sturm
Modified: 2007-01-09 20:45 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2006-03-05 03:50:20


Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Sturm 2003-07-09 05:26:29 UTC
Given the following source file:

class A {
    Class a() {
        return A.class;

gcj generates the following bytecode:

  0: ldc #31=<String "A">
  2: invokestatic #33=<Method A.class$ (java.lang.String)java.lang.Class>
  5: areturn

whereas other java compilers (e.g. jikes) generate similar to:

  0: getstatic #13=<Field A.class$A java.lang.Class>
  3: dup
  4: ifnonnull 18
  7: pop
  8: ldc #14=<String "[LA;">
 10: iconst_0
 11: invokestatic #19=<Method A.class$ (java.lang.String,boolean)java.lang.Class  
 14: dup
 15: putstatic #13=<Field A.class$A java.lang.Class>
 18: areturn

Note the A.class$A synthetic field which is absent from gcj output.

The lossage is particularly noticable in libjava.lang/SyncTest.java.
Comment 1 Andrew Pinski 2003-07-09 13:05:15 UTC
I can confirm this on the mainline (200307008). Yes this would be a great benifit and 
Comment 2 Andrew Pinski 2003-11-11 17:33:59 UTC
This is an enhancement.
Comment 3 Tom Tromey 2007-01-09 20:45:39 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.