[concurrency-interest] Spin Loop Hint support: Draft JEP proposal

Paul Sandoz paul.sandoz at oracle.com
Tue Dec 1 10:36:45 UTC 2015


> On 1 Dec 2015, at 03:58, Gil Tene <gil at azul.com> wrote:
> 
> Update: After some significant back-and-forth between Doug and I on naming and JavaDoc'ing, and with Martin (Thompson) stepping in to help, we have what we think is a good spec and name selection for this thing. We're proposing to add a new static method to the Runtime class:
> 
> class Runtime { /...
>    /**
>      * Method signifying that the caller is momentarily unable to
>      * progress until the occurrence of one or more actions of one or
>      * more other activities.  When invoked within each iteration, this
>      * method typically improves performance of spin wait loop
>      * constructions.
>      */
>     public static void onSpinWait() {};
> }
> 

Short and sweet. I like it. I think it would be useful to add an @apiNote with explanatory text similar to that in the motivation section of the JEP.

If you like I can help guide this through the JEP process.


> See updated details, including a link to the updated JEP draft, as well as links to working prototype implementations, webrevs against OpenJDK9b94, and example here: https://github.com/giltene/GilExamples/tree/master/SpinWaitTest <https://github.com/giltene/GilExamples/tree/master/SpinWaitTest> . All names have changed to reflect the new naming (onSpinWait, -XX:+UseOnSpinWaitIntrinsic, SpinWaitTest, etc.).
> 
> As an interesting stat, the total changes in the WebRevs amount to 78 added lines (across 14 files) , and 0 lines removed or changed. Hopefully a good indication of relatively low footprint and risk.
> 

I agree, the JDK and hotspot patches (for x86 support) are quite small.

Paul.



More information about the core-libs-dev mailing list