RFR: 8142334: Improve lazy initialization of java.lang.invoke

Claes Redestad claes.redestad at oracle.com
Mon Nov 9 17:51:25 UTC 2015


across java.lang.invoke there are a number of inner Lazy classes whose purpose is to defer initialization of various internally used NamedFunctions and MethodHandles until first usage. The issue is that once *any* function or handle in these classes are referenced they're all initialized, which somewhat defeats the purpose.

By moving to per-MethodHandle and per-NamedFunction lazy initialization, similar to existing code in java.lang.invoke.Invokers, we improve the laziness generally: for a jigsaw Hello World the number of LambdaForms created drops from 74 to 46, reducing heap occupancy for a minimal application and measurably improving startup time.

Webrev: http://cr.openjdk.java.net/~redestad/8142334/webrev.01
Bug: https://bugs.openjdk.java.net/browse/JDK-8142334


More information about the core-libs-dev mailing list