Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8306725

Hotspot8 uses the wrong optimization when setting -Xcomp

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

      openjdk version "1.8.0_362"
      OpenJDK Runtime Environment (Temurin)(build 1.8.0_362-b09)
      OpenJDK 64-Bit Server VM (Temurin)(build 25.362-b09, mixed mode)

      openjdk version "11.0.18" 2023-01-17
      OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
      OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)


      A DESCRIPTION OF THE PROBLEM :
      This test case mainly contains a lot of loops, causing JIT optimizations to be triggered during execution. And we computed the check sum of the returned values after the cmp instruction and found that the final result of the check sum is uncertain. So we tried -Xint and -Xcomp and found that the results were different, most likely due to optimization issues.
      You can download the test cases at the link below:
      https://drive.google.com/file/d/1sXIhE5GJKFy4io2lZKs_NEJNB_gdpEkI/view?usp=sharing


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      ./run.sh javapath

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ -Xint compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ -Xcomp compiler.runtime.Test6826736
      CHECKSUM:25502500
      ACTUAL -
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502548
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502534
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502508
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502529
      jdk_linux_8_hotspot/bin/java -cp ./ compiler.runtime.Test6826736
      CHECKSUM:25502575
      jdk_linux_8_hotspot/bin/java -cp ./ -Xint compiler.runtime.Test6826736
      CHECKSUM:25502500
      jdk_linux_8_hotspot/bin/java -cp ./ -Xcomp compiler.runtime.Test6826736
      CHECKSUM:25502547

      FREQUENCY : always


            thartmann Tobias Hartmann
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: