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

Improve string concatenation when using explicit calls of StringBuilder

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • tbd
    • hotspot

      Before JEP 280, javac compiles string concatenation with StringBuilder.append chain calls, and PhaseStringOpts further optimize such chain calls with limited pattern.

      After JEP280, javac compiles string concatenation to invokedynmiac that facilitate the creation of String concatenation by using StringConcatFactory, it covers more patterns.

      The use case of PhaseStringOpts become rare, it is only used when the user writes StringBuilder.append.append explicitly, we can consider either

      1) Deprecate StringBuilder, encourage to use operator + to concatenate strings.
      2) Improve PhaseStringOpts, support more patterns(e.g. no-chain calls, append(float/long/etc))
      3) Improve PhaseStringOpts, generate invokedynamic by using StringCocnatFactory to avoid manual IR matching and generation

            Unassigned Unassigned
            yyang Yi Yang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: