On Sat, 16 Apr 2022 12:31:41 GMT, ExE Boss <[email protected]> wrote:
>> Alan Bateman has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Refresh
>
> src/java.base/share/classes/jdk/internal/misc/Blocker.java line 111:
>
>> 109: methodType = MethodType.methodType(void.class,
>> long.class);
>> 110: endCompensatedBlock = l.findVirtual(ForkJoinPool.class,
>> "endCompensatedBlock", methodType);
>> 111:
>
> This can use `SharedSecrets.getJavaLangInvokeAccess()` in order to avoid
> using `privateLookupIn(…)` and `AccessController.doPrivileged(…)`.
>
> Suggestion:
>
> JavaLangInvokeAccess JLIA =
> SharedSecrets.getJavaLangInvokeAccess();
> MethodType methodType = MethodType.methodType(long.class);
> beginCompensatedBlock = JLIA.findVirtual(ForkJoinPool.class,
> "beginCompensatedBlock", methodType);
> if (beginCompensatedBlock == null) {
> throw new NoSuchMethodException(ForkJoinPool.class +
> ".beginCompensatedBlock" + methodType);
> }
> methodType = MethodType.methodType(void.class, long.class);
> endCompensatedBlock = JLIA.findVirtual(ForkJoinPool.class,
> "endCompensatedBlock", methodType);
> if (endCompensatedBlock == null) {
> throw new NoSuchMethodException(ForkJoinPool.class +
> ".endCompensatedBlock" + methodType);
> }
I think we may just eliminate the reflection use and use a shared secret
instead.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8166