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/intrusive/michael_list_nogc.h>
33 #include <cds/intrusive/split_list_nogc.h>
37 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmp()
39 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
40 typedef ci::MichaelList< cds::gc::nogc
42 ,ci::michael_list::make_traits<
43 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
44 ,co::compare< cmp<item> >
45 ,ci::opt::disposer< faked_disposer >
49 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
50 ci::split_list::make_traits<
52 ,ci::split_list::dynamic_bucket_table<true>
53 ,co::memory_model<co::v::relaxed_ordering>
60 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_less()
62 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
63 typedef ci::MichaelList< cds::gc::nogc
65 ,ci::michael_list::make_traits<
66 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
67 ,co::less< less<item> >
68 ,ci::opt::disposer< faked_disposer >
72 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
73 ci::split_list::make_traits<
75 ,ci::split_list::dynamic_bucket_table<true>
76 ,co::memory_model<co::v::sequential_consistent>
83 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmpmix()
85 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
86 typedef ci::MichaelList< cds::gc::nogc
88 ,ci::michael_list::make_traits<
89 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
90 ,co::less< less<item> >
91 ,co::compare< cmp<item> >
92 ,ci::opt::disposer< faked_disposer >
96 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
97 ci::split_list::make_traits<
99 ,co::item_counter< simple_item_counter >
100 ,ci::split_list::dynamic_bucket_table<true>
104 test_int_nogc<set>();
107 void IntrusiveHashSetHdrTest::split_dyn_nogc_base_cmpmix_stat()
109 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
110 struct list_traits : public ci::michael_list::traits
112 typedef ci::michael_list::base_hook< co::gc<cds::gc::nogc> > hook;
113 typedef cmp<item> compare;
114 typedef IntrusiveHashSetHdrTest::less<item> less;
115 typedef faked_disposer disposer;
117 typedef ci::MichaelList< cds::gc::nogc, item, list_traits > bucket_type;
119 struct set_traits : public ci::split_list::make_traits< ci::split_list::dynamic_bucket_table<true> >::type
121 typedef hash_int hash;
122 typedef simple_item_counter item_counter;
123 typedef ci::split_list::stat<> stat;
125 typedef ci::SplitListSet< cds::gc::nogc, bucket_type, set_traits > set;
127 test_int_nogc<set>();
130 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmp()
132 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
133 typedef ci::MichaelList< cds::gc::nogc
135 ,ci::michael_list::make_traits<
136 ci::opt::hook< ci::michael_list::member_hook<
137 offsetof( item, hMember ),
138 co::gc<cds::gc::nogc>
140 ,co::compare< cmp<item> >
141 ,ci::opt::disposer< faked_disposer >
145 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
146 ci::split_list::make_traits<
148 ,ci::split_list::dynamic_bucket_table<true>
149 ,co::memory_model<co::v::relaxed_ordering>
153 test_int_nogc<set>();
156 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_less()
158 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
159 typedef ci::MichaelList< cds::gc::nogc
161 ,ci::michael_list::make_traits<
162 ci::opt::hook< ci::michael_list::member_hook<
163 offsetof( item, hMember ),
164 co::gc<cds::gc::nogc>
166 ,co::less< less<item> >
167 ,ci::opt::disposer< faked_disposer >
171 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
172 ci::split_list::make_traits<
174 ,ci::split_list::dynamic_bucket_table<true>
175 ,co::memory_model<co::v::sequential_consistent>
179 test_int_nogc<set>();
182 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmpmix()
184 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
185 typedef ci::MichaelList< cds::gc::nogc
187 ,ci::michael_list::make_traits<
188 ci::opt::hook< ci::michael_list::member_hook<
189 offsetof( item, hMember ),
190 co::gc<cds::gc::nogc>
192 ,co::compare< cmp<item> >
193 ,co::less< less<item> >
194 ,ci::opt::disposer< faked_disposer >
198 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
199 ci::split_list::make_traits<
201 ,co::item_counter< simple_item_counter >
202 ,ci::split_list::dynamic_bucket_table<true>
206 test_int_nogc<set>();
209 void IntrusiveHashSetHdrTest::split_dyn_nogc_member_cmpmix_stat()
211 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
213 public ci::michael_list::make_traits<
214 ci::opt::hook< ci::michael_list::member_hook<
215 offsetof( item, hMember ),
216 co::gc<cds::gc::nogc>
218 ,co::compare< cmp<item> >
219 ,co::less< less<item> >
220 ,ci::opt::disposer< faked_disposer >
223 typedef ci::MichaelList< cds::gc::nogc, item, list_traits > bucket_type;
226 public ci::split_list::make_traits<
228 ,co::item_counter< simple_item_counter >
229 ,ci::split_list::dynamic_bucket_table<true>
230 ,co::stat< ci::split_list::stat<> >
233 typedef ci::SplitListSet< cds::gc::nogc, bucket_type, set_traits > set;
235 test_int_nogc<set>();
238 // Static bucket table
239 void IntrusiveHashSetHdrTest::split_st_nogc_base_cmp()
241 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
242 typedef ci::MichaelList< cds::gc::nogc
244 ,ci::michael_list::make_traits<
245 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
246 ,co::compare< cmp<item> >
247 ,ci::opt::disposer< faked_disposer >
251 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
252 ci::split_list::make_traits<
254 ,ci::split_list::dynamic_bucket_table<false>
255 ,co::memory_model<co::v::relaxed_ordering>
259 test_int_nogc<set>();
262 void IntrusiveHashSetHdrTest::split_st_nogc_base_less()
264 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
265 typedef ci::MichaelList< cds::gc::nogc
267 ,ci::michael_list::make_traits<
268 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
269 ,co::less< less<item> >
270 ,ci::opt::disposer< faked_disposer >
274 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
275 ci::split_list::make_traits<
277 ,ci::split_list::dynamic_bucket_table<false>
278 ,co::memory_model<co::v::sequential_consistent>
282 test_int_nogc<set>();
285 void IntrusiveHashSetHdrTest::split_st_nogc_base_cmpmix()
287 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
288 typedef ci::MichaelList< cds::gc::nogc
290 ,ci::michael_list::make_traits<
291 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
292 ,co::less< less<item> >
293 ,co::compare< cmp<item> >
294 ,ci::opt::disposer< faked_disposer >
298 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
299 ci::split_list::make_traits<
301 ,co::item_counter< simple_item_counter >
302 ,ci::split_list::dynamic_bucket_table<false>
306 test_int_nogc<set>();
309 void IntrusiveHashSetHdrTest::split_st_nogc_base_cmpmix_stat()
311 typedef base_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
312 typedef ci::MichaelList< cds::gc::nogc
314 ,ci::michael_list::make_traits<
315 ci::opt::hook< ci::michael_list::base_hook< co::gc<cds::gc::nogc> > >
316 ,co::less< less<item> >
317 ,co::compare< cmp<item> >
318 ,ci::opt::disposer< faked_disposer >
322 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
323 ci::split_list::make_traits<
325 ,co::item_counter< simple_item_counter >
326 ,ci::split_list::dynamic_bucket_table<false>
327 ,co::stat< ci::split_list::stat<> >
331 test_int_nogc<set>();
334 void IntrusiveHashSetHdrTest::split_st_nogc_member_cmp()
336 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
337 typedef ci::MichaelList< cds::gc::nogc
339 ,ci::michael_list::make_traits<
340 ci::opt::hook< ci::michael_list::member_hook<
341 offsetof( item, hMember ),
342 co::gc<cds::gc::nogc>
344 ,co::compare< cmp<item> >
345 ,ci::opt::disposer< faked_disposer >
349 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
350 ci::split_list::make_traits<
352 ,ci::split_list::dynamic_bucket_table<false>
353 ,co::memory_model<co::v::sequential_consistent>
357 test_int_nogc<set>();
360 void IntrusiveHashSetHdrTest::split_st_nogc_member_less()
362 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
363 typedef ci::MichaelList< cds::gc::nogc
365 ,ci::michael_list::make_traits<
366 ci::opt::hook< ci::michael_list::member_hook<
367 offsetof( item, hMember ),
368 co::gc<cds::gc::nogc>
370 ,co::less< less<item> >
371 ,ci::opt::disposer< faked_disposer >
375 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
376 ci::split_list::make_traits<
378 ,ci::split_list::dynamic_bucket_table<false>
379 ,co::memory_model<co::v::relaxed_ordering>
383 test_int_nogc<set>();
386 void IntrusiveHashSetHdrTest::split_st_nogc_member_cmpmix()
388 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
389 typedef ci::MichaelList< cds::gc::nogc
391 ,ci::michael_list::make_traits<
392 ci::opt::hook< ci::michael_list::member_hook<
393 offsetof( item, hMember ),
394 co::gc<cds::gc::nogc>
396 ,co::compare< cmp<item> >
397 ,co::less< less<item> >
398 ,ci::opt::disposer< faked_disposer >
402 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
403 ci::split_list::make_traits<
405 ,co::item_counter< simple_item_counter >
406 ,ci::split_list::dynamic_bucket_table<false>
410 test_int_nogc<set>();
413 void IntrusiveHashSetHdrTest::split_st_nogc_member_cmpmix_stat()
415 typedef member_int_item< ci::split_list::node< ci::michael_list::node<cds::gc::nogc> > > item;
416 typedef ci::MichaelList< cds::gc::nogc
418 ,ci::michael_list::make_traits<
419 ci::opt::hook< ci::michael_list::member_hook<
420 offsetof( item, hMember ),
421 co::gc<cds::gc::nogc>
423 ,co::compare< cmp<item> >
424 ,co::less< less<item> >
425 ,ci::opt::disposer< faked_disposer >
429 typedef ci::SplitListSet< cds::gc::nogc, bucket_type,
430 ci::split_list::make_traits<
432 ,co::item_counter< simple_item_counter >
433 ,ci::split_list::dynamic_bucket_table<false>
434 ,co::stat< ci::split_list::stat<> >
438 test_int_nogc<set>();