postgres.git / summary / log / commit / refs

commit    e68d64c52831eb2be013da4eb0e0bf9255c8bd7a
Author:   Andres Freund <andres@anarazel.de>
Date:     Sun Apr 08 01:27:14 2018 +0000
First released in: 11.0, 9.5.13, 9.6.9, 10.4

    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 8c3debbb 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-


src/include/port/atomics.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h index 0b506fcbc0b..005664f4ebd 100644 --- a/src/include/port/atomics.h +++ b/src/include/port/atomics.h @@ -215,8 +215,6 @@ STATIC_IF_INLINE_DECLARE uint64 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint6 STATIC_IF_INLINE_DECLARE void pg_atomic_init_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - pg_atomic_init_flag_impl(ptr); } @@ -230,8 +228,6 @@ pg_atomic_init_flag(volatile pg_atomic_flag *ptr) STATIC_IF_INLINE_DECLARE bool pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - return pg_atomic_test_set_flag_impl(ptr); } @@ -245,8 +241,6 @@ pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr) STATIC_IF_INLINE_DECLARE bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - return pg_atomic_unlocked_test_flag_impl(ptr); } @@ -258,8 +252,6 @@ pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr) STATIC_IF_INLINE_DECLARE void pg_atomic_clear_flag(volatile pg_atomic_flag *ptr) { - AssertPointerAlignment(ptr, sizeof(*ptr)); - pg_atomic_clear_flag_impl(ptr); } [parent: 73709f1c1e58]