RFR: 8163370: Reduce number of classes loaded by common usage of java.lang.invoke

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Aug 9 12:31:05 UTC 2016


Hi Claes!

src/java.base/share/classes/sun/invoke/util/ValueConversions.java:

   43         /** EnumMap uses preconstructed array internally, which is 
constant during it's lifetime. */
   44         @Stable
   45         private final MethodHandle[] map = new 
MethodHandle[Wrapper.COUNT];

The comment at line 43 seems outdated.

With kind regards,
Ivan

On 09.08.2016 15:04, Claes Redestad wrote:
> Hi,
>
> please review this set of small changes to reduce the number of 
> classes defined and pulled in when initializing java.lang.invoke
>
> Webrev: http://cr.openjdk.java.net/~redestad/8163370/webrev/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8163370
>
> - Using an EnumMap<Wrapper, MethodHandle> in 
> sun.misc.invoke.ValueConversions pulls in 5 EnumMap-related classes, and
> - Using result.addAll(Arrays.asList(buf).subList(0, bufCount)) rather 
> than a simple for-loop pulls in 5 classes
> - A few private enum classes can profitably be replaced with 
> alternative logic, removing 4 classes
>
> Thanks!
>
> /Claes
>



More information about the core-libs-dev mailing list