-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSequentialConsistency_StoreBuffer.java
More file actions
57 lines (44 loc) · 1.79 KB
/
SequentialConsistency_StoreBuffer.java
File metadata and controls
57 lines (44 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package io.github.lantalex.mm;
import org.openjdk.jcstress.annotations.Actor;
import org.openjdk.jcstress.annotations.JCStressTest;
import org.openjdk.jcstress.annotations.Outcome;
import org.openjdk.jcstress.annotations.State;
import org.openjdk.jcstress.infra.results.II_Result;
import static org.openjdk.jcstress.annotations.Expect.ACCEPTABLE;
import static org.openjdk.jcstress.annotations.Expect.FORBIDDEN;
@JCStressTest
@Outcome(id = "0, 0", expect = FORBIDDEN, desc = "Violation of SC")
@Outcome(expect = ACCEPTABLE, desc = "SC consistent")
@State
public class SequentialConsistency_StoreBuffer {
/*
How to run:
$ ./gradlew clean jcstress --tests "io.github.lantalex.mm.SequentialConsistency_StoreBuffer"
Results(x86):
----------------------------------------------------------------
RESULT SAMPLES FREQ EXPECT DESCRIPTION
0, 0 0 0.00% Forbidden Violation of SC
0, 1 312,336,405 25.64% Acceptable SC consistent
1, 0 876,763,622 71.98% Acceptable SC consistent
1, 1 28,982,941 2.38% Acceptable SC consistent
Results(arm_v8):
----------------------------------------------------------------
RESULT SAMPLES FREQ EXPECT DESCRIPTION
0, 0 0 0.00% Forbidden Violation of SC
0, 1 22,429,382 47.01% Acceptable SC consistent
1, 0 19,432,120 40.73% Acceptable SC consistent
1, 1 5,850,906 12.26% Acceptable SC consistent
*/
volatile int a = 0;
volatile int b = 0;
@Actor
public final void cpu1(II_Result r) {
a = 1;
r.r2 = b;
}
@Actor
public final void cpu2(II_Result r) {
b = 1;
r.r1 = a;
}
}