RFR: 8142487: Cleanup sun.invoke.util.Wrapper zeroes to be both reliable and lazy

John Rose john.r.rose at oracle.com
Thu Nov 12 17:45:25 UTC 2015

On Nov 12, 2015, at 6:13 AM, Claes Redestad <claes.redestad at oracle.com> wrote:
> On 2015-11-12 01:10, John Rose wrote:
>> For better maintainability, I think the zero and identity forms should be created together, not in separate twin code blocks.
>> I think this is a safer, saner way to inject laziness here:
>> - private static void createIdentityForms() {
>> + // Create LF_zero, LF_identity, etc., for the given type.
>> + private static void createIdentityForms(BasicType type) {
>> It means that groups of LFs get lazily created; if that is tolerable for the present purpose, it's easier to reason about.
>> — John
> How about this:
> http://cr.openjdk.java.net/~redestad/8142487/webrev.02 <http://cr.openjdk.java.net/~redestad/8142487/webrev.02>

Yes, that's fine.

> I'm seeing no increase in number of LambdaForms or NamedFunctions created by merging it all back into one method, while getting rid of MN_* arrays.

Good deal.

> I fixed the obvious mistake in sun.invoke.util.WrapperTest w.r.t byte/char, and since these tests fail against JDK-8141678 I wouldn't mind keeping it around.

OK, if it found a bug it has earned its place.

— John

More information about the core-libs-dev mailing list