RFR (XS): 8188877: Improper synchronization in offer_termination

White, Derek Derek.White at cavium.com
Fri Oct 6 23:13:49 UTC 2017


Hi All,

The field ParallelTaskTerminator::_offered_termination is modified atomically, but is read as a normal field access.

In ParallelTaskTerminator::offer_termination(), this field is read within a loop, but there's nothing stopping a compiler from hoisting the load out of the loop. See CR for examples of possible load hoisting.

Trivial fix: The _offered_termination field should be declared volatile.

This was found by code inspection. I haven't seen an actual error, but compiler optimizations or unrelated code changes could make an error occur in the future.

CR: https://bugs.openjdk.java.net/browse/JDK-8188877
Webrev: http://cr.openjdk.java.net/~drwhite/8188877/webrev.01/

Minor build and testing done, but inspected the generated code for offer_termination() and found no differences.


  *   Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20171006/42d8383f/attachment.htm>


More information about the hotspot-gc-dev mailing list