RFR: 8265129: Add intrinsic support for JVM.getClassId [v6]
Denghui Dong
ddong at openjdk.java.net
Wed May 19 03:10:42 UTC 2021
On Mon, 17 May 2021 07:20:18 GMT, Denghui Dong <ddong at openjdk.org> wrote:
>> 8265129: Add intrinsic support for JVM.getClassId
>
> Denghui Dong has updated the pull request incrementally with one additional commit since the last revision:
>
> fix crash problem
Hi Vladimir,
Thanks for your comment.
Yes, the native implementation for `getClassIdNonIntrinsic`/`getClassId` is located in `jfrTraceId.cpp#L178` just as you said, more specifically, there are two path, one(JfrTraceId::load) for normal class and one(load_primitive) for primitive class (includeing void.class).
My pseudo-code(the comment of `LibraryCallKit::inline_native_classID`) is consistent with the implementation of these two paths.
And in the normal class implementation path, there are fast path and slow path(see JfrTraceIdLoadBarrier::load), only some comparison and shift operations are needed to obtain the class ID in the fast path, and that's where I think intrinsic can bring performance improvements, I saw about 20x improvement from my microbenchmark.
Judging from the current JFR implementation, there are already some events that need to rely on this API, such as `ExceptionThrownEvent` and `ErrorThrownEvent` use `thrownClass` to record the type of exception, and I also noticed that there is a new PR(https://github.com/openjdk/jdk/pull/4101) to add `FinalizerEvent` which include a field named `finalizedClass` to record the type information. Therefore, I have reason to believe that this API will be frequently used during the JFR activation process.
As far as the current implementation is concerned, it is indeed a bit complicated, I think some simplifications can be made, for example, only the fast path for the normal class is retained, and other paths are directly implemented by calling the native function. What do you think?
@egahlin @mgronlun
And I hope JFR's folks could give some suggestions on this PR:)
Best,
Denghui
-------------
PR: https://git.openjdk.java.net/jdk/pull/3470
More information about the hotspot-compiler-dev
mailing list