RFR: 8339241: Optimize LambdaForm#basicType(Class)
Chen Liang
liach at openjdk.org
Thu Aug 29 11:55:49 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
What about this:
if (!type.isPrimitive()) return L_TYPE;
if (type == long.class) return J_TYPE;
if (type == float.class) return F_TYPE;
if (type == double.class) return D_TYPE;
if (type == void.class) return V_TYPE;
return I_TYPE; // int, short, byte, char, boolean
Is this even smaller?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20759#issuecomment-2316646898
More information about the core-libs-dev
mailing list