RFR: 8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases [v2]

Claes Redestad redestad at openjdk.org
Fri Apr 12 15:21:54 UTC 2024


On Fri, 12 Apr 2024 14:26:04 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   @liach feedback
>
> src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1406:
> 
>> 1404:                         @Override
>> 1405:                         public void accept(ClassBuilder clb) {
>> 1406:                             clb.withFlags(AccessFlag.PUBLIC, AccessFlag.FINAL, AccessFlag.SUPER, AccessFlag.SYNTHETIC)
> 
> Why is this hidden class public?

Removed `PUBLIC`.

> src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java line 1458:
> 
>> 1456: 
>> 1457:         // Load the argument of type cl at slot onto stack, return the number of argument stack slots consumed.
>> 1458:         private static int load(CodeBuilder cb, Class<?> cl, int slot) {
> 
> You can replace all calls to `load(cb, cl, slot)` with `cb.loadInstruction(TypeKind.from(cl), slot)`, and the retrn slot count can be accessed by `TypeKind::slotSize`

Thanks, I've tried to simplify.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18690#discussion_r1562702306
PR Review Comment: https://git.openjdk.org/jdk/pull/18690#discussion_r1562701048


More information about the core-libs-dev mailing list