RFR: 8287522: StringConcatFactory: Add in prependers and mixers in batches [v7]

Claes Redestad redestad at openjdk.java.net
Thu Jun 2 20:05:23 UTC 2022


On Thu, 2 Jun 2022 18:49:13 GMT, ExE Boss <duke at openjdk.java.net> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   We now don't need big Species classes for shorter concats, so on some tests the improvements meant more Species class generation. Adjusting HelloClasslist
>
> make/jdk/src/classes/build/tools/classlist/HelloClasslist.java line 116:
> 
>> 114:         String CC     = "string" + c;
>> 115:         String CCS    = "string" + c + s;
>> 116:         String CSCC   = "string" + s + "string" + c;
> 
> I’m pretty sure that `f` and `c` will be inlined as compile‑time constants in the String concat recipes.

You would think that, but javac doesn't do anything fancy once you store to a local

javap output for lines 108 through 111:

       449: ldc           #148                // float 0.1f
       451: fstore        31
       453: fload         31
       455: invokedynamic #149,  0            // InvokeDynamic #4:makeConcatWithConstants:(F)Ljava/lang/String;
       460: astore        32
       462: fload         31
       464: aload         4
       466: invokedynamic #152,  0            // InvokeDynamic #7:makeConcatWithConstants:(FLjava/lang/String;)Ljava/lang/String;
       471: astore        33
       473: aload         4
       475: fload         31
       477: invokedynamic #155,  0            // InvokeDynamic #10:makeConcatWithConstants:(Ljava/lang/String;F)Ljava/lang/String;

-------------

PR: https://git.openjdk.java.net/jdk/pull/8855


More information about the core-libs-dev mailing list