RFR: 8260605: Various java.lang.invoke cleanups [v5]
Mandy Chung
mchung at openjdk.java.net
Mon Mar 15 18:30:20 UTC 2021
On Wed, 10 Mar 2021 16:34:39 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> - Remove unused code
>> - Inline and simplify the bootstrap method invocation code (remove pointless reboxing checks etc)
>> - Apply pattern matching to make some code more readable
>
> Claes Redestad has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>
> - Revert pattern matching changes covered by #2913
> - Merge branch 'master' into invoke_cleanup
> - Missing .values
> - More cleanup, reduce allocations in InvokerBytecodeGenerator
> - Missing outstanding changes
> - Avoid unnecessary reboxing checks, inline and simplify class/mt invokes
> - j.l.invoke cleanups
src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java line 342:
> 340: setClassWriter(cw);
> 341: cw.visit(Opcodes.V1_8, NOT_ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER,
> 342: CLASS_PREFIX.concat(className), null, INVOKER_SUPER_NAME, null);
I prefer to use the existing common pattern using `+` as I believe this gain is in the noise.
src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 151:
> 149: maybeReBoxElements(argv);
> 150: if (argv.length > 6) {
> 151: result = invokeWithManyArguments(bootstrapMethod, caller, name, type, argv);
it'd be cleaner to move this to the default case in line 162 and 174 instead of having this special if-block.
src/java.base/share/classes/java/lang/invoke/MethodType.java line 418:
> 416:
> 417: /**
> 418: * Finds or creates a method type with additional parameter types.
`nptype` is never void but what about the check if `nptype` is not null?
-------------
PR: https://git.openjdk.java.net/jdk/pull/2300
More information about the core-libs-dev
mailing list