Bug 21662 - [4.0/4.1/4.2/4.3 Regression] Fields in interfaces not optimized when read from *.class, but optimized when read from *.java
Summary: [4.0/4.1/4.2/4.3 Regression] Fields in interfaces not optimized when read fro...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P5 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on: 28067
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-19 11:48 UTC by Jakub Jelinek
Modified: 2007-01-09 20:47 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3
Known to fail: 3.3.3 3.4.0 4.0.0 4.1.0
Last reconfirmed: 2006-01-29 00:29:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2005-05-19 11:48:10 UTC
#!/bin/sh
rm -rf test
mkdir test
cat > test/Configuration.java <<EOF
package test;
public interface Configuration
{
  boolean INIT_LOAD_LIBRARY = false;
}
EOF
cat > test/Test.java <<EOF
package test;
import test.Configuration;
public class Test
{
  static
  {
    if (Configuration.INIT_LOAD_LIBRARY)
      {
        System.loadLibrary("gtkpeer");
      }
  }
}
EOF
gcj -C --classpath '' test/Test.java
mv test/Test.class{,.fromsrc}
gcj -C --classpath '' test/Configuration.java
gcj -C --classpath '' test/Test.java
mv test/Test.class{,.fromclass}
jcf-dump -c test/Test.class.fromsrc > test/fromsrc
jcf-dump -c test/Test.class.fromclass > test/fromclass
diff -u test/from{src,class}

In libjava build unless --enable-libgcj-multifile is used this has the bad
side effect that libgcj-4*.jar depends on the exact timing when doing make -jN
build (e.g. GdkTextLayout.java and Configuration.java are compiled about at the
same time, so if Configuration.java is compiled quickly enough
GdkTextLayout.class will not be as optimized as it could be, while
if Configuration.java compilation is tiny bit slower, GdkTextLayout.java's
compilation will read Configuration.java and optimize the bool test out.
Comment 1 Andrew Pinski 2005-05-21 14:01:59 UTC
Confirmed, in 3.2.3, we produced the same class file.
Comment 2 Andrew Pinski 2005-05-21 14:03:12 UTC
(In reply to comment #1)
> Confirmed, in 3.2.3, we produced the same class file.
Oh and optimized it correctly.
Comment 3 Mark Mitchell 2005-08-22 03:34:31 UTC
Java bugs are not release-critical; removing target milestone.
Comment 4 Mark Mitchell 2006-05-25 02:36:07 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 5 Tom Tromey 2007-01-09 20:47:38 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.
Thanks.