RFR: 8336491: Unnecessary boxing conversions in void-returning lambdas [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Jul 18 09:30:32 UTC 2024


On Wed, 17 Jul 2024 23:44:50 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> Please consider this possible fix for [JDK-8336491](https://bugs.openjdk.org/browse/JDK-8336491), which avoids generating an unnecessary boxing conversion for the result of void-returning expression lambdas.
>
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Push fix into boxIfNeeded, other callers pass a VOID type

Would we obtain the same result by setting a different expected return type in `Lower::visitLambda` ? E.g. right now we set the expected return type like this:


currentRestype = types.erasure(tree.getDescriptorType(types)).getReturnType();


Perhaps, if that type is `void` we should just use `Type.noType` ?

I'm a bit worried about the proposed fix having a potentially bigger impact than just the problem it's trying to address. What do you think?

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

PR Comment: https://git.openjdk.org/jdk/pull/20222#issuecomment-2236047511


More information about the compiler-dev mailing list