On Tue, 10 Sep 2024 10:28:56 GMT, Claes Redestad <redes...@openjdk.org> wrote:
>> Shaojin Wen has updated the pull request incrementally with one additional >> commit since the last revision: >> >> more 2 arguments simple concat > > src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line > 529: > >> 527: mh = simpleConcat3(paramType0); >> 528: mh = MethodHandles.insertArguments(mh, 0, prefix); >> 529: return MethodHandles.filterArguments(mh, 1, >> objectStringifier()); > > While this is a fun trick it seems like there's a non-trivial cost here? We'd > go down different paths and generate different classes for `"foo" + bar + > baz` and `"foo" + bar + " .. " + baz` with this. Special casing when we get > the added shapes for more or less free (plain `simpleConcat()`) is a > different matter but here you need to construct a new couple of shapes with > `insert-` and `filterArguments`. > > (Check on paramType1 could be `!paramType1.isPrimitive()`) I'm also not sure how much cost the simpleConcat handling of the 2 parameters would bring, I've removed that, and this is more appropriately implemented by the InlineHiddenClassStrategy. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20726#discussion_r1751961145