RFR: 8288011: StringConcatFactory: Split application of stringifiers

Claes Redestad redestad at openjdk.java.net
Wed Jun 8 15:06:31 UTC 2022


On Wed, 8 Jun 2022 14:44:33 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> To take optimal advantage of the pre-existing optimization for repeated filters we could split the application of different types of stringifiers.
>> 
>> The resulting difference in order of evaluation is not observable by conventional means since all reference type share the same object stringifier, and the others are filtering primitives (floats and doubles) which have been passed by value already. 
>> 
>> This change neutral on many concatenation expression shapes, but for any complex expressions with interleaving float/double and reference parameters it brings a straightforward reduction in rebinds and underlying LFs generated. For example on the [MixedStringCombinations.java](https://gist.github.com/cl4es/08fb581dece3a73e89bfa52337bc4248) test there's a modest 2% reduction in total classes loaded with this change (from 16209 to 15872)
>
> I make heavy use of the `mh = filterArgument(baseMH, 0, arrayOfFilters);` pattern. I assumed it generated fewer LF than making individual calls. Am I wrong?

@JimLaskey no, you're generally right to assume that bunching them up reduces the number of LFs created. There's a flaw in the `makeRepeatedFilterForm` transform that means the theoretical total amount of forms can surpass the baseline if you do _both_ one-by-one and all-at-once transforms from the same root MH. That's a very big if, but it's something I've felt slight unease about since I did that optimization.

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

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


More information about the core-libs-dev mailing list