[jmm-dev] easily observable examples of non-sc behaviours in Java

Aleksey Shipilev aleksey.shipilev at oracle.com
Thu Jan 15 19:25:11 UTC 2015


On 01/15/2015 10:22 PM, Aleksey Shipilev wrote:
> Hotspot does this routinely. This opens up an interesting class of bugs:
> busy-waiting on some condition may stuck indefinitely. This is
> especially "fun" in intrinsics, e.g. these two interesting bugs:

Or, in jcstress-speak:

>  a) busy-waiting on Reference.get(): Hotspot intrinsifies the call, but
> forgets the barrier, loop optimizations then move out the predicate out
> of the loop, boom: https://bugs.openjdk.java.net/browse/JDK-7190310

http://hg.openjdk.java.net/code-tools/jcstress/file/fc7efa97034e/tests-custom/src/main/java/org/openjdk/jcstress/tests/interrupt/WeakReferenceTest.java

>  b) busy-waiting on Thread.currentThread().isInterrupted(): same thing,
> but amusingly only in OSR stub, boom:
> https://bugs.openjdk.java.net/browse/JDK-8003135

http://hg.openjdk.java.net/code-tools/jcstress/file/fc7efa97034e/tests-custom/src/main/java/org/openjdk/jcstress/tests/interrupt/CurrentThreadIsInterruptedTest.java


-Aleksey.



More information about the jmm-dev mailing list