Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d234602

Browse files
committed
Remove overzeleous assertions in pg_atomic_flag code.
The atomics code asserts proper alignment in various places. That's mainly because the alignment of 64bit integers is not sufficient for atomic operations on all platforms. Some ABIs only have four byte alignment, but don't have atomic behavior when crossing page boundaries. The flags code isn't affected by that however, as the type alignment always is sufficient for atomic operations. Nevertheless the code asserted alignment requirements. Before 8c3debb it was only broken on hppa, after it probably affect further platforms. Thus remove the assertions for pg_atomic_flag operators. Per buildfarm animal pademelon. Discussion: https://postgr.es/m/7223.1523124425@sss.pgh.pa.us Backpatch: 9.5-
1 parent 2b74022 commit d234602

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/include/port/atomics.h

-8
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@
174174
static inline void
175175
pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
176176
{
177-
AssertPointerAlignment(ptr, sizeof(*ptr));
178-
179177
pg_atomic_init_flag_impl(ptr);
180178
}
181179

@@ -189,8 +187,6 @@ pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
189187
static inline bool
190188
pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
191189
{
192-
AssertPointerAlignment(ptr, sizeof(*ptr));
193-
194190
return pg_atomic_test_set_flag_impl(ptr);
195191
}
196192

@@ -204,8 +200,6 @@ pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
204200
static inline bool
205201
pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
206202
{
207-
AssertPointerAlignment(ptr, sizeof(*ptr));
208-
209203
return pg_atomic_unlocked_test_flag_impl(ptr);
210204
}
211205

@@ -217,8 +211,6 @@ pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
217211
static inline void
218212
pg_atomic_clear_flag(volatile pg_atomic_flag *ptr)
219213
{
220-
AssertPointerAlignment(ptr, sizeof(*ptr));
221-
222214
pg_atomic_clear_flag_impl(ptr);
223215
}
224216

0 commit comments

Comments
 (0)