Skip to content

Commit 0f5cc16

Browse files
authored
Don't require 16-byte CAS on x86. (microsoft#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
1 parent 2b92574 commit 0f5cc16

File tree

3 files changed

+49
-14
lines changed

3 files changed

+49
-14
lines changed

azure-pipelines.yml

+39-13
Original file line numberDiff line numberDiff line change
@@ -9,97 +9,123 @@ jobs:
99
displayName: Linux
1010
pool:
1111
vmImage: 'ubuntu-18.04'
12-
container: snmallocciteam/build_linux_x64:latest
1312

1413
strategy:
1514
matrix:
16-
Clang-7 Debug:
15+
64-bit Clang-7 Debug:
1716
CC: clang-7
1817
CXX: clang++-7
1918
BuildType: Debug
2019
SelfHost: false
2120
CMakeArgs: ''
21+
Image: snmallocciteam/build_linux_x64:latest
2222

23-
Clang-7 Release:
23+
64-bit Clang-7 Release:
2424
CC: clang-7
2525
CXX: clang++-7
2626
BuildType: Release
2727
SelfHost: false
2828
CMakeArgs: ''
29+
Image: snmallocciteam/build_linux_x64:latest
2930

30-
Clang-8 Debug:
31+
64-bit Clang-8 Debug:
3132
CC: clang-8
3233
CXX: clang++-8
3334
BuildType: Debug
3435
SelfHost: false
3536
CMakeArgs: ''
37+
Image: snmallocciteam/build_linux_x64:latest
3638

37-
Clang-8 Release:
39+
64-bit Clang-8 Release:
3840
CC: clang-8
3941
CXX: clang++-8
4042
BuildType: Release
4143
SelfHost: false
4244
CMakeArgs: ''
45+
Image: snmallocciteam/build_linux_x64:latest
4346

44-
Clang-9 Debug:
47+
64-bit Clang-9 Debug:
4548
CC: clang-9
4649
CXX: clang++-9
4750
BuildType: Debug
4851
SelfHost: false
4952
CMakeArgs: ''
53+
Image: snmallocciteam/build_linux_x64:latest
5054

51-
Clang-9 Release:
55+
64-bit Clang-9 Release:
5256
CC: clang-9
5357
CXX: clang++-9
5458
BuildType: Release
5559
SelfHost: false
5660
CMakeArgs: ''
61+
Image: snmallocciteam/build_linux_x64:latest
5762

58-
GCC-8 Debug:
63+
64-bit GCC-8 Debug:
5964
CC: gcc-8
6065
CXX: g++-8
6166
BuildType: Debug
6267
SelfHost: false
6368
CMakeArgs: ''
69+
Image: snmallocciteam/build_linux_x64:latest
6470

65-
GCC-8 Release:
71+
64-bit GCC-8 Release:
6672
CC: gcc-8
6773
CXX: g++-8
6874
BuildType: Release
6975
SelfHost: false
7076
CMakeArgs: ''
77+
Image: snmallocciteam/build_linux_x64:latest
7178

72-
Self Host:
79+
64-bit Self Host:
7380
CC: clang-7
7481
CXX: clang++-7
7582
BuildType: Debug
7683
SelfHost: true
7784
CMakeArgs: ''
85+
Image: snmallocciteam/build_linux_x64:latest
7886

79-
Cache Friendly:
87+
64-bit Cache Friendly:
8088
CC: clang-7
8189
CXX: clang++-7
8290
BuildType: Debug
8391
SelfHost: false
8492
CMakeArgs: '-DCACHE_FRIENDLY_OFFSET=64'
93+
Image: snmallocciteam/build_linux_x64:latest
8594

95+
32-bit Clang-9 Debug:
96+
CC: clang-9
97+
CXX: clang++-9
98+
BuildType: Debug
99+
SelfHost: false
100+
CMakeArgs: ''
101+
Image: snmallocciteam/build_linux_x86:latest
102+
103+
32-bit Clang-9 Release:
104+
CC: clang-9
105+
CXX: clang++-9
106+
BuildType: Release
107+
SelfHost: false
108+
CMakeArgs: ''
109+
Image: snmallocciteam/build_linux_x86:latest
110+
111+
container: $[ variables['Image'] ]
86112
steps:
87113
- script: |
114+
set -eo pipefail
88115
ci/scripts/build.sh
89116
env:
90117
CC: $(CC)
91118
CXX: $(CXX)
92119
BUILD_TYPE: $(BuildType)
93120
CMAKE_ARGS: $(CMakeArgs)
94-
failOnStderr: true
95121
displayName: 'Build'
96122
97123
- script: |
124+
set -eo pipefail
98125
ci/scripts/test.sh
99126
env:
100127
SELF_HOST: $(SelfHost)
101128
BUILD_TYPE: $(BuildType)
102-
failOnStderr: true
103129
displayName: 'Test'
104130
105131
- job:

ci/linux_x86

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM multiarch/ubuntu-core:x86-bionic
2+
3+
WORKDIR /src
4+
5+
RUN apt update \
6+
&& apt install --no-install-recommends -y ninja-build clang++-9 cmake \
7+
&& apt -y clean

src/ds/aba.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,11 @@ namespace snmalloc
9999
(__int64)value,
100100
(__int64*)&old);
101101
# else
102-
# if defined(__GNUC__) && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
102+
# if defined(__GNUC__) && defined(SNMALLOC_VA_BITS_64) && \
103+
!defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16)
103104
#error You must compile with -mcx16 to enable 16-byte atomic compare and swap.
104105
# endif
106+
105107
Linked xchg{value, old.aba + 1};
106108
std::atomic<Linked>& addr = parent->linked;
107109

0 commit comments

Comments
 (0)