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/michael_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()
43 typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
44 typedef ci::MichaelList < rcu_type
46 , ci::michael_list::make_traits <
47 ci::opt::hook< ci::michael_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");
62 test_rcu_int_michael_list<set>();
65 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_less()
67 typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
68 typedef ci::MichaelList < rcu_type
70 , ci::michael_list::make_traits <
71 ci::opt::hook< ci::michael_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");
85 test_rcu_int_michael_list<set>();
88 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmpmix()
90 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
91 typedef ci::MichaelList < rcu_type
93 , ci::michael_list::make_traits <
94 ci::opt::hook< ci::michael_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");
110 test_rcu_int_michael_list<set>();
113 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_base_cmpmix_stat()
115 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
116 struct list_traits : public ci::michael_list::traits
118 typedef ci::michael_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::MichaelList< 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;
133 static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
135 test_rcu_int_michael_list<set>();
138 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmp()
140 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
141 typedef ci::MichaelList < rcu_type
143 , ci::michael_list::make_traits <
144 ci::opt::hook< ci::michael_list::member_hook <
145 offsetof( item, hMember ),
148 , co::compare< cmp<item> >
149 , ci::opt::disposer < faked_disposer >
153 typedef ci::SplitListSet < rcu_type, ord_list,
154 ci::split_list::make_traits <
155 co::hash < hash_int >
158 static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
160 test_rcu_int_michael_list<set>();
163 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_less()
165 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
166 typedef ci::MichaelList < rcu_type
168 , ci::michael_list::make_traits <
169 ci::opt::hook< ci::michael_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::relaxed_ordering >
184 static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
186 test_rcu_int_michael_list<set>();
189 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix()
191 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
192 typedef ci::MichaelList < rcu_type
194 , ci::michael_list::make_traits <
195 ci::opt::hook< ci::michael_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 >
209 , co::memory_model < co::v::sequential_consistent >
212 static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
214 test_rcu_int_michael_list<set>();
217 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPB_member_cmpmix_stat()
219 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
221 public ci::michael_list::make_traits <
222 ci::opt::hook< ci::michael_list::member_hook <
223 offsetof( item, hMember ),
226 , co::compare< cmp<item> >
227 , co::less< less<item> >
228 , ci::opt::disposer < faked_disposer >
231 typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
234 public ci::split_list::make_traits <
236 , co::item_counter< simple_item_counter >
237 , co::memory_model<co::v::sequential_consistent>
238 , co::stat < ci::split_list::stat<> >
241 typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
242 static_assert(set::traits::dynamic_bucket_table, "Set has static bucket table");
244 test_rcu_int_michael_list<set>();
247 // Static bucket table
248 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmp()
250 typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
251 typedef ci::MichaelList < rcu_type
253 , ci::michael_list::make_traits <
254 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
255 , co::compare< cmp<item> >
256 , ci::opt::disposer < faked_disposer >
260 typedef ci::SplitListSet < rcu_type, ord_list,
261 ci::split_list::make_traits <
263 , ci::split_list::dynamic_bucket_table<false>
264 , co::memory_model < co::v::relaxed_ordering >
267 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
269 test_rcu_int_michael_list<set>();
272 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_less()
274 typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
275 typedef ci::MichaelList < rcu_type
277 , ci::michael_list::make_traits <
278 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
279 , co::less< less<item> >
280 , ci::opt::disposer < faked_disposer >
284 typedef ci::SplitListSet < rcu_type, ord_list,
285 ci::split_list::make_traits <
287 , ci::split_list::dynamic_bucket_table<false>
288 , co::memory_model < co::v::sequential_consistent >
291 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
293 test_rcu_int_michael_list<set>();
296 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix()
298 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
299 typedef ci::MichaelList < rcu_type
301 , ci::michael_list::make_traits <
302 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
303 , co::less< less<item> >
304 , co::compare< cmp<item> >
305 , ci::opt::disposer < faked_disposer >
309 typedef ci::SplitListSet < rcu_type, ord_list,
310 ci::split_list::make_traits <
312 , co::item_counter< simple_item_counter >
313 , ci::split_list::dynamic_bucket_table < false >
316 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
318 test_rcu_int_michael_list<set>();
321 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_base_cmpmix_stat()
323 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
324 typedef ci::MichaelList < rcu_type
326 , ci::michael_list::make_traits <
327 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
328 , co::less< less<item> >
329 , co::compare< cmp<item> >
330 , ci::opt::disposer < faked_disposer >
334 typedef ci::SplitListSet < rcu_type, ord_list,
335 ci::split_list::make_traits <
337 , co::item_counter< simple_item_counter >
338 , ci::split_list::dynamic_bucket_table<false>
339 , co::stat < ci::split_list::stat<> >
342 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
344 test_rcu_int_michael_list<set>();
347 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmp()
349 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
350 typedef ci::MichaelList < rcu_type
352 , ci::michael_list::make_traits <
353 ci::opt::hook< ci::michael_list::member_hook <
354 offsetof( item, hMember ),
357 , co::compare< cmp<item> >
358 , ci::opt::disposer < faked_disposer >
362 typedef ci::SplitListSet < rcu_type, ord_list,
363 ci::split_list::make_traits <
365 , ci::split_list::dynamic_bucket_table<false>
366 , co::memory_model < co::v::relaxed_ordering >
369 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
371 test_rcu_int_michael_list<set>();
374 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_less()
376 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
377 typedef ci::MichaelList < rcu_type
379 , ci::michael_list::make_traits <
380 ci::opt::hook< ci::michael_list::member_hook <
381 offsetof( item, hMember ),
384 , co::less< less<item> >
385 , ci::opt::disposer < faked_disposer >
389 typedef ci::SplitListSet < rcu_type, ord_list,
390 ci::split_list::make_traits <
391 ci::split_list::dynamic_bucket_table<false>
392 , co::hash< hash_int >
393 , co::memory_model < co::v::sequential_consistent >
396 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
398 test_rcu_int_michael_list<set>();
401 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix()
403 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
404 typedef ci::MichaelList < rcu_type
406 , ci::michael_list::make_traits <
407 ci::opt::hook< ci::michael_list::member_hook <
408 offsetof( item, hMember ),
411 , co::compare< cmp<item> >
412 , co::less< less<item> >
413 , ci::opt::disposer < faked_disposer >
417 typedef ci::SplitListSet < rcu_type, ord_list,
418 ci::split_list::make_traits <
420 , co::item_counter< simple_item_counter >
421 , ci::split_list::dynamic_bucket_table < false >
424 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
426 test_rcu_int_michael_list<set>();
429 void IntrusiveHashSetHdrTest::split_st_RCU_GPB_member_cmpmix_stat()
431 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
432 typedef ci::MichaelList < rcu_type
434 , ci::michael_list::make_traits <
435 ci::opt::hook< ci::michael_list::member_hook <
436 offsetof( item, hMember ),
439 , co::compare< cmp<item> >
440 , co::less< less<item> >
441 , ci::opt::disposer < faked_disposer >
445 typedef ci::SplitListSet < rcu_type, ord_list,
446 ci::split_list::make_traits <
448 , co::item_counter< simple_item_counter >
449 , ci::split_list::dynamic_bucket_table<false>
450 , co::stat < ci::split_list::stat<> >
453 static_assert(!set::traits::dynamic_bucket_table, "Set has dynamic bucket table");
455 test_rcu_int_michael_list<set>();