String concatenation tweaks

Rémi Forax forax at univ-mlv.fr
Fri May 22 07:59:12 UTC 2015


Nice patch.
I think you don't need to generate an inner class because you can use MethodHandles.foldArguments with a combiner that calculate the size and a target method that calls StringBuilder::new and append on each argument.

I will write a code example for that during the week end.

regards,
Rémi 



Le 21 mai 2015 14:15:09 CEST, Aleksey Shipilev <aleksey.shipilev at oracle.com> a écrit :
>On 05/15/2015 01:06 AM, Aleksey Shipilev wrote:
>> It actually does not seem that scary. javac changes seem minimal,
>> because they basically mirror [1] what is already done for current
>> String concat and lambda desugaring.
>> 
>> JDK side of changes is not too scary as well [2], and it readily
>lends
>> itself to different implementation strategies, including precomputing
>> the argument lengths. I realized too late it does not check for
>argument
>> nullity properly, but this is a proof-of-concept patch anyway.
>
>Updated patches:
> http://cr.openjdk.java.net/~shade/scratch/string-concat-indy/
>
>INNER_SIZED strategy is enabled by default for everything except
>java.base. This, and a few other touchups make the patched JDK to build
>cleanly, and pass the most java/lang and java/util jtreg tests (there
>are seem to be some failures in Indify-based tests).
>
>Thanks,
>-Aleksey



More information about the compiler-dev mailing list