[code-reflection] RFR: Concat Transform Optimizations [v4]

Paul Sandoz psandoz at openjdk.org
Thu Jun 27 18:13:33 UTC 2024


On Wed, 26 Jun 2024 17:39:48 GMT, Ian Graves <igraves at openjdk.org> wrote:

>> Updates to the transformation on Concats to StringBuilder that reduce redundant "new" StringBuilders while respecting correctness.
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Integrating Paul's tree-based approach with argument handling

src/java.base/share/classes/java/lang/reflect/code/analysis/StringConcatTransformer.java line 43:

> 41: public class StringConcatTransformer implements OpTransformer {
> 42: 
> 43:     private static final JavaType J_L_OBJECT = JavaType.type(Object.class);

Use `JavaType.J_L_OBJECT`

src/java.base/share/classes/java/lang/reflect/code/analysis/StringConcatTransformer.java line 100:

> 98:     }
> 99: 
> 100:     private static Op append(Block.Builder block, Value builder, Value arg, TypeElement type) {

You could simplify to compute the type that is the second parameter type if the `append` method, and then you just need one call to `MethodRef.method` and `CoreOp.invoke`

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

PR Review Comment: https://git.openjdk.org/babylon/pull/149#discussion_r1657465519
PR Review Comment: https://git.openjdk.org/babylon/pull/149#discussion_r1657469599


More information about the babylon-dev mailing list