RFR: 8339241: Optimize LambdaForm#basicType(Class)

Shaojin Wen swen at openjdk.org
Thu Aug 29 11:55:49 UTC 2024


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

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

Commit messages:
 - from @liach's suggestion
 - optimize LambdaForm#basicType(Class)

Changes: https://git.openjdk.org/jdk/pull/20759/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20759&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8339241
  Stats: 6 lines in 1 file changed: 5 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/20759.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20759/head:pull/20759

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


More information about the core-libs-dev mailing list