2 This file is a part of libcds - Concurrent Data Structures library
4 (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
6 Source code repo: http://github.com/khizmax/libcds/
7 Download: http://sourceforge.net/projects/libcds/files/
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are met:
12 * Redistributions of source code must retain the above copyright notice, this
13 list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16 this list of conditions and the following disclaimer in the documentation
17 and/or other materials provided with the distribution.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "set/hdr_intrusive_feldman_hashset.h"
32 #include <cds/urcu/signal_threaded.h>
33 #include <cds/intrusive/feldman_hashset_rcu.h>
34 #include "unit/print_feldman_hashset_stat.h"
37 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
39 typedef cds::urcu::gc<cds::urcu::signal_threaded<>> rcu_type;
43 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_nohash()
45 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
46 typedef size_t key_type;
48 struct traits : public ci::feldman_hashset::traits
50 typedef get_key<key_type> hash_accessor;
51 typedef item_disposer disposer;
53 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
54 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
55 test_rcu<set_type, nohash<key_type>>(4, 2);
57 typedef ci::FeldmanHashSet<
60 typename ci::feldman_hashset::make_traits<
61 ci::feldman_hashset::hash_accessor< get_key<key_type>>
62 , ci::opt::disposer< item_disposer >
65 test_rcu<set_type2, nohash<key_type>>(4, 2);
69 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_stdhash()
71 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
72 typedef size_t hash_type;
74 struct traits: public ci::feldman_hashset::traits
76 typedef get_hash<hash_type> hash_accessor;
77 typedef item_disposer disposer;
79 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
80 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
81 test_rcu<set_type, std::hash<hash_type>>(4, 2);
83 typedef ci::FeldmanHashSet<
86 typename ci::feldman_hashset::make_traits<
87 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
88 , ci::opt::disposer< item_disposer >
91 test_rcu<set_type2, std::hash<hash_type>>(4, 2);
95 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_hash128()
97 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
98 typedef hash128 hash_type;
100 struct traits: public ci::feldman_hashset::traits
102 typedef get_hash<hash_type> hash_accessor;
103 typedef item_disposer disposer;
104 typedef hash128::less less;
106 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
107 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash128!!!" );
108 test_rcu<set_type, hash128::make>(4, 2);
110 typedef ci::FeldmanHashSet<
113 typename ci::feldman_hashset::make_traits<
114 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
115 , ci::opt::disposer< item_disposer >
116 , ci::opt::less< hash_type::less >
119 test_rcu<set_type2, hash128::make>(4, 2);
123 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_nohash_stat()
125 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
126 typedef size_t key_type;
128 struct traits : public ci::feldman_hashset::traits
130 typedef get_key<key_type> hash_accessor;
131 typedef item_disposer disposer;
132 typedef ci::feldman_hashset::stat<> stat;
134 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
135 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
136 test_rcu<set_type, nohash<key_type>>(4, 2);
138 typedef ci::FeldmanHashSet<
141 typename ci::feldman_hashset::make_traits<
142 ci::feldman_hashset::hash_accessor< get_key<key_type>>
143 , ci::opt::disposer< item_disposer >
144 , co::stat< ci::feldman_hashset::stat<>>
147 test_rcu<set_type2, nohash<key_type>>(4, 2);
151 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_stdhash_stat()
153 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
154 typedef size_t hash_type;
156 struct traits: public ci::feldman_hashset::traits
158 typedef get_hash<hash_type> hash_accessor;
159 typedef item_disposer disposer;
160 typedef ci::feldman_hashset::stat<> stat;
162 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
163 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
164 test_rcu<set_type, std::hash<hash_type>>(4, 2);
166 typedef ci::FeldmanHashSet<
169 typename ci::feldman_hashset::make_traits<
170 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
171 , ci::opt::disposer< item_disposer >
172 ,co::stat< ci::feldman_hashset::stat<>>
175 test_rcu<set_type2, std::hash<hash_type>>(4, 2);
179 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_hash128_stat()
181 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
182 typedef hash128 hash_type;
184 struct traits: public ci::feldman_hashset::traits
186 typedef get_hash<hash_type> hash_accessor;
187 typedef item_disposer disposer;
188 typedef hash128::cmp compare;
189 typedef ci::feldman_hashset::stat<> stat;
191 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
192 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
193 test_rcu<set_type, hash_type::make>(4, 2);
195 typedef ci::FeldmanHashSet<
198 typename ci::feldman_hashset::make_traits<
199 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
200 , ci::opt::disposer< item_disposer >
201 ,co::stat< ci::feldman_hashset::stat<>>
202 ,co::compare< hash128::cmp >
205 test_rcu<set_type2, hash_type::make>(4, 2);
209 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_nohash_5_3()
211 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
212 typedef size_t key_type;
214 struct traits : public ci::feldman_hashset::traits
216 typedef get_key<key_type> hash_accessor;
217 typedef item_disposer disposer;
219 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
220 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!");
221 test_rcu<set_type, nohash<key_type>>(5, 3);
223 typedef ci::FeldmanHashSet<
226 typename ci::feldman_hashset::make_traits<
227 ci::feldman_hashset::hash_accessor< get_key<key_type>>
228 , ci::opt::disposer< item_disposer >
231 test_rcu<set_type2, nohash<key_type>>(5, 3);
235 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_stdhash_5_3()
237 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
238 typedef size_t hash_type;
240 struct traits: public ci::feldman_hashset::traits
242 typedef get_hash<hash_type> hash_accessor;
243 typedef item_disposer disposer;
245 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
246 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
247 test_rcu<set_type, std::hash<hash_type>>(5, 3);
249 typedef ci::FeldmanHashSet<
252 typename ci::feldman_hashset::make_traits<
253 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
254 , ci::opt::disposer< item_disposer >
257 test_rcu<set_type2, std::hash<hash_type>>(5, 3);
261 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_hash128_4_3()
263 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
264 typedef hash128 hash_type;
266 struct traits: public ci::feldman_hashset::traits
268 typedef get_hash<hash_type> hash_accessor;
269 typedef item_disposer disposer;
270 typedef co::v::sequential_consistent memory_model;
272 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
273 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
274 test_rcu<set_type, hash128::make >(4, 3);
276 typedef ci::FeldmanHashSet<
279 typename ci::feldman_hashset::make_traits<
280 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
281 , ci::opt::disposer< item_disposer >
282 ,co::memory_model< co::v::sequential_consistent >
285 test_rcu<set_type2, hash128::make >(4, 3);
289 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_nohash_5_3_stat()
291 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
292 typedef size_t key_type;
294 struct traits: public ci::feldman_hashset::traits
296 typedef get_key<key_type> hash_accessor;
297 typedef item_disposer disposer;
298 typedef ci::feldman_hashset::stat<> stat;
300 typedef ci::FeldmanHashSet< rcu_type, Item<key_type>, traits > set_type;
301 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
302 test_rcu<set_type, nohash<key_type>>(5, 3);
304 typedef ci::FeldmanHashSet<
307 typename ci::feldman_hashset::make_traits<
308 ci::feldman_hashset::hash_accessor< get_key<key_type>>
309 , ci::opt::disposer< item_disposer >
310 ,co::stat< ci::feldman_hashset::stat<>>
313 test_rcu<set_type2, nohash<key_type>>(5, 3);
317 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_stdhash_5_3_stat()
319 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
320 typedef size_t hash_type;
322 struct traits: public ci::feldman_hashset::traits
324 typedef get_hash<hash_type> hash_accessor;
325 typedef item_disposer disposer;
326 typedef ci::feldman_hashset::stat<> stat;
328 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
329 static_assert(std::is_same< typename set_type::hash_type, size_t>::value, "set::hash_type != size_t!!!" );
330 test_rcu<set_type, std::hash<hash_type>>(5, 3);
332 typedef ci::FeldmanHashSet<
335 typename ci::feldman_hashset::make_traits<
336 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
337 , ci::opt::disposer< item_disposer >
338 ,co::stat< ci::feldman_hashset::stat<>>
341 test_rcu<set_type2, std::hash<hash_type>>(5, 3);
345 void IntrusiveFeldmanHashSetHdrTest::rcu_sht_hash128_4_3_stat()
347 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
348 typedef hash128 hash_type;
350 struct traits: public ci::feldman_hashset::traits
352 typedef get_hash<hash_type> hash_accessor;
353 typedef item_disposer disposer;
354 typedef ci::feldman_hashset::stat<> stat;
355 typedef hash128::less less;
356 typedef hash128::cmp compare;
358 typedef ci::FeldmanHashSet< rcu_type, Item<hash_type>, traits > set_type;
359 static_assert(std::is_same< typename set_type::hash_type, hash_type>::value, "set::hash_type != hash_type!!!" );
360 test_rcu<set_type, hash_type::make>(4, 3);
362 typedef ci::FeldmanHashSet<
365 typename ci::feldman_hashset::make_traits<
366 ci::feldman_hashset::hash_accessor< get_hash<hash_type>>
367 , ci::opt::disposer< item_disposer >
368 , co::stat< ci::feldman_hashset::stat<>>
369 , co::less< hash_type::less >
370 , co::compare< hash128::cmp >
373 test_rcu<set_type2, hash_type::make>(4, 3);