]>
Commit | Line | Data |
---|---|---|
cb323159 A |
1 | // To apply, at the top of xnu.git: |
2 | // $ spatch --max-width=120 --use-gitgrep --in-place --include-headers --sp-file tools/cocci/mcache_atomic_rewrite.cocci -dir . | |
3 | // | |
4 | // coccinelle insists on adding a space for (void) casts which can be fixed with: | |
5 | // $ git grep -l '(void) os_atomic' | xargs -n1 sed -i '' -e 's/(void) os_atomic/(void)os_atomic/' | |
6 | ||
7 | @@ expression E, F, A; @@ | |
8 | ||
9 | ( | |
10 | - atomic_add_16_ov(E, 1) | |
11 | + os_atomic_inc_orig(E, relaxed) | |
12 | | | |
13 | - atomic_add_16(E, 1) | |
14 | + os_atomic_inc(E, relaxed) | |
15 | | | |
16 | - atomic_add_32_ov(E, 1) | |
17 | + os_atomic_inc_orig(E, relaxed) | |
18 | | | |
19 | - atomic_add_32(E, 1) | |
20 | + os_atomic_inc(E, relaxed) | |
21 | | | |
22 | - atomic_add_64_ov(E, 1) | |
23 | + os_atomic_inc_orig(E, relaxed) | |
24 | | | |
25 | - atomic_add_64(E, 1) | |
26 | + os_atomic_inc(E, relaxed) | |
27 | | | |
28 | - atomic_add_16_ov(E, -1) | |
29 | + os_atomic_dec_orig(E, relaxed) | |
30 | | | |
31 | - atomic_add_16(E, -1) | |
32 | + os_atomic_dec(E, relaxed) | |
33 | | | |
34 | - atomic_add_32_ov(E, -1) | |
35 | + os_atomic_dec_orig(E, relaxed) | |
36 | | | |
37 | - atomic_add_32(E, -1) | |
38 | + os_atomic_dec(E, relaxed) | |
39 | | | |
40 | - atomic_add_64_ov(E, -1) | |
41 | + os_atomic_dec_orig(E, relaxed) | |
42 | | | |
43 | - atomic_add_64(E, -1) | |
44 | + os_atomic_dec(E, relaxed) | |
45 | | | |
46 | - atomic_add_16_ov(E, F) | |
47 | + os_atomic_add_orig(E, F, relaxed) | |
48 | | | |
49 | - atomic_add_16(E, F) | |
50 | + os_atomic_add(E, F, relaxed) | |
51 | | | |
52 | - atomic_add_32_ov(E, F) | |
53 | + os_atomic_add_orig(E, F, relaxed) | |
54 | | | |
55 | - atomic_add_32(E, F) | |
56 | + os_atomic_add(E, F, relaxed) | |
57 | | | |
58 | - atomic_add_64_ov(E, F) | |
59 | + os_atomic_add_orig(E, F, relaxed) | |
60 | | | |
61 | - atomic_add_64(E, F) | |
62 | + os_atomic_add(E, F, relaxed) | |
63 | | | |
64 | - atomic_test_set_32(A, E, F) | |
65 | + os_atomic_cmpxchg(A, E, F, acq_rel) | |
66 | | | |
67 | - atomic_test_set_64(A, E, F) | |
68 | + os_atomic_cmpxchg(A, E, F, acq_rel) | |
69 | | | |
70 | - atomic_test_set_ptr(A, E, F) | |
71 | + os_atomic_cmpxchg(A, E, F, acq_rel) | |
72 | | | |
73 | - atomic_set_32(E, F) | |
74 | + os_atomic_store(E, F, release) | |
75 | | | |
76 | - atomic_set_64(E, F) | |
77 | + os_atomic_store(E, F, release) | |
78 | | | |
79 | - atomic_set_ptr(E, F) | |
80 | + os_atomic_store(E, F, release) | |
81 | | | |
82 | - atomic_get_64(E, A) | |
83 | + E = os_atomic_load(A, relaxed) | |
84 | | | |
85 | - membar_sync() | |
86 | + os_atomic_thread_fence(seq_cst) | |
87 | | | |
88 | - atomic_or_8_ov(E, F) | |
89 | + os_atomic_or_orig(E, F, relaxed) | |
90 | | | |
91 | - atomic_or_16_ov(E, F) | |
92 | + os_atomic_or_orig(E, F, relaxed) | |
93 | | | |
94 | - atomic_or_32_ov(E, F) | |
95 | + os_atomic_or_orig(E, F, relaxed) | |
96 | | | |
97 | - atomic_or_8(E, F) | |
98 | + os_atomic_or(E, F, relaxed) | |
99 | | | |
100 | - atomic_or_16(E, F) | |
101 | + os_atomic_or(E, F, relaxed) | |
102 | | | |
103 | - atomic_or_32(E, F) | |
104 | + os_atomic_or(E, F, relaxed) | |
105 | | | |
106 | - atomic_and_8_ov(E, F) | |
107 | + os_atomic_and_orig(E, F, relaxed) | |
108 | | | |
109 | - atomic_and_16_ov(E, F) | |
110 | + os_atomic_and_orig(E, F, relaxed) | |
111 | | | |
112 | - atomic_and_32_ov(E, F) | |
113 | + os_atomic_and_orig(E, F, relaxed) | |
114 | | | |
115 | - atomic_and_8(E, F) | |
116 | + os_atomic_and(E, F, relaxed) | |
117 | | | |
118 | - atomic_and_16(E, F) | |
119 | + os_atomic_and(E, F, relaxed) | |
120 | | | |
121 | - atomic_and_32(E, F) | |
122 | + os_atomic_and(E, F, relaxed) | |
123 | | | |
124 | - atomic_bitset_8_ov(E, F) | |
125 | + os_atomic_or_orig(E, F, relaxed) | |
126 | | | |
127 | - atomic_bitset_16_ov(E, F) | |
128 | + os_atomic_or_orig(E, F, relaxed) | |
129 | | | |
130 | - atomic_bitset_32_ov(E, F) | |
131 | + os_atomic_or_orig(E, F, relaxed) | |
132 | | | |
133 | - atomic_bitset_8(E, F) | |
134 | + os_atomic_or(E, F, relaxed) | |
135 | | | |
136 | - atomic_bitset_16(E, F) | |
137 | + os_atomic_or(E, F, relaxed) | |
138 | | | |
139 | - atomic_bitset_32(E, F) | |
140 | + os_atomic_or(E, F, relaxed) | |
141 | | | |
142 | - atomic_bitclear_8_ov(E, F) | |
143 | + os_atomic_andnot_orig(E, F, relaxed) | |
144 | | | |
145 | - atomic_bitclear_16_ov(E, F) | |
146 | + os_atomic_andnot_orig(E, F, relaxed) | |
147 | | | |
148 | - atomic_bitclear_32_ov(E, F) | |
149 | + os_atomic_andnot_orig(E, F, relaxed) | |
150 | | | |
151 | - atomic_bitclear_8(E, F) | |
152 | + os_atomic_andnot(E, F, relaxed) | |
153 | | | |
154 | - atomic_bitclear_16(E, F) | |
155 | + os_atomic_andnot(E, F, relaxed) | |
156 | | | |
157 | - atomic_bitclear_32(E, F) | |
158 | + os_atomic_andnot(E, F, relaxed) | |
159 | ) |