Indify String Concat progress

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Aug 28 22:30:09 UTC 2015


Hi,

I have finally found time to further hack on this:
  https://bugs.openjdk.java.net/browse/JDK-8085796

Also, redone experiments and rewritten the experimental notes:
  http://cr.openjdk.java.net/~shade/8085796/notes.txt

Notable improvements:

  * The implementation was moved to Sandbox. Build instructions are
    inline in JEP itself. It builds almost like a usual OpenJDK now. If
    you face trouble building it, or experience failing tests, please
    contact me privately.

  * Renamed the strategies to more sensible names, see
    StringConcatFactory.Strategy enum.

  * javac now accepts -XstringConcat:{inline,indy,indyStatic}:
     - "inline" is the current desugaring scheme;
     - "indy" is blindly calling the BSM with all arguments collected
         by javac;
     - "indyStatic" is collecting special arguments (e.g. constants)
         and passing them once to BSM. This is something that Remi and
         Peter suggested earlier as an interesting option to try.

  * Added a large stress test that kinked out multiple bugs from the
    strategy implementations. There were no bugs in the javac
    implementation, which is good news itself.

  * The indy callsite for "indyStatic" indeed looks better in bytecode
    now (see experimental notes, "Footprint considerations / Bytecode
    shapes"), especially when there are lots of String constants.
    However, I found that it does not improve the performance much --
    it would seem JIT compilers are already good at optimizing these
    cases.

    So, my hunch is that complicating the implementation and bytecode
    protocol might not worth it? Maybe there are cases which I am
    overlooking? You are very welcome to build the current
    implementation and play with it.

  * Tried to mix this prototype with Compact Strings prototype:
        http://openjdk.java.net/jeps/254

    Most strategies improve a lot from that change, because the
    footprint is even better. Some strategies, like Peter's
    MH_INLINE_SIZED_EXACT assume a particular String shape, and we would
    need to tune it after the Compact Strings land. But the good news,
    it would not require any further changes in javac (d'uh!).


Comments, suggestions, etc. are welcome. I am contemplating to "submit"
the JEP early next week, pending no blockers.

Cheers, and have a good weekend.

Thanks,
-Aleksey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20150829/bf0aee8a/signature.asc>


More information about the compiler-dev mailing list