[14] RFR (XS): 8226409: Enable argument profiling for sun.misc.Unsafe.put*/get*

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed Jul 3 22:23:29 UTC 2019


Right.

Thanks
Vladimir

> On Jul 3, 2019, at 2:53 PM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> 
> 
>> Changes are good and trivial.
> 
> Thanks, Vladimir.
> 
>> But can you explain why do we care about sun.misc.Unsafe in current JDK? All should use jdk.internal.misc.Unsafe.
>> May be this issue is good motivation to switch to jdk.internal.misc.Unsafe?
> 
> sun.misc.Unsafe is widely used outside JDK and it is listed in JEP 260 [1] as critical internal API. It is still not encapsulated since 9, because there's no supported replacement available yet.
> 
> Moreover, jdk.internal.misc.Unsafe is encapsulated from the very beginning and shouldn't be used outside of the JDK.
> 
> Best regards,
> Vladimir Ivanov
> 
> [1] http://openjdk.java.net/jeps/260
>    JEP 260: Encapsulate Most Internal APIs
> 
>>> On 7/3/19 2:01 PM, Vladimir Ivanov wrote:
>>> http://cr.openjdk.java.net/~vlivanov/8226409/webrev.00/
>>> https://bugs.openjdk.java.net/browse/JDK-8226409
>>> 
>>> JDK-8181211 [1] enabled argument profiling for jdk.internal.misc.Unsafe to recuperate performance regression when off-heap/on-heap accesses are treated as mixed accesses (due to recent bug fixes in that area).
>>> 
>>> Profiling data allows to speculatively optimize for on-heap or off-heap scenario and avoid memory barriers around unsafe accesses which are mandatory in mixed case.
>>> 
>>> Unfortunately, it doesn't help sun.misc.Unsafe at all.
>>> 
>>> sun.misc.Unsafe delegates to jdk.internal.misc.Unsafe and profiling data is mostly useless there since it is almost always polluted.
>>> 
>>> Proposed fix is to enable argument profiling for sun.misc.Unsafe as well.
>>> 
>>> Testing: hs-precheckin-comp, tier1-4
>>> 
>>> Thanks!
>>> 
>>> Best regards,
>>> Vladimir Ivanov
>>> 
>>> [1] https://bugs.openjdk.java.net/browse/JDK-8181211



More information about the hotspot-compiler-dev mailing list