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

String.Intern() causes setting -Xint to behave differently than -Xcomp

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Microsoft Windows 10 Professional
      10.0.19044 Build 19044
      AMD Ryzen 5 5600G with Radeon Graphics 3.90 GHz
      Memory 32 GB

      openjdk version "1.8.0_332"
      IBM Semeru Runtime Open Edition (build 1.8.0_332-b09)
      Eclipse OpenJ9 VM (build openj9-0.32.0, JRE 1.8.0 Windows 10 amd64-64-Bit Compressed References 20220422_375 (JIT enabled, AOT enabled)
      OpenJ9 - 9a84ec34e
      OMR - ab24b6666
      JCL - 0b8b8af39a based on jdk8u332-b09)

      openjdk version "11.0.15" 2022-04-19
      IBM Semeru Runtime Open Edition 11.0.15.0 (build 11.0.15+10)
      Eclipse OpenJ9 VM 11.0.15.0 (build openj9-0.32.0, JRE 11 Windows 10 amd64-64-Bit Compressed References 20220422_352 (JIT enabled, AOT enabled)
      OpenJ9 - 9a84ec34e
      OMR - ab24b6666
      JCL - b7b5b42ea6 based on jdk-11.0.15+10)

      A DESCRIPTION OF THE PROBLEM :
      In the submitted test case, we used the string.intern() function and compared the returned result to the static String. The test case execution results are different when -Xint is set compared to -Xcomp. In addition, to see if similar issues exist on other JVMS, we also execute this test case on J9 JVMS, and got all the same results as Hotspot8 with setting -Xint .

       

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      hotspot/jdk8/bin/javac TestCase23.java
      hotspot/jdk8/bin/java TestCase23
      hotspot/jdk8/bin/java -Xint TestCase23
      hotspot/jdk8/bin/java -Xcomp TestCase23

      ACTUAL -
      true
      true
      false

      ---------- BEGIN SOURCE ----------
      public class TestCase23 {
          public TestCase23() {
          }
          public static void main(String[] var0) {
              boolean var3;
              String var10000 = new String("1") + new String("1");
              var10000.intern();
              var3 = var10000 == "11";
              System.out.println(var3);
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            dlong Dean Long
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: