On Tue, 1 Apr 2025 01:54:13 GMT, Chen Liang <li...@openjdk.org> wrote:
>> Kim Barrett has updated the pull request incrementally with one additional >> commit since the last revision: >> >> parameterized return type of native get0 > > src/java.base/share/classes/java/lang/ref/Reference.java line 365: > >> 363: * C2 to sometimes prefer the native implementation over the >> intrinsic. >> 364: */ >> 365: private native Object get0(); > > I think you can declare this as `private native T get0();` without changes to > native method signatures, so you can avoid the unchecked cast above. (See > Class::getPrimitiveClass declaration) > > Also, can C2 choose to use native over intrinsic? That is concerning from a > performance POV, as I think there are a few such performance sensitive > methods in core libraries. It hadn't occurred to me that would work, but indeed it does. Thanks for the suggestion. I've used tools like `-XX:+PrintInlining` when running a test that I found to be performance sensitive to the use of the intrinsic, and found that it was used. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24315#discussion_r2022537959