RFR: 8295302: Do not use ArrayList when LambdaForm has a single ClassData [v2]

Mandy Chung mchung at openjdk.org
Fri Oct 14 16:59:59 UTC 2022


On Fri, 14 Oct 2022 04:37:22 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Please review this small optimization. As shown in the JBS issue, most of the generated LambdaForm classes have a single ClassData, so we can get a small footprint/speed improvement.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   @iwanowww comments

src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java line 291:

> 289:         final List<ClassData> cd = classData;
> 290:         return switch(cd.size()) {
> 291:             case 0 -> null;

`List.of()` always returns the same singleton instance and does not cause any object allocation.  I prefer to keep the `classDataValues()` to return `List<Object>`

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

PR: https://git.openjdk.org/jdk/pull/10706


More information about the core-libs-dev mailing list