RFR: 8200697: Add utility for spin wait with fallback to yield/sleep
Kim Barrett
kim.barrett at oracle.com
Wed Apr 4 18:53:01 UTC 2018
Please review this addition of SpinYield utility class.
It initially supplies a very simple policy: spin a configured number
of times, then switch to yielding or (eventually) sleeping. Other
policies may replace this one or be provided as alternatives in the
future.
This is joint work with Robbin Ehn.
Robbin and I have immediate uses for this utility in changes we are
developing. In addition, there are some existing places that might be
converted to use this utility (or perhaps some extended version of
it), including SafepointSynchronize::begin, ReadStableMark,
Thread::SpinAcquire, and ParallelTaskTerminator::offer_termination.
Those existing potential uses are not being changed here; for now,
we're just adding the utility in support of our in-development
changes. We plan to file followup RFEs to consider converting those
potential uses.
CR:
https://bugs.openjdk.java.net/browse/JDK-8200697
Webrev:
http://cr.openjdk.java.net/~kbarrett/8200697/open.00/
Testing:
Added unit test of basic functionality.
Build and hs-tier1 (for gtest) on all Oracle platforms.
More information about the hotspot-dev
mailing list