From cbcae1a58183d30196703c396ade486c447f4adb Mon Sep 17 00:00:00 2001 From: khizmax Date: Thu, 23 Oct 2014 18:16:01 +0400 Subject: [PATCH] remove LazyList specializations --- cds/container/impl/lazy_kvlist.h | 3 +- cds/container/impl/lazy_list.h | 2 +- cds/container/lazy_kvlist_hrc.h | 11 -- cds/container/lazy_list_hrc.h | 11 -- cds/intrusive/impl/lazy_list.h | 3 +- cds/intrusive/lazy_list_hrc.h | 152 ------------------ projects/Win/vc12/cds.vcxproj | 3 - projects/Win/vc12/cds.vcxproj.filters | 9 -- .../Win/vc12/hdr-test-ordered-list.vcxproj | 3 - .../hdr-test-ordered-list.vcxproj.filters | 9 -- .../ordered_list/hdr_intrusive_lazy.h | 10 -- .../ordered_list/hdr_intrusive_lazy_hrc.cpp | 64 -------- tests/test-hdr/ordered_list/hdr_lazy.h | 10 -- tests/test-hdr/ordered_list/hdr_lazy_hrc.cpp | 100 ------------ tests/test-hdr/ordered_list/hdr_lazy_kv.h | 10 -- .../test-hdr/ordered_list/hdr_lazy_kv_hrc.cpp | 100 ------------ 16 files changed, 3 insertions(+), 497 deletions(-) delete mode 100644 cds/container/lazy_kvlist_hrc.h delete mode 100644 cds/container/lazy_list_hrc.h delete mode 100644 cds/intrusive/lazy_list_hrc.h delete mode 100644 tests/test-hdr/ordered_list/hdr_intrusive_lazy_hrc.cpp delete mode 100644 tests/test-hdr/ordered_list/hdr_lazy_hrc.cpp delete mode 100644 tests/test-hdr/ordered_list/hdr_lazy_kv_hrc.cpp diff --git a/cds/container/impl/lazy_kvlist.h b/cds/container/impl/lazy_kvlist.h index 6bd64468..4eece5c9 100644 --- a/cds/container/impl/lazy_kvlist.h +++ b/cds/container/impl/lazy_kvlist.h @@ -77,7 +77,6 @@ namespace cds { namespace container { You should include appropriate .h-file depending on GC you are using: - for gc::HP: \code #include \endcode - for gc::PTB: \code #include \endcode - - for gc::HRC: \code #include \endcode - for \ref cds_urcu_desc "RCU": \code #include \endcode - for gc::nogc: \code #include \endcode */ @@ -272,7 +271,7 @@ namespace cds { namespace container { The forward iterator for lazy list has some features: - it has no post-increment operator - to protect the value, the iterator contains a GC-specific guard + another guard is required locally for increment operator. - For some GC (gc::HP, gc::HRC), a guard is limited resource per thread, so an exception (or assertion) "no free guard" + For some GC (\p gc::HP), a guard is limited resource per thread, so an exception (or assertion) "no free guard" may be thrown if a limit of guard count per thread is exceeded. - The iterator cannot be moved across thread boundary since it contains GC's guard that is thread-private GC data. - Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent diff --git a/cds/container/impl/lazy_list.h b/cds/container/impl/lazy_list.h index 783e08d7..fd8a56c9 100644 --- a/cds/container/impl/lazy_list.h +++ b/cds/container/impl/lazy_list.h @@ -265,7 +265,7 @@ namespace cds { namespace container { The forward iterator for lazy list has some features: - it has no post-increment operator - to protect the value, the iterator contains a GC-specific guard + another guard is required locally for increment operator. - For some GC (gc::HP, gc::HRC), a guard is limited resource per thread, so an exception (or assertion) "no free guard" + For some GC (\p gc::HP), a guard is limited resource per thread, so an exception (or assertion) "no free guard" may be thrown if a limit of guard count per thread is exceeded. - The iterator cannot be moved across thread boundary since it contains GC's guard that is thread-private GC data. - Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent diff --git a/cds/container/lazy_kvlist_hrc.h b/cds/container/lazy_kvlist_hrc.h deleted file mode 100644 index 0e6a8268..00000000 --- a/cds/container/lazy_kvlist_hrc.h +++ /dev/null @@ -1,11 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDS_CONTAINER_LAZY_KVLIST_HRC_H -#define __CDS_CONTAINER_LAZY_KVLIST_HRC_H - -#include -#include -#include -#include - -#endif // #ifndef __CDS_CONTAINER_LAZY_KVLIST_HRC_H diff --git a/cds/container/lazy_list_hrc.h b/cds/container/lazy_list_hrc.h deleted file mode 100644 index 0a6b023a..00000000 --- a/cds/container/lazy_list_hrc.h +++ /dev/null @@ -1,11 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDS_CONTAINER_LAZY_LIST_HRC_H -#define __CDS_CONTAINER_LAZY_LIST_HRC_H - -#include -#include -#include -#include - -#endif // #ifndef __CDS_CONTAINER_LAZY_LIST_HRC_H diff --git a/cds/intrusive/impl/lazy_list.h b/cds/intrusive/impl/lazy_list.h index 4c302892..1e60ecbf 100644 --- a/cds/intrusive/impl/lazy_list.h +++ b/cds/intrusive/impl/lazy_list.h @@ -90,7 +90,6 @@ namespace cds { namespace intrusive { You should select GC needed and include appropriate .h-file: - for gc::HP: \code #include \endcode - for gc::PTB: \code #include \endcode - - for gc::HRC: \code #include \endcode - for gc::nogc: \code #include \endcode - for \ref cds_urcu_type "RCU" - see \ref cds_intrusive_LazyList_rcu "LazyList RCU specialization" @@ -441,7 +440,7 @@ namespace cds { namespace intrusive { The forward iterator for lazy list has some features: - it has no post-increment operator - to protect the value, the iterator contains a GC-specific guard + another guard is required locally for increment operator. - For some GC (gc::HP, gc::HRC), a guard is limited resource per thread, so an exception (or assertion) "no free guard" + For some GC (\p gc::HP), a guard is limited resource per thread, so an exception (or assertion) "no free guard" may be thrown if a limit of guard count per thread is exceeded. - The iterator cannot be moved across thread boundary since it contains GC's guard that is thread-private GC data. - Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent diff --git a/cds/intrusive/lazy_list_hrc.h b/cds/intrusive/lazy_list_hrc.h deleted file mode 100644 index 8d8310fc..00000000 --- a/cds/intrusive/lazy_list_hrc.h +++ /dev/null @@ -1,152 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDS_INTRUSIVE_LAZY_LIST_HRC_H -#define __CDS_INTRUSIVE_LAZY_LIST_HRC_H - -#include -#include -#include - -namespace cds { namespace intrusive { namespace lazy_list { - //@cond - // Specialization for HRC GC - template - struct node< gc::HRC, Lock, Tag>: public gc::HRC::container_node - { - typedef gc::HRC gc ; ///< Garbage collector - typedef Lock lock_type ; ///< Lock type - typedef Tag tag ; ///< tag - - typedef cds::details::marked_ptr marked_ptr ; ///< marked pointer - typedef typename gc::template atomic_marked_ptr< marked_ptr> atomic_marked_ptr ; ///< atomic marked pointer specific for GC - - atomic_marked_ptr m_pNext ; ///< pointer to the next node in the list + logical deletion mark - mutable lock_type m_Lock ; ///< Node lock - - /// Checks if node is marked - bool is_marked() const - { - return m_pNext.load(atomics::memory_order_relaxed).bits() != 0; - } - - node() - : m_pNext( nullptr ) - {} - - protected: - virtual void cleanUp( cds::gc::hrc::ThreadGC * pGC ) - { - assert( pGC != nullptr ); - typename gc::GuardArray<2> aGuards( *pGC ); - - while ( true ) { - marked_ptr pNextMarked( aGuards.protect( 0, m_pNext )); - node * pNext = pNextMarked.ptr(); - if ( pNext != nullptr && pNext->m_bDeleted.load( atomics::memory_order_acquire ) ) { - marked_ptr p = aGuards.protect( 1, pNext->m_pNext ); - m_pNext.compare_exchange_weak( pNextMarked, p, atomics::memory_order_acquire, atomics::memory_order_relaxed ); - continue; - } - else { - break; - } - } - } - - virtual void terminate( cds::gc::hrc::ThreadGC * pGC, bool bConcurrent ) - { - if ( bConcurrent ) { - marked_ptr pNext( m_pNext.load(atomics::memory_order_relaxed)); - do {} while ( !m_pNext.compare_exchange_weak( pNext, marked_ptr(), atomics::memory_order_release, atomics::memory_order_relaxed ) ); - } - else { - m_pNext.store( marked_ptr(), atomics::memory_order_relaxed ); - } - } - }; - //@endcond - - //@cond - template - class boundary_nodes< gc::HRC, NodeType, Alloc > - { - typedef NodeType node_type; - typedef cds::details::Allocator< node_type, Alloc> cxx_allocator ; ///< allocator for the tail node - - struct boundary_disposer - { - void operator()( node_type * p ) - { - cxx_allocator().Delete( p ); - } - }; - - - node_type * m_pHead; - node_type * m_pTail; - - public: - boundary_nodes() - { - m_pHead = cxx_allocator().New(); - m_pTail = cxx_allocator().New(); - } - - ~boundary_nodes() - { - cds::gc::HRC::template retire( m_pHead ); - cds::gc::HRC::template retire( m_pTail ); - } - - public: - node_type * head() - { - return m_pHead; - } - node_type const * head() const - { - return m_pHead; - } - node_type * tail() - { - return m_pTail; - } - node_type const * tail() const - { - return m_pTail; - } - }; - //@endcond - - //@cond - /* - template - struct node_cleaner< gc::HRC, Node, MemoryModel> { - void operator()( Node * p ) - { - typedef typename Node::marked_ptr marked_ptr; - p->m_pNext.store( marked_ptr(), MemoryModel::memory_order_release ); - //p->clean( MemoryModel::memory_order_release ); - } - }; - */ - //@endcond - - - //@cond - template - struct link_checker_selector< gc::HRC, NODE, opt::never_check_link > - { - typedef link_checker type; - }; - - template - struct link_checker_selector< gc::HRC, NODE, opt::debug_check_link > - { - typedef link_checker type; - }; - //@endcond - -}}} // namespace cds::intrusive::lazy_list - -#endif // #ifndef __CDS_INTRUSIVE_LAZY_LIST_HP_H diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 65e5a9d4..6fd1a808 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -932,7 +932,6 @@ - @@ -953,11 +952,9 @@ - - diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index f2a148d0..04886c30 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -542,9 +542,6 @@ Header Files\cds\intrusive - - Header Files\cds\intrusive - Header Files\cds\intrusive @@ -605,9 +602,6 @@ Header Files\cds\container - - Header Files\cds\container - Header Files\cds\container @@ -617,9 +611,6 @@ Header Files\cds\container - - Header Files\cds\container - Header Files\cds\container diff --git a/projects/Win/vc12/hdr-test-ordered-list.vcxproj b/projects/Win/vc12/hdr-test-ordered-list.vcxproj index 42bf92e8..68ac2545 100644 --- a/projects/Win/vc12/hdr-test-ordered-list.vcxproj +++ b/projects/Win/vc12/hdr-test-ordered-list.vcxproj @@ -544,7 +544,6 @@ - @@ -561,9 +560,7 @@ - - diff --git a/projects/Win/vc12/hdr-test-ordered-list.vcxproj.filters b/projects/Win/vc12/hdr-test-ordered-list.vcxproj.filters index 769b3aa0..07fd2c66 100644 --- a/projects/Win/vc12/hdr-test-ordered-list.vcxproj.filters +++ b/projects/Win/vc12/hdr-test-ordered-list.vcxproj.filters @@ -4,9 +4,6 @@ intrusive - - intrusive - intrusive @@ -43,15 +40,9 @@ container - - container - container - - container - container diff --git a/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h b/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h index 0292653d..4af44724 100644 --- a/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h +++ b/tests/test-hdr/ordered_list/hdr_intrusive_lazy.h @@ -744,11 +744,6 @@ namespace ordlist { void PTB_member_cmpmix(); void PTB_member_ic(); - void HRC_base_cmp(); - void HRC_base_less(); - void HRC_base_cmpmix(); - void HRC_base_ic(); - void RCU_GPI_base_cmp(); void RCU_GPI_base_less(); void RCU_GPI_base_cmpmix(); @@ -823,11 +818,6 @@ namespace ordlist { CPPUNIT_TEST(PTB_member_cmpmix) CPPUNIT_TEST(PTB_member_ic) - CPPUNIT_TEST(HRC_base_cmp) - CPPUNIT_TEST(HRC_base_less) - CPPUNIT_TEST(HRC_base_cmpmix) - CPPUNIT_TEST(HRC_base_ic) - CPPUNIT_TEST(RCU_GPI_base_cmp) CPPUNIT_TEST(RCU_GPI_base_less) CPPUNIT_TEST(RCU_GPI_base_cmpmix) diff --git a/tests/test-hdr/ordered_list/hdr_intrusive_lazy_hrc.cpp b/tests/test-hdr/ordered_list/hdr_intrusive_lazy_hrc.cpp deleted file mode 100644 index 865a720c..00000000 --- a/tests/test-hdr/ordered_list/hdr_intrusive_lazy_hrc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//$$CDS-header$$ - -#include "ordered_list/hdr_intrusive_lazy.h" -#include - -namespace ordlist { - - void IntrusiveLazyListHeaderTest::HRC_base_cmp() - { - typedef base_int_item< cds::gc::HRC > item; - typedef ci::LazyList< cds::gc::HRC - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HRC_base_less() - { - typedef base_int_item< cds::gc::HRC > item; - typedef ci::LazyList< cds::gc::HRC - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HRC_base_cmpmix() - { - typedef base_int_item< cds::gc::HRC > item; - typedef ci::LazyList< cds::gc::HRC - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - >::type - > list; - test_int(); - } - void IntrusiveLazyListHeaderTest::HRC_base_ic() - { - typedef base_int_item< cds::gc::HRC > item; - typedef ci::LazyList< cds::gc::HRC - ,item - ,ci::lazy_list::make_traits< - ci::opt::hook< ci::lazy_list::base_hook< co::gc > > - ,co::less< less > - ,co::compare< cmp > - ,ci::opt::disposer< faked_disposer > - ,co::item_counter< cds::atomicity::item_counter > - >::type - > list; - test_int(); - } - -} diff --git a/tests/test-hdr/ordered_list/hdr_lazy.h b/tests/test-hdr/ordered_list/hdr_lazy.h index 177a2d1b..d90476d5 100644 --- a/tests/test-hdr/ordered_list/hdr_lazy.h +++ b/tests/test-hdr/ordered_list/hdr_lazy.h @@ -683,11 +683,6 @@ namespace ordlist { void PTB_cmpmix(); void PTB_ic(); - void HRC_cmp(); - void HRC_less(); - void HRC_cmpmix(); - void HRC_ic(); - void RCU_GPI_cmp(); void RCU_GPI_less(); void RCU_GPI_cmpmix(); @@ -729,11 +724,6 @@ namespace ordlist { CPPUNIT_TEST(PTB_cmpmix) CPPUNIT_TEST(PTB_ic) - CPPUNIT_TEST(HRC_cmp) - CPPUNIT_TEST(HRC_less) - CPPUNIT_TEST(HRC_cmpmix) - CPPUNIT_TEST(HRC_ic) - CPPUNIT_TEST(RCU_GPI_cmp) CPPUNIT_TEST(RCU_GPI_less) CPPUNIT_TEST(RCU_GPI_cmpmix) diff --git a/tests/test-hdr/ordered_list/hdr_lazy_hrc.cpp b/tests/test-hdr/ordered_list/hdr_lazy_hrc.cpp deleted file mode 100644 index 6138fc1f..00000000 --- a/tests/test-hdr/ordered_list/hdr_lazy_hrc.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//$$CDS-header$$ - -#include "ordered_list/hdr_lazy.h" -#include - -namespace ordlist { - namespace { - struct HRC_cmp_traits: public cc::lazy_list::type_traits - { - typedef LazyListTestHeader::cmp compare; - }; - } - void LazyListTestHeader::HRC_cmp() - { - // traits-based version - typedef cc::LazyList< cds::gc::HRC, item, HRC_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HRC, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HRC_less_traits: public cc::lazy_list::type_traits - { - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::HRC_less() - { - // traits-based version - typedef cc::LazyList< cds::gc::HRC, item, HRC_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HRC, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HRC_cmpmix_traits: public cc::lazy_list::type_traits - { - typedef LazyListTestHeader::cmp compare; - typedef LazyListTestHeader::lt less; - }; - } - void LazyListTestHeader::HRC_cmpmix() - { - // traits-based version - typedef cc::LazyList< cds::gc::HRC, item, HRC_cmpmix_traits> list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HRC, item, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HRC_ic_traits: public cc::lazy_list::type_traits - { - typedef LazyListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyListTestHeader::HRC_ic() - { - // traits-based version - typedef cc::LazyList< cds::gc::HRC, item, HRC_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyList< cds::gc::HRC, item, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - diff --git a/tests/test-hdr/ordered_list/hdr_lazy_kv.h b/tests/test-hdr/ordered_list/hdr_lazy_kv.h index f24384bb..76cb0457 100644 --- a/tests/test-hdr/ordered_list/hdr_lazy_kv.h +++ b/tests/test-hdr/ordered_list/hdr_lazy_kv.h @@ -620,11 +620,6 @@ namespace ordlist { void RCU_SHT_cmpmix(); void RCU_SHT_ic(); - void HRC_cmp(); - void HRC_less(); - void HRC_cmpmix(); - void HRC_ic(); - void NOGC_cmp(); void NOGC_less(); void NOGC_cmpmix(); @@ -641,11 +636,6 @@ namespace ordlist { CPPUNIT_TEST(PTB_cmpmix) CPPUNIT_TEST(PTB_ic) - CPPUNIT_TEST(HRC_cmp) - CPPUNIT_TEST(HRC_less) - CPPUNIT_TEST(HRC_cmpmix) - CPPUNIT_TEST(HRC_ic) - CPPUNIT_TEST(RCU_GPI_cmp) CPPUNIT_TEST(RCU_GPI_less) CPPUNIT_TEST(RCU_GPI_cmpmix) diff --git a/tests/test-hdr/ordered_list/hdr_lazy_kv_hrc.cpp b/tests/test-hdr/ordered_list/hdr_lazy_kv_hrc.cpp deleted file mode 100644 index 165070e0..00000000 --- a/tests/test-hdr/ordered_list/hdr_lazy_kv_hrc.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//$$CDS-header$$ - -#include "ordered_list/hdr_lazy_kv.h" -#include - -namespace ordlist { - namespace { - struct HRC_cmp_traits: public cc::lazy_list::type_traits - { - typedef LazyKVListTestHeader::cmp compare; - }; - } - void LazyKVListTestHeader::HRC_cmp() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, HRC_cmp_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HRC_less_traits: public cc::lazy_list::type_traits - { - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::HRC_less() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, HRC_less_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HRC_cmpmix_traits: public cc::lazy_list::type_traits - { - typedef LazyKVListTestHeader::cmp compare; - typedef LazyKVListTestHeader::lt less; - }; - } - void LazyKVListTestHeader::HRC_cmpmix() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, HRC_cmpmix_traits> list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::compare< cmp > - ,cc::opt::less< lt > - >::type - > opt_list; - test< opt_list >(); - } - - namespace { - struct HRC_ic_traits: public cc::lazy_list::type_traits - { - typedef LazyKVListTestHeader::lt less; - typedef cds::atomicity::item_counter item_counter; - }; - } - void LazyKVListTestHeader::HRC_ic() - { - // traits-based version - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, HRC_ic_traits > list; - test< list >(); - - // option-based version - - typedef cc::LazyKVList< cds::gc::HRC, key_type, value_type, - cc::lazy_list::make_traits< - cc::opt::less< lt > - ,cc::opt::item_counter< cds::atomicity::item_counter > - >::type - > opt_list; - test< opt_list >(); - } - -} // namespace ordlist - -- 2.34.1