From 0f5cc165e8f6dcb244c71cc89e35271dc53e0039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20Li=C3=A9tar?= Date: Thu, 16 Apr 2020 08:33:02 +0200 Subject: [PATCH] Don't require 16-byte CAS on x86. (#173) * Don't require 16-byte CAS on x86. We only need to CAS 2 pointers, which is always possible on x86. * Fix the way the Image variable is referenced. * Replace failOnStderr by `set -eo pipefail` on Linux. The x86 image doesn't have clangformat, which causes cmake to print a warning on the stderr. Exit codes should be enough to detect failure. * Use x86 images from snmallocciteam. * clang-format --- azure-pipelines.yml | 52 +++++++++++++++++++++++++++++++++------------ ci/linux_x86 | 7 ++++++ src/ds/aba.h | 4 +++- 3 files changed, 49 insertions(+), 14 deletions(-) create mode 100644 ci/linux_x86 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f65fe87b..30253d79 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,97 +9,123 @@ jobs: displayName: Linux pool: vmImage: 'ubuntu-18.04' - container: snmallocciteam/build_linux_x64:latest strategy: matrix: - Clang-7 Debug: + 64-bit Clang-7 Debug: CC: clang-7 CXX: clang++-7 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-7 Release: + 64-bit Clang-7 Release: CC: clang-7 CXX: clang++-7 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-8 Debug: + 64-bit Clang-8 Debug: CC: clang-8 CXX: clang++-8 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-8 Release: + 64-bit Clang-8 Release: CC: clang-8 CXX: clang++-8 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-9 Debug: + 64-bit Clang-9 Debug: CC: clang-9 CXX: clang++-9 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Clang-9 Release: + 64-bit Clang-9 Release: CC: clang-9 CXX: clang++-9 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - GCC-8 Debug: + 64-bit GCC-8 Debug: CC: gcc-8 CXX: g++-8 BuildType: Debug SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - GCC-8 Release: + 64-bit GCC-8 Release: CC: gcc-8 CXX: g++-8 BuildType: Release SelfHost: false CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Self Host: + 64-bit Self Host: CC: clang-7 CXX: clang++-7 BuildType: Debug SelfHost: true CMakeArgs: '' + Image: snmallocciteam/build_linux_x64:latest - Cache Friendly: + 64-bit Cache Friendly: CC: clang-7 CXX: clang++-7 BuildType: Debug SelfHost: false CMakeArgs: '-DCACHE_FRIENDLY_OFFSET=64' + Image: snmallocciteam/build_linux_x64:latest + 32-bit Clang-9 Debug: + CC: clang-9 + CXX: clang++-9 + BuildType: Debug + SelfHost: false + CMakeArgs: '' + Image: snmallocciteam/build_linux_x86:latest + + 32-bit Clang-9 Release: + CC: clang-9 + CXX: clang++-9 + BuildType: Release + SelfHost: false + CMakeArgs: '' + Image: snmallocciteam/build_linux_x86:latest + + container: $[ variables['Image'] ] steps: - script: | + set -eo pipefail ci/scripts/build.sh env: CC: $(CC) CXX: $(CXX) BUILD_TYPE: $(BuildType) CMAKE_ARGS: $(CMakeArgs) - failOnStderr: true displayName: 'Build' - script: | + set -eo pipefail ci/scripts/test.sh env: SELF_HOST: $(SelfHost) BUILD_TYPE: $(BuildType) - failOnStderr: true displayName: 'Test' - job: diff --git a/ci/linux_x86 b/ci/linux_x86 new file mode 100644 index 00000000..6124ddf4 --- /dev/null +++ b/ci/linux_x86 @@ -0,0 +1,7 @@ +FROM multiarch/ubuntu-core:x86-bionic + +WORKDIR /src + +RUN apt update \ + && apt install --no-install-recommends -y ninja-build clang++-9 cmake \ + && apt -y clean diff --git a/src/ds/aba.h b/src/ds/aba.h index 38aaa360..21950ff3 100644 --- a/src/ds/aba.h +++ b/src/ds/aba.h @@ -99,9 +99,11 @@ namespace snmalloc (__int64)value, (__int64*)&old); # else -# if defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) +# if defined(__GNUC__) && defined(SNMALLOC_VA_BITS_64) && \ + !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) #error You must compile with -mcx16 to enable 16-byte atomic compare and swap. # endif + Linked xchg{value, old.aba + 1}; std::atomic& addr = parent->linked;