Spin Loop Hint support: Draft JEP proposal

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Oct 5 08:56:39 UTC 2015


Hi Gil,

Glad to see this being addressed!

On 10/04/2015 07:22 PM, Gil Tene wrote:
> We propose to add a method to the JDK which would be hint that a spin
> loop is being performed. E.g.
> jdk.util.PerformanceHints.spinLoopHint(), which will hopefully evolve
> to a Java SE API, e.g. java.util.PerformanceHints.spinLoopHint(). The
> specific name space location, class name, and method name will be
> determined as part of development of this JEP.

Yes, that would be a tough part. JDK is usually oblivious of these
low-level platform-specific hints, they go to sun.misc.* (e.g. Unsafe,
@Contended and others...). I'll let Project Leads to make that call :)


> [4] HotSpot WebRevs for prototype implementation which intrinsifies
> org.performancehintsSpinHint.spinLoopHint()
> http://ivankrylov.github.io/spinloophint/webrev/
> <http://ivankrylov.github.io/spinloophint/webrev/>

 * product_pd (platform-dependent) flags can be used to conditionalize
the support on a platform. This helps to avoid vm_version_* tricks.

 * Does spinloophint imply membar as well? x86_64.ad suggests so.
library_call.cpp suggests so. It seems weird to conflate the two, even
though it's understandable you want to piggyback on existing machinery.

 * I think spinLoopHint() misses a @HotspotIntrinsicCandidate annotation.

Thanks,
-Aleksey




More information about the core-libs-dev mailing list