RFR: 8330595: Invoke ObjectMethods::bootstrap method exactly [v2]

Claes Redestad redestad at openjdk.org
Fri Apr 19 07:09:57 UTC 2024


On Fri, 19 Apr 2024 04:45:56 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use Arrays.copyOfRange
>
> src/java.base/share/classes/java/lang/invoke/BootstrapMethodInvoker.java line 150:
> 
>> 148:                 } else if (isObjectMethodsBootstrapBSM(bsmType)) {
>> 149:                     MethodHandle[] methodHandles = new MethodHandle[argv.length - 2];
>> 150:                     System.arraycopy(argv, 2, methodHandles, 0, argv.length - 2);
> 
> Are we avoiding `Arrays.copyOfRange(argv, 2, argv.length, MethodHandle.class)` because of the JIT? If JIT compiler can recognize `MethodHandle.class` constant and inline I recommend using copyOfRange like for string concat above.

No, I actually reached for the appropriate `copyOfRange` method, but my IDE hid it from view in favor of `copyOfRange(T[], int, int)` and all the others.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18845#discussion_r1571928355


More information about the core-libs-dev mailing list