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_set.h"
32 #include <cds/urcu/general_buffered.h>
33 #include <cds/intrusive/lazy_list_rcu.h>
34 #include <cds/intrusive/split_list_rcu.h>
38 typedef cds::urcu::gc< cds::urcu::general_buffered<> > rcu_type;
41 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmp_lazy()
43 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
44 typedef ci::LazyList< rcu_type
46 ,ci::lazy_list::make_traits<
47 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
48 ,co::compare< cmp<item> >
49 ,ci::opt::disposer< faked_disposer >
53 typedef ci::SplitListSet< rcu_type, ord_list,
54 ci::split_list::make_traits<
56 ,ci::split_list::dynamic_bucket_table<true>
57 ,co::memory_model<co::v::relaxed_ordering>
60 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
65 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_less_lazy()
67 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
68 typedef ci::LazyList< rcu_type
70 ,ci::lazy_list::make_traits<
71 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
72 ,co::less< less<item> >
73 ,ci::opt::disposer< faked_disposer >
77 typedef ci::SplitListSet< rcu_type, ord_list,
78 ci::split_list::make_traits<
80 ,co::memory_model<co::v::sequential_consistent>
83 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
88 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmpmix_lazy()
90 typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
91 typedef ci::LazyList< rcu_type
93 ,ci::lazy_list::make_traits<
94 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
95 ,co::less< less<item> >
96 ,co::compare< cmp<item> >
97 ,ci::opt::disposer< faked_disposer >
101 typedef ci::SplitListSet< rcu_type, ord_list,
102 ci::split_list::make_traits<
104 ,co::item_counter< simple_item_counter >
105 ,ci::split_list::dynamic_bucket_table<true>
108 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
113 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmpmix_stat_lazy()
115 typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
116 struct list_traits : public ci::lazy_list::traits
118 typedef ci::lazy_list::base_hook< co::gc<rcu_type> > hook;
119 typedef IntrusiveHashSetHdrTest::less< item > less;
120 typedef cmp<item> compare;
121 typedef faked_disposer disposer;
123 typedef ci::LazyList< rcu_type, item, list_traits > ord_list;
125 struct set_traits : public ci::split_list::make_traits<ci::split_list::dynamic_bucket_table<true>>::type
127 typedef hash_int hash;
128 typedef simple_item_counter item_counter;
129 typedef ci::split_list::stat<> stat;
131 typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
132 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
137 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmp_lazy()
139 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
140 typedef ci::LazyList< rcu_type
142 ,ci::lazy_list::make_traits<
143 ci::opt::hook< ci::lazy_list::member_hook<
144 offsetof( item, hMember ),
147 ,co::compare< cmp<item> >
148 ,ci::opt::disposer< faked_disposer >
152 typedef ci::SplitListSet< rcu_type, ord_list,
153 ci::split_list::make_traits<
155 ,co::memory_model<co::v::relaxed_ordering>
158 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
163 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_less_lazy()
165 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
166 typedef ci::LazyList< rcu_type
168 ,ci::lazy_list::make_traits<
169 ci::opt::hook< ci::lazy_list::member_hook<
170 offsetof( item, hMember ),
173 ,co::less< less<item> >
174 ,ci::opt::disposer< faked_disposer >
178 typedef ci::SplitListSet< rcu_type, ord_list,
179 ci::split_list::make_traits<
181 ,co::memory_model<co::v::sequential_consistent>
184 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
189 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix_lazy()
191 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
192 typedef ci::LazyList< rcu_type
194 ,ci::lazy_list::make_traits<
195 ci::opt::hook< ci::lazy_list::member_hook<
196 offsetof( item, hMember ),
199 ,co::compare< cmp<item> >
200 ,co::less< less<item> >
201 ,ci::opt::disposer< faked_disposer >
205 typedef ci::SplitListSet< rcu_type, ord_list,
206 ci::split_list::make_traits<
208 ,co::item_counter< simple_item_counter >
211 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
216 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix_stat_lazy()
218 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
220 public ci::lazy_list::make_traits<
221 ci::opt::hook< ci::lazy_list::member_hook<
222 offsetof( item, hMember ),
225 ,co::compare< cmp<item> >
226 ,co::less< less<item> >
227 ,ci::opt::disposer< faked_disposer >
230 typedef ci::LazyList< rcu_type, item, list_traits > ord_list;
233 public ci::split_list::make_traits<
235 ,co::item_counter< simple_item_counter >
236 ,co::stat< ci::split_list::stat<> >
239 typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
240 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
245 // Static bucket table
246 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmp_lazy()
248 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
249 typedef ci::LazyList< rcu_type
251 ,ci::lazy_list::make_traits<
252 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
253 ,co::compare< cmp<item> >
254 ,ci::opt::disposer< faked_disposer >
258 typedef ci::SplitListSet< rcu_type, ord_list,
259 ci::split_list::make_traits<
261 ,ci::split_list::dynamic_bucket_table<false>
262 ,co::memory_model<co::v::relaxed_ordering>
265 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
270 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_less_lazy()
272 typedef base_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
273 typedef ci::LazyList< rcu_type
275 ,ci::lazy_list::make_traits<
276 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
277 ,co::less< less<item> >
278 ,ci::opt::disposer< faked_disposer >
282 typedef ci::SplitListSet< rcu_type, ord_list,
283 ci::split_list::make_traits<
285 ,ci::split_list::dynamic_bucket_table<false>
286 ,co::memory_model<co::v::sequential_consistent>
289 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
294 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix_lazy()
296 typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
297 typedef ci::LazyList< rcu_type
299 ,ci::lazy_list::make_traits<
300 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
301 ,co::less< less<item> >
302 ,co::compare< cmp<item> >
303 ,ci::opt::disposer< faked_disposer >
307 typedef ci::SplitListSet< rcu_type, ord_list,
308 ci::split_list::make_traits<
310 ,co::item_counter< simple_item_counter >
311 ,ci::split_list::dynamic_bucket_table<false>
314 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
319 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix_stat_lazy()
321 typedef base_int_item< ci::split_list::node<ci::lazy_list::node<rcu_type> > > item;
322 typedef ci::LazyList< rcu_type
324 ,ci::lazy_list::make_traits<
325 ci::opt::hook< ci::lazy_list::base_hook< co::gc<rcu_type> > >
326 ,co::less< less<item> >
327 ,co::compare< cmp<item> >
328 ,ci::opt::disposer< faked_disposer >
332 typedef ci::SplitListSet< rcu_type, ord_list,
333 ci::split_list::make_traits<
335 ,co::item_counter< simple_item_counter >
336 ,ci::split_list::dynamic_bucket_table<false>
337 ,co::stat< ci::split_list::stat<>>
340 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
345 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmp_lazy()
347 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
348 typedef ci::LazyList< rcu_type
350 ,ci::lazy_list::make_traits<
351 ci::opt::hook< ci::lazy_list::member_hook<
352 offsetof( item, hMember ),
355 ,co::compare< cmp<item> >
356 ,ci::opt::disposer< faked_disposer >
360 typedef ci::SplitListSet< rcu_type, ord_list,
361 ci::split_list::make_traits<
363 ,ci::split_list::dynamic_bucket_table<false>
364 ,co::memory_model<co::v::relaxed_ordering>
367 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
372 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_less_lazy()
374 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
375 typedef ci::LazyList< rcu_type
377 ,ci::lazy_list::make_traits<
378 ci::opt::hook< ci::lazy_list::member_hook<
379 offsetof( item, hMember ),
382 ,co::less< less<item> >
383 ,ci::opt::disposer< faked_disposer >
387 typedef ci::SplitListSet< rcu_type, ord_list,
388 ci::split_list::make_traits<
389 ci::split_list::dynamic_bucket_table<false>
390 ,co::hash< hash_int >
391 ,co::memory_model<co::v::sequential_consistent>
394 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
399 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix_lazy()
401 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
402 typedef ci::LazyList< rcu_type
404 ,ci::lazy_list::make_traits<
405 ci::opt::hook< ci::lazy_list::member_hook<
406 offsetof( item, hMember ),
409 ,co::compare< cmp<item> >
410 ,co::less< less<item> >
411 ,ci::opt::disposer< faked_disposer >
415 typedef ci::SplitListSet< rcu_type, ord_list,
416 ci::split_list::make_traits<
418 ,co::item_counter< simple_item_counter >
419 ,ci::split_list::dynamic_bucket_table<false>
422 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
427 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix_stat_lazy()
429 typedef member_int_item< ci::split_list::node< ci::lazy_list::node<rcu_type> > > item;
430 typedef ci::LazyList< rcu_type
432 ,ci::lazy_list::make_traits<
433 ci::opt::hook< ci::lazy_list::member_hook<
434 offsetof( item, hMember ),
437 ,co::compare< cmp<item> >
438 ,co::less< less<item> >
439 ,ci::opt::disposer< faked_disposer >
443 typedef ci::SplitListSet< rcu_type, ord_list,
444 ci::split_list::make_traits<
446 ,co::item_counter< simple_item_counter >
447 ,ci::split_list::dynamic_bucket_table<false>
448 ,co::stat< ci::split_list::stat<>>
451 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );