RFR: 8343377: Performance regression in reflective invocation of native methods [v2]

Chen Liang liach at openjdk.org
Mon Dec 2 19:45:17 UTC 2024


On Mon, 2 Dec 2024 19:25:46 GMT, Mandy Chung <mchung at openjdk.org> wrote:

>> Chen Liang 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 four additional commits since the last revision:
>> 
>>  - Review comments
>>  - Merge branch 'master' of https://github.com/openjdk/jdk into fix/reflect-native-slow
>>  - Better comments
>>  - 8343377: Performance regression in reflective invocation of native methods
>
> src/java.base/share/classes/jdk/internal/reflect/MethodHandleAccessorFactory.java line 376:
> 
>> 374:         // bit set, which verifies that the last parameter of the member must be
>> 375:         // an array type.  Such restriction does not exist in core reflection
>> 376:         // and the JVM.  Fall back to use the native implementation instead.
> 
> Suggestion:
> 
>         // For members with ACC_VARARGS bit set, MethodHandles produced by lookup
>         // always have variable arity set and hence the last parameter of the member 
>         // must be an array type.  Such restriction does not exist in core reflection
>         // and the JVM.  Fall back to use the native implementation instead.

Thanks. I have added an additional clarification for "Such restriction does not exist..." locally:

"Such restriction does not exist in core reflection and the JVM, which always use fixed-arity invocations."

which I believe provides a better overview of the whole story.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22169#discussion_r1866508517


More information about the core-libs-dev mailing list