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

String.value contents should be trusted

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • hotspot
    • b110

    Description

      JDK-8149813 had exposed java.lang.String to the trusted classes, and that makes both C1 and C2 trust String.coder and String.value fields, making up a good length() folding.

      However, that trust is not enough to constant fold the String.value *contents*. Which means the code like this is not folded:

          static final String TEST_STRING_LATIN1 = "Foo";

          @Benchmark
          public int string_latin1() {
              return TEST_STRING_LATIN1.charAt(0);
          }

      A simple change may force VM to trust String.value:
        http://cr.openjdk.java.net/~shade/8150180/webrev.jdk.01/
        http://cr.openjdk.java.net/~shade/8150180/webrev.hs.01/

      Notes:
       http://cr.openjdk.java.net/~shade/8150180/notes.txt

      Attachments

        Issue Links

          Activity

            People

              shade Aleksey Shipilev
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: