Community
Participate
Working Groups
Build Identifier: I20100129-1300 (win64) When I compile a small test class with eclipse and then run it with JVM 1.6.0_18 64Bit there will be an incorrect result. Running it with JVM 1.6.0_18 32Bit to get the proper result. But When the class is compiled directly with the jdk 1.6.0_18 x64 you get the same (right) result on x64/x32 JVM. Hava a look at http://forums.sun.com/thread.jspa?threadID=5427954 there i explained it too! Here is the class public class problem64Bit { /** * @param args * Arguments */ public static void main(final String[] args) { booleanInvert(Integer.MAX_VALUE); booleanInvert(Integer.MAX_VALUE - 1); } private static void booleanInvert(final int max) { boolean test1 = false; boolean test2 = false; for (int i = 0; i < max; i++) { test1 = !test1; } for (int i = 0; i < max; i++) { test2 ^= true; } if (test1 != test2) { System.out.println("ERROR: Boolean invert\n\ttest1=" + test1 + "\n\ttest2=" + test2); } else { System.out.println("Everything as it should be!"); } } } Both loops should result in the same boolean state - but when the loop iterates over INTEGER.MAX_VALUE then the compiled class (compiled with eclipse 3.6 x64 or 3.5 x64) will result in a different state. Here is the output from the JVM 1.6.0_18 x64 ERROR: Boolean invert test1=true test2=false Everything as it should be! Reproducible: Always
http://forums.sun.com/thread.jspa?threadID=5427954
I'll investigate.
If I run the class file compiled by Eclipse using: java version "1.6.0_13" Java(TM) SE Runtime Environment (build 1.6.0_13-b03) Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode) I do get the expected output. Could you please try to run your test case on the VM you have and disable the JIT ? I'll try to retrieve the VM that you are using, but so far it looks like a VM issue.
This looks like a VM issue: ...>\Test\jdk\jdk6_18\bin\java X ERROR: Boolean invert test1=true test2=false Everything as it should be! ...>\Test\jdk\jdk6_18\bin\java -Djava.compiler=none X Everything as it should be! Everything as it should be! So no JIT over the same .class file works. Differences in the javap can be explained by the way the for loop is generated. Nothing noticable on that side. Closing as NOT_ECLIPSE.
Note that 1.6.0_13 64Bit VM works fine.
Verified