Skip to content

Instantly share code, notes, and snippets.

@shipilev
Created April 13, 2014 21:01
Show Gist options
  • Save shipilev/10602166 to your computer and use it in GitHub Desktop.
Save shipilev/10602166 to your computer and use it in GitHub Desktop.
o.o.j.t.fences.UnfencedAcquireReleaseTest
It looks like test is affected by where the guard variable is residing, this changeset isolates it:
http://hg.openjdk.java.net/code-tools/jcstress/rev/39a1c4786c47
On x86_64, it can not fail without compiler being involved, since x86 is TSO:
$ jdk8/bin/java -XX:-RestrictContended -jar tests-custom/target/jcstress.jar -t ".*UnfencedAcquireReleaseTest.*" -v -iters 20 -f 5
Observed state Occurrences Expectation Interpretation
[0, 0] ( 27,588,422) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 1] ( 167) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 2] ( 3,581) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 3] ( 2,023,116) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[1, 0] ( 0) ACCEPTABLE_INTERESTING Without fence or volatile can read the default or old val...
[1, 1] ( 0) ACCEPTABLE_INTERESTING Without fence or volatile can read the default or old val...
[1, 2] ( 1,251) ACCEPTABLE Can see a released value of $x if $y is observed.
[1, 3] ( 576,184,703) ACCEPTABLE Can see a released value of $x if $y is observed.
Messing with compiler shows the "interesting" behavior:
$ jdk8/fastdebug/bin/java -XX:-RestrictContended -XX:+StressLCM -XX:+StressGCM -jar tests-custom/target/jcstress.jar -t ".*UnfencedAcquireReleaseTest.*" -v -iters 20 -f 5
(ETA: n/a) (R: 2.06E+12) (T: 1/0) (F: 1/5) (I: 1/20) [OK] o.o.j.t.fences.UnfencedAcquireReleaseTest
Observed state Occurrences Expectation Interpretation
[0, 0] ( 20,200,671) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 1] ( 266) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 2] ( 5,341) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 3] ( 2,397,561) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[1, 0] ( 310) ACCEPTABLE_INTERESTING Without fence or volatile can read the default or old val...
[1, 2] ( 871) ACCEPTABLE Can see a released value of $x if $y is observed.
[1, 3] ( 271,038,170) ACCEPTABLE Can see a released value of $x if $y is observed.
On ARM, hardware itself can exhibit this behavior:
$ jdk8/bin/java -jar tests-custom/target/jcstress.jar -t ".*UnfencedAcquireReleaseTest.*" -v -iters 20 -f 5
ARM/...
(ETA: n/a) (R: 3.53E+11) (T: 1/0) (F: 1/1) (I: 1/20) [OK] o.o.j.t.fences.UnfencedAcquireReleaseTest
Observed state Occurrences Expectation Interpretation
[0, 0] ( 29,045,945) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 1] ( 685) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 2] ( 18,772) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 3] ( 70,906) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[1, 0] ( 18) ACCEPTABLE_INTERESTING Without fence or volatile can read the default or old val...
[1, 2] ( 13,938) ACCEPTABLE Can see a released value of $x if $y is observed.
[1, 3] ( 441,574,566) ACCEPTABLE Can see a released value of $x if $y is observed.
$ jdk8/bin/java -XX:-RestrictContended -jar tests-custom/target/jcstress.jar -t ".*UnfencedAcquireReleaseTest.*" -v -iters 20 -f 5
(ETA: n/a) (R: 9.46E+11) (T: 1/0) (F: 1/5) (I: 1/20) [OK] o.o.j.t.fences.UnfencedAcquireReleaseTest
Observed state Occurrences Expectation Interpretation
[0, 0] ( 8,581,200) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 1] ( 470) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 2] ( 22,626) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[0, 3] ( 2,112,219) ACCEPTABLE Before observing releasing write to, any value is OK for ...
[1, 0] ( 335,806) ACCEPTABLE_INTERESTING Without fence or volatile can read the default or old val...
[1, 2] ( 1,590) ACCEPTABLE Can see a released value of $x if $y is observed.
[1, 3] ( 117,861,459) ACCEPTABLE Can see a released value of $x if $y is observed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment