RFR: 8339241: Optimize LambdaForm#basicType(Class)

Claes Redestad redestad at openjdk.org
Thu Aug 29 13:28:20 UTC 2024


On Thu, 29 Aug 2024 01:30:55 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> A small optimization to simplify the implementation logic of LambdaForm$BasicType#basicType method can reduce the call stack and reduce the overall bytecode size.
> 
> Below is the compiler log
> 
> * baseline
> 
>  @ 1   java.lang.invoke.LambdaForm$BasicType::basicType (8 bytes)   inline
>    @ 1   sun.invoke.util.Wrapper::basicTypeChar (18 bytes)   inline
>      @ 1   java.lang.Class::isPrimitive (0 bytes)   intrinsic
>      @ 11   sun.invoke.util.Wrapper::forPrimitiveType (122 bytes)   failed to inline: callee is too large
>      @ 14   sun.invoke.util.Wrapper::basicTypeChar (5 bytes)   inline
> 
> 
> * current
> 
> java.lang.invoke.LambdaForm$BasicType::basicType (59 bytes)   failed to inline: callee is too large

If this is a startup play can you provide numbers and analysis on some relevant startup benchmark? C2 inlining behavior might be a poor guide to optimizing libraries which are mostly bootstrap sensitive.

`Class::isPrimitive` is a native method, which IIRC can be relatively slow in the interpreter.

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

PR Comment: https://git.openjdk.org/jdk/pull/20759#issuecomment-2317655533


More information about the core-libs-dev mailing list