Java x64 Linux/Windows... kann das jemand mal testen...

    ACHTUNG dies ist das ALTE Forum!!

    Das neue gibt es unter https://discourse.bohramt.de!

      Java x64 Linux/Windows... kann das jemand mal testen...

      Hi,

      ich habe gerade ein wenig mit der x64 JDK ( 1.6.0_18 ) rumgespielt. Leider habe ich wohl dabei einen Bug in der JRE (x64) gefunden :-(. Könnte jemand den SourceCode mal unter einer x64 Runtime Linux/Windoof gegentesten?

      Ach so Source ist hier gepostet
      forums.sun.com/thread.jspa?threadID=5427954

      Gruß
      Gandi

      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi

      Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „GandalfTheWhite“ ()

      Bei mir ist (wie in dem Link zu sehen!) einmal die 64Bit JVM (JDK) drauf

      PHP-Quellcode

      1. java version "1.6.0_18"
      2. Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      3. Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)


      und einmal die 32Bit JVM (nur JRE)

      PHP-Quellcode

      1. java version "1.6.0_18"
      2. Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      3. Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)


      Das Problem mit dem Code/Programm tritt nur in der 64Bit JRE auf (ähnlich dem Divisions-Fehler in der 64Bit JRE - siehe hier )

      Also sollte man evtl. doch davon absehen die 64Bit JRE (von Sun?!) Produktiv einzusetzen - mein Problem mit der Schleife bei Integer.MAX_VALUE Schleifendurchläufen mag vernachlässigbar sein, aber der Divisionsfehler ist da schon härters Kaliber...

      Gruß

      PS hier noch einmal der Code der zu dem Fehler führt

      Quellcode

      1. public class problem64bit
      2. {
      3. /**
      4. * @param args
      5. */
      6. public static void main(final String[] args)
      7. {
      8. System.out.println("java.version = \t"
      9. + System.getProperty("java.version") + " "
      10. + System.getProperty("java.vm.name") + " ("
      11. + System.getProperty("sun.arch.data.model") + "Bit)");
      12. System.out.println("OS = \t\t" + System.getProperty("os.name") + " ("
      13. + System.getProperty("os.version") + ")\n");
      14. booleanInvert(Integer.MAX_VALUE);
      15. booleanInvert(Integer.MAX_VALUE - 1);
      16. booleanInvert(Integer.MAX_VALUE - 2);
      17. }
      18. private static void booleanInvert(final int max)
      19. {
      20. System.out.println("BooleanInvert with max = " + max + " iterations");
      21. long timeStart = System.currentTimeMillis();
      22. boolean test1 = false;
      23. boolean test2 = false;
      24. boolean test3 = false;
      25. for (int i = 0; i < max; i++)
      26. {
      27. test1 = !test1;
      28. }
      29. for (int i = 0; i < max; i++)
      30. {
      31. test2 = test2 ? false : true;
      32. }
      33. for (int i = 0; i < max; i++)
      34. {
      35. test3 ^= true;
      36. }
      37. System.out.println("Time: " + (System.currentTimeMillis() - timeStart)
      38. + "ms");
      39. if (test1 != test2 || test1 != test3)
      40. {
      41. System.out.println("ERROR: Boolean invert\n\ttest1=" + test1
      42. + "\n\ttest2=" + test2 + "\n\ttest3=" + test3);
      43. } else
      44. {
      45. System.out.println("Everything as it should be!");
      46. }
      47. }
      48. }


      unter 64Bit das folgende Ergebnis:
      java.version = 1.6.0_18 Java HotSpot(TM) 64-Bit Server VM (64Bit)
      OS = Windows 7 (6.1)

      BooleanInvert with max = 2147483647 iterations
      Time: 13ms
      ERROR: Boolean invert
      test1=true
      test2=true
      test3=false
      BooleanInvert with max = 2147483646 iterations
      Time: 11ms
      Everything as it should be!
      BooleanInvert with max = 2147483645 iterations
      Time: 0ms
      Everything as it should be!

      und unter 32Bit JRE
      java.version = 1.6.0_18 Java HotSpot(TM) Client VM (32Bit)
      OS = Windows 7 (6.1)

      BooleanInvert with max = 2147483647 iterations
      Time: 7812ms
      Everything as it should be!
      BooleanInvert with max = 2147483646 iterations
      Time: 7469ms
      Everything as it should be!
      BooleanInvert with max = 2147483645 iterations
      Time: 8801ms
      Everything as it should be!


      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi
      also ich hab das mal ebend mit der snow leopard version probiert die apple mitliefert

      Quellcode

      1. bjorn-birkholzs-mac-mini:~ bjoern$ java -version
      2. java version "1.6.0_17"
      3. Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
      4. Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)


      Quellcode

      1. bjorn-birkholzs-mac-mini:~ bjoern$ java problem64bit
      2. java.version = 1.6.0_17 Java HotSpot(TM) 64-Bit Server VM (64Bit)
      3. OS = Mac OS X (10.6.2)
      4. BooleanInvert with max = 2147483647 iterations
      5. Time: 14ms
      6. Everything as it should be!
      7. BooleanInvert with max = 2147483646 iterations
      8. Time: 1ms
      9. Everything as it should be!
      10. BooleanInvert with max = 2147483645 iterations
      11. Time: 0ms
      12. Everything as it should be!


      ich kanns aber morgen nochmal auf arbeit mit ner aktuelleren version unter linux 64bit probiern

      Krieg ist Frieden. Freiheit ist Sklaverei. Unwissenheit ist Stärke.
      so jetzt mal unter linux 64bit


      habs lang nicht mehr geupdatet :D


      Quellcode

      1. bjoern@bjoern-desktop:~$ java -version
      2. java version "1.6.0_0"
      3. OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-1ubuntu3)
      4. OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)


      Quellcode

      1. java.version = 1.6.0_0 OpenJDK 64-Bit Server VM (64Bit)
      2. OS = Linux (2.6.31-14-generic)
      3. BooleanInvert with max = 2147483647 iterations
      4. Time: 122ms
      5. Everything as it should be!
      6. BooleanInvert with max = 2147483646 iterations
      7. Time: 0ms
      8. Everything as it should be!
      9. BooleanInvert with max = 2147483645 iterations
      10. Time: 0ms
      11. Everything as it should be!



      jetzt dann nachm update

      Quellcode

      1. bjoern@bjoern-desktop:~$ java -version
      2. java version "1.6.0_0"
      3. OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1)
      4. OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)


      Quellcode

      1. java.version = 1.6.0_0 OpenJDK 64-Bit Server VM (64Bit)
      2. OS = Linux (2.6.31-14-generic)
      3. BooleanInvert with max = 2147483647 iterations
      4. Time: 69ms
      5. Everything as it should be!
      6. BooleanInvert with max = 2147483646 iterations
      7. Time: 0ms
      8. Everything as it should be!
      9. BooleanInvert with max = 2147483645 iterations
      10. Time: 0ms
      11. Everything as it should be!



      dann mal nachm update mit der sun version

      Quellcode

      1. java version "1.6.0_16"
      2. Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
      3. Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)


      Quellcode

      1. java.version = 1.6.0_16 Java HotSpot(TM) 64-Bit Server VM (64Bit)
      2. OS = Linux (2.6.31-14-generic)
      3. BooleanInvert with max = 2147483647 iterations
      4. Time: 30ms
      5. Everything as it should be!
      6. BooleanInvert with max = 2147483646 iterations
      7. Time: 0ms
      8. Everything as it should be!
      9. BooleanInvert with max = 2147483645 iterations
      10. Time: 0ms
      11. Everything as it should be!


      und mit der aktuellsten

      Quellcode

      1. java version "1.6.0_18"
      2. Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      3. Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)


      Quellcode

      1. java.version = 1.6.0_18 Java HotSpot(TM) 64-Bit Server VM (64Bit)
      2. OS = Linux (2.6.31-14-generic)
      3. BooleanInvert with max = 2147483647 iterations
      4. Time: 63ms
      5. Everything as it should be!
      6. BooleanInvert with max = 2147483646 iterations
      7. Time: 0ms
      8. Everything as it should be!
      9. BooleanInvert with max = 2147483645 iterations
      10. Time: 0ms
      11. Everything as it should be!


      scheint dann wohl n problem bei dir oder unter windows zu sein

      schon sehr merkwürdig ... ich hab leider kein win in 64bit um das noch zu testen

      Krieg ist Frieden. Freiheit ist Sklaverei. Unwissenheit ist Stärke.
      Hi,

      vielen Dank für deine Mühe - vielleicht kann ich ja noch meine bessere hälfte überreden das mal unter XP64 zu testen.

      Werde einde ergebnise, wenn du nichts dagagen hast - mit in meinen Post auf java.sun.com einfügen (mit Vermerk das ich das nicht selber getestet habe *g*).

      Gruß

      Gandalf

      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi
      So,

      gegentest unter XP64

      Quellcode

      1. java.version = 1.6.0_18 Java HotSpot(TM) 64-Bit Server VM (64Bit)
      2. OS = Windows XP (5.2)
      3. BooleanInvert with max = 2147483647 iterations
      4. Time: 0ms
      5. ERROR: Boolean invert
      6. test1=true
      7. test2=true
      8. test3=false
      9. BooleanInvert with max = 2147483646 iterations
      10. Time: 15ms
      11. Everything as it should be!
      12. BooleanInvert with max = 2147483645 iterations
      13. Time: 0ms


      Hmm, ich weiss immer noch nicht ob es der Compiler oder die JVM ist... kannst du mir dein class file geben björn? Ich habe meine comp. class Datei auch mal angehangen

      Gruß

      Gandi
      Dateien
      • problem64bit.7z

        (1,5 kB, 167 mal heruntergeladen, zuletzt: )

      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi
      ich hab mir mal das JDK x86 installiert.
      Aber ich scheins nicht auf die Reihe zu kriegen, den Java-Code auszuführen :whistling:

      Ich hab dein Quellcode in einer Datei gespeichert und hab die dann in der Dos-Umgebung aufgerufen.

      Quellcode

      1. D:\Java\procs>java problem64bit
      2. Exception in thread "main" java.lang.NoClassDefFoundError: problem64bit
      3. Caused by: java.lang.ClassNotFoundException: problem64bit
      4. at java.net.URLClassLoader$1.run(Unknown Source)
      5. at java.security.AccessController.doPrivileged(Native Method)
      6. at java.net.URLClassLoader.findClass(Unknown Source)
      7. at java.lang.ClassLoader.loadClass(Unknown Source)
      8. at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      9. at java.lang.ClassLoader.loadClass(Unknown Source)
      10. Could not find the main class: problem64bit. Program will exit.


      was muss ich ändern, damit ich es unter Win7x86 ausführen kann?

      achso, hier meine installierte Version ...

      Quellcode

      1. D:\Java\procs>java -version
      2. java version "1.6.0_18"
      3. Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
      4. Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
      Hi,

      du musst nichts ändern ;) außer in den Pfad wechseln in dem die class Datei liegt und dort noch einmal java problem64Bit aufzurufen *g*.

      Aber zurück zu dem eigentlichen Problem - mir hat das ja keine Ruhe gelassen und ich habe dann mit erschrecken folgendes festgestellt. Wenn ich auf meinem Win7 Rechner die Datei nicht unter Eclipse compiliere sondern manuell über die Console... dann läuft das Programm fehlerfrei. Wenn ich aber die generierte Class Date aus Eclipse nehme bekomme ich den Fehler???

      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi
      also dein Quellcode hab ich in der Datei unter D:\Java\procs\problem64bit abgespeichert. Und wenn ich es versuche aufzurufen, bekomm ich nen Fehler

      Quellcode

      1. D:\Java\procs>java problem64bit
      2. Exception in thread "main" java.lang.NoClassDefFoundError: problem64bit
      3. Caused by: java.lang.ClassNotFoundException: problem64bit
      4. at java.net.URLClassLoader$1.run(Unknown Source)
      5. at java.security.AccessController.doPrivileged(Native Method)
      6. at java.net.URLClassLoader.findClass(Unknown Source)
      7. at java.lang.ClassLoader.loadClass(Unknown Source)
      8. at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      9. at java.lang.ClassLoader.loadClass(Unknown Source)
      10. Could not find the main class: problem64bit. Program will exit.
      11. D:\Java\procs>dir
      12. Datenträger in Laufwerk D: ist Programme
      13. Volumeseriennummer: 5CF1-8E5F
      14. Verzeichnis von D:\Java\procs
      15. 16.02.2010 09:54 <DIR> .
      16. 16.02.2010 09:54 <DIR> ..
      17. 16.02.2010 18:32 1.368 problem64bit
      18. 1 Datei(en), 1.368 Bytes
      19. 2 Verzeichnis(se), 84.132.573.184 Bytes frei
      20. D:\Java\procs>


      Keine Ahnung, was ich da anders machen sollte. Muss ich die Datei wo anders ablegen?
      hehe das wär ja auch zu einfach ;)

      1. als problem64bit.java speichern und mit
      2. javac problem64bit.java compilieren und dann mit
      3. java problem64bit ausführen

      du musst aber das jdk installiern damit du den java compiler hast ... beim jre kommt der nicht mit

      Krieg ist Frieden. Freiheit ist Sklaverei. Unwissenheit ist Stärke.

      GandalfTheWhite schrieb:

      Aber zurück zu dem eigentlichen Problem - mir hat das ja keine Ruhe gelassen und ich habe dann mit erschrecken folgendes festgestellt. Wenn ich auf meinem Win7 Rechner die Datei nicht unter Eclipse compiliere sondern manuell über die Console... dann läuft das Programm fehlerfrei. Wenn ich aber die generierte Class Date aus Eclipse nehme bekomme ich den Fehler???


      kann ja nur dran liegen das eclipse seinen eigenen java compiler verwendet

      The JDT compiler is tightly integrated with the rest of the JDT. Extracting the compiler out of the JDT and properly integrating a different compiler is not trivial. A quick approach is to disable the Java builder from the project’s Builders property page, and replace it with an Ant task that calls javac or another compiler. However, we strongly advise you to go with the installed compiler. It knows exactly how to interact with the rest of Eclipse—for instance, by assisting in the creation of tasks, quick fixes, and source decorators. It is one of the fastest, most complete Java compilers available. Finally, the JDT compiler can generate class files even when the source contains compilation errors.

      Krieg ist Frieden. Freiheit ist Sklaverei. Unwissenheit ist Stärke.
      Hi,

      ja das mit dem eigenen Compiler hatte ich auch inzwischen gelesen :-(. Werde den Bug dann mal bei eclipse melden gehen *g* - aber erst wenn ich die aktuellste eclipse Version heruntergeladen habe (obwohl.. meine ist glaube ich schon die aktuellste grübel...)

      Naja

      vielen Dank auf jeden FAll für deine Hilfe!!

      Gruß

      Gandi

      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi

      Bjoern schrieb:

      hehe das wär ja auch zu einfach ;)

      1. als problem64bit.java speichern und mit
      2. javac problem64bit.java compilieren und dann mit
      3. java problem64bit ausführen

      du musst aber das jdk installiern damit du den java compiler hast ... beim jre kommt der nicht mit
      danke für die Anleitung :thumbsup:

      hier das Ergebnis

      Quellcode

      1. D:\Java\procs>java problem64bit
      2. java.version = 1.6.0_18 Java HotSpot(TM) 64-Bit Server VM (64Bit)
      3. OS = Windows 7 (6.1)
      4. BooleanInvert with max = 2147483647 iterations
      5. Time: 187ms
      6. Everything as it should be!
      7. BooleanInvert with max = 2147483646 iterations
      8. Time: 0ms
      9. Everything as it should be!
      10. BooleanInvert with max = 2147483645 iterations
      11. Time: 0ms
      12. Everything as it should be!
      Danke Pluggi,

      aber das Problem liegt darin dass das mit Eclipse erzeugt class File unter x64 JVM nicht lauffähig ist. Eclipse hat übrigens die Verantwortung zurück gewiesen und meint das sei ein JIT Bug von Sun.. also auch noch ein Bug Report bei Sun.

      Gruß

      “Many that live deserve death. And some that die deserve life.
      Can you give it to them?

      -- J.R.R. Tolkien

      HDR , Panoramen , etc. ,... aufgenommen vom Gandi