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_instant.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_instant<> > rcu_type;
41 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_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_GPI_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_GPI_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_GPI_member_cmp()
115 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
116 typedef ci::MichaelList< rcu_type
118 ,ci::michael_list::make_traits<
119 ci::opt::hook< ci::michael_list::member_hook<
120 offsetof( item, hMember ),
123 ,co::compare< cmp<item> >
124 ,ci::opt::disposer< faked_disposer >
128 typedef ci::SplitListSet< rcu_type, ord_list,
129 ci::split_list::make_traits<
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_GPI_member_less()
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::less< less<item> >
149 ,ci::opt::disposer< faked_disposer >
153 typedef ci::SplitListSet< rcu_type, ord_list,
154 ci::split_list::make_traits<
156 ,co::memory_model<co::v::relaxed_ordering>
159 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
161 test_rcu_int_michael_list<set>();
164 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_member_cmpmix()
166 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
167 typedef ci::MichaelList< rcu_type
169 ,ci::michael_list::make_traits<
170 ci::opt::hook< ci::michael_list::member_hook<
171 offsetof( item, hMember ),
174 ,co::compare< cmp<item> >
175 ,co::less< less<item> >
176 ,ci::opt::disposer< faked_disposer >
180 typedef ci::SplitListSet< rcu_type, ord_list,
181 ci::split_list::make_traits<
183 ,co::item_counter< simple_item_counter >
184 ,co::memory_model<co::v::sequential_consistent>
187 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
189 test_rcu_int_michael_list<set>();
193 // Static bucket table
194 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_base_cmp()
196 typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
197 typedef ci::MichaelList< rcu_type
199 ,ci::michael_list::make_traits<
200 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
201 ,co::compare< cmp<item> >
202 ,ci::opt::disposer< faked_disposer >
206 typedef ci::SplitListSet< rcu_type, ord_list,
207 ci::split_list::make_traits<
209 ,ci::split_list::dynamic_bucket_table<false>
210 ,co::memory_model<co::v::relaxed_ordering>
213 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
215 test_rcu_int_michael_list<set>();
218 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_base_less()
220 typedef base_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
221 typedef ci::MichaelList< rcu_type
223 ,ci::michael_list::make_traits<
224 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
225 ,co::less< less<item> >
226 ,ci::opt::disposer< faked_disposer >
230 typedef ci::SplitListSet< rcu_type, ord_list,
231 ci::split_list::make_traits<
233 ,ci::split_list::dynamic_bucket_table<false>
234 ,co::memory_model<co::v::sequential_consistent>
237 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
239 test_rcu_int_michael_list<set>();
242 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_base_cmpmix()
244 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
245 typedef ci::MichaelList< rcu_type
247 ,ci::michael_list::make_traits<
248 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
249 ,co::less< less<item> >
250 ,co::compare< cmp<item> >
251 ,ci::opt::disposer< faked_disposer >
255 typedef ci::SplitListSet< rcu_type, ord_list,
256 ci::split_list::make_traits<
258 ,co::item_counter< simple_item_counter >
259 ,ci::split_list::dynamic_bucket_table<false>
262 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
264 test_rcu_int_michael_list<set>();
267 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_member_cmp()
269 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
270 typedef ci::MichaelList< rcu_type
272 ,ci::michael_list::make_traits<
273 ci::opt::hook< ci::michael_list::member_hook<
274 offsetof( item, hMember ),
277 ,co::compare< cmp<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::relaxed_ordering>
289 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
291 test_rcu_int_michael_list<set>();
294 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_member_less()
296 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
297 typedef ci::MichaelList< rcu_type
299 ,ci::michael_list::make_traits<
300 ci::opt::hook< ci::michael_list::member_hook<
301 offsetof( item, hMember ),
304 ,co::less< less<item> >
305 ,ci::opt::disposer< faked_disposer >
309 typedef ci::SplitListSet< rcu_type, ord_list,
310 ci::split_list::make_traits<
311 ci::split_list::dynamic_bucket_table<false>
312 ,co::hash< hash_int >
313 ,co::memory_model<co::v::sequential_consistent>
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_GPI_member_cmpmix()
323 typedef member_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::member_hook<
328 offsetof( item, hMember ),
331 ,co::compare< cmp<item> >
332 ,co::less< less<item> >
333 ,ci::opt::disposer< faked_disposer >
337 typedef ci::SplitListSet< rcu_type, ord_list,
338 ci::split_list::make_traits<
340 ,co::item_counter< simple_item_counter >
341 ,ci::split_list::dynamic_bucket_table<false>
344 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
346 test_rcu_int_michael_list<set>();
349 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_base_cmpmix_stat()
351 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
352 struct list_traits : public ci::michael_list::traits
354 typedef ci::michael_list::base_hook< co::gc<rcu_type> > hook;
355 typedef IntrusiveHashSetHdrTest::less<item> less;
356 typedef cmp<item> compare;
357 typedef faked_disposer disposer;
359 typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
361 struct set_traits : public ci::split_list::make_traits<ci::split_list::dynamic_bucket_table<true> >::type
363 typedef hash_int hash;
364 typedef simple_item_counter item_counter;
365 typedef ci::split_list::stat<> stat;
367 typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
369 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
371 test_rcu_int_michael_list<set>();
374 void IntrusiveHashSetHdrTest::split_dyn_RCU_GPI_member_cmpmix_stat()
376 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
378 public ci::michael_list::make_traits<
379 ci::opt::hook< ci::michael_list::member_hook<
380 offsetof( item, hMember ),
383 ,co::compare< cmp<item> >
384 ,co::less< less<item> >
385 ,ci::opt::disposer< faked_disposer >
388 typedef ci::MichaelList< rcu_type, item, list_traits > ord_list;
391 public ci::split_list::make_traits<
393 ,co::item_counter< simple_item_counter >
394 ,co::memory_model<co::v::sequential_consistent>
395 ,co::stat< ci::split_list::stat<>>
398 typedef ci::SplitListSet< rcu_type, ord_list, set_traits > set;
399 static_assert( set::traits::dynamic_bucket_table, "Set has static bucket table" );
401 test_rcu_int_michael_list<set>();
404 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_base_cmpmix_stat()
406 typedef base_int_item< ci::split_list::node<ci::michael_list::node<rcu_type> > > item;
407 typedef ci::MichaelList< rcu_type
409 ,ci::michael_list::make_traits<
410 ci::opt::hook< ci::michael_list::base_hook< co::gc<rcu_type> > >
411 ,co::less< less<item> >
412 ,co::compare< cmp<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>
422 ,co::stat< ci::split_list::stat<>>
425 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
427 test_rcu_int_michael_list<set>();
430 void IntrusiveHashSetHdrTest::split_st_RCU_GPI_member_cmpmix_stat()
432 typedef member_int_item< ci::split_list::node< ci::michael_list::node<rcu_type> > > item;
433 typedef ci::MichaelList< rcu_type
435 ,ci::michael_list::make_traits<
436 ci::opt::hook< ci::michael_list::member_hook<
437 offsetof( item, hMember ),
440 ,co::compare< cmp<item> >
441 ,co::less< less<item> >
442 ,ci::opt::disposer< faked_disposer >
446 typedef ci::SplitListSet< rcu_type, ord_list,
447 ci::split_list::make_traits<
449 ,co::item_counter< simple_item_counter >
450 ,ci::split_list::dynamic_bucket_table<false>
451 ,co::stat< ci::split_list::stat<> >
454 static_assert( !set::traits::dynamic_bucket_table, "Set has dynamic bucket table" );
456 test_rcu_int_michael_list<set>();