|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58790 - in sandbox/stm/branches/vbe/boost/stm: . non_tx/detail tx txw
From: vicente.botet_at_[hidden]
Date: 2010-01-07 12:03:17
Author: viboes
Date: 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
New Revision: 58790
URL: http://svn.boost.org/trac/boost/changeset/58790
Log:
TBoost.STM vbe: Manage with Shallow copy
* replace clone by make_cache
* replace cache_deallocate by delete_cache
* Move transaction_object logic to deep_transaction_object
* Move shallow_transaction_object to trivial_transaction_object
* Modify shallow_transaction_object so it uses the Shallow copy constructor and assignment
* Modify transaction_object to inherit from deep_transaction_object, shallow_transaction_object or trivial_transaction_object depending on the class caracteristics.
Added:
sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp (contents, props changed)
Text files modified:
sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp | 8 +-
sandbox/stm/branches/vbe/boost/stm/cache_fct.hpp | 1
sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp | 8 +-
sandbox/stm/branches/vbe/boost/stm/transaction.hpp | 6 +-
sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp | 77 +++++++++++++++++++++---------
sandbox/stm/branches/vbe/boost/stm/tx.hpp | 6 +
sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp | 100 +++++++++++++++++++++++++++++++++++++++
sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp | 33 ++++++++-----
sandbox/stm/branches/vbe/boost/stm/txw/transactional_object.hpp | 13 ++--
9 files changed, 193 insertions(+), 59 deletions(-)
Modified: sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -48,10 +48,10 @@
// transactional objets must specialize the pure virtual functions
// copy_state(base_transaction_object const * const rhs)
// move_state(base_transaction_object * rhs) if BUILD_MOVE_SEMANTICS
-// cache_deallocate()
+// delete_cache()
// copy_state is used to copy the backup/working copy to the shared transactional object when the roolback/commit is done direct/defered policy is used
// move_state is used to move the backup/working copy to the shared transactional object when the roolback/commit is done direct/defered policy is used
-// cache_deallocate is used to release the backup/working copy when the transaction ends if direct/defered policy is used
+// delete_cache is used to release the backup/working copy when the transaction ends if direct/defered policy is used
// when USE_STM_MEMORY_MANAGER is defined this class provides two functions (retrieve_mem and return_mem) and to manage a pool of memory
//-----------------------------------------------------------------------------
@@ -83,7 +83,7 @@
{}
#endif
- virtual base_transaction_object* clone(transaction* t) const = 0;
+ virtual base_transaction_object* make_cache(transaction* t) const = 0;
virtual void copy_state(base_transaction_object const * const rhs) = 0;
#if BUILD_MOVE_SEMANTICS
virtual void move_state(base_transaction_object * rhs) = 0;
@@ -91,7 +91,7 @@
virtual void move_state(base_transaction_object * rhs) {};
#endif
virtual ~base_transaction_object() {};
- virtual void cache_deallocate()=0;
+ virtual void delete_cache()=0;
void transaction_thread(thread_id_t rhs) const { transactionThread_ = rhs; }
thread_id_t const & transaction_thread() const { return transactionThread_; }
Modified: sandbox/stm/branches/vbe/boost/stm/cache_fct.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/cache_fct.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/cache_fct.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -42,7 +42,6 @@
template <class T> void cache_copy(const T* const ori, T* target);
void cache_release(base_transaction_object* ptr);
-//template <class T> inline T* cache_clone_constructor(const T&);
template <class T> T* cache_allocate(transaction*);
template <class T> void cache_deallocate(T*);
Modified: sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx/detail/cache_map.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -76,7 +76,7 @@
}
#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual base_transaction_object* clone(transaction* t) const {
+ virtual base_transaction_object* make_cache(transaction* t) const {
cache<T>* p = cache_allocate<cache<T> >(t);
if (p==0) {
throw std::bad_alloc();
@@ -84,7 +84,7 @@
::new (p) cache<T>(*static_cast<cache<T> const*>(this));
return p;
#else
- virtual base_transaction_object* clone(transaction*) const {
+ virtual base_transaction_object* make_cache(transaction*) const {
cache* p = new cache<T>(*this);
#endif
if (p->value_!=0) {
@@ -94,14 +94,14 @@
}
#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual void cache_deallocate() {
+ virtual void delete_cache() {
delete ptr_;
ptr_=0;
this->~cache<T>();
boost::stm::cache_deallocate(this);
}
#else
- virtual void cache_deallocate() {
+ virtual void delete_cache() {
delete ptr_;
ptr_=0;
delete this;
Modified: sandbox/stm/branches/vbe/boost/stm/transaction.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -982,7 +982,7 @@
}
in.transaction_thread(threadId_);
- writeList().insert(tx_pair((base_transaction_object*)&in, in.clone(this)));
+ writeList().insert(tx_pair((base_transaction_object*)&in, in.make_cache(this)));
#if USE_BLOOM_FILTER
bloom().insert((std::size_t)&in);
#endif
@@ -1203,7 +1203,7 @@
wbloom().set_bv2(bloom().h2());
//sm_wbv().set_bit((size_t)&in % sm_wbv().size());
#endif
- base_transaction_object* returnValue = in.clone(this);
+ base_transaction_object* returnValue = in.make_cache(this);
returnValue->transaction_thread(threadId_);
writeList().insert(tx_pair((base_transaction_object*)&in, returnValue));
return *static_cast<T*>(returnValue);
@@ -2196,7 +2196,7 @@
inline void cache_release(base_transaction_object* ptr) {
if (ptr==0) return ;
- ptr->cache_deallocate();
+ ptr->delete_cache();
}
#ifdef BOOST_STM_NO_PARTIAL_SPECIALIZATION
Modified: sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -15,7 +15,6 @@
#define BOOST_STM_TRANSACTION_OBJECT__HPP
//-----------------------------------------------------------------------------
-//#include <stdarg.h>
#include <pthread.h>
//-----------------------------------------------------------------------------
#include <list>
@@ -27,25 +26,55 @@
#include <boost/stm/cache_fct.hpp>
#include <boost/stm/datatypes.hpp>
#include <boost/stm/memory_managers/memory_manager.hpp>
-//-----------------------------------------------------------------------------
+#include <boost/stm/tx/deep_transaction_object.hpp>
+#include <boost/stm/tx/trivial_transaction_object.hpp>
+#include <boost/stm/tx/shallow_transaction_object.hpp>
//-----------------------------------------------------------------------------
-namespace boost { namespace stm {
//-----------------------------------------------------------------------------
-// forward declarations
-//-----------------------------------------------------------------------------
-class transaction;
+namespace boost { namespace stm {
+namespace detail {
+template <class Final, class Base,
+ bool hasShallowCopySemantics,
+ bool hasTrivialCopySemantics>
+class transaction_object_aux;
+
+template <class F, class B>
+class transaction_object_aux<F, B, true, true>:
+ public trivial_transaction_object<F, B> {};
+template <class F, class B>
+class transaction_object_aux<F, B, true, false>:
+ public shallow_transaction_object<F, B> {};
+template <class F, class B>
+class transaction_object_aux<F, B, false, true>:
+ public trivial_transaction_object<F, B> {};
+template <class F, typename B>
+class transaction_object_aux<F, B, false, false>:
+ public deep_transaction_object<F, B> {};
+}
+#if 1
+
+template <
+ class Final,
+ class Base=base_transaction_object
+>
+class transaction_object : public detail::transaction_object_aux<Final, Base,
+ has_shallow_copy_semantics<Final>::value,
+ has_trivial_copy_semantics<Final>::value
+ >
+{};
+ #else
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// transaction object mixin
// Provides the definition of the virtual functions
-// clone: use copy constructor
+// make_cache: use copy constructor
// copy_state: use assignement
// move_state and
-// cache_deallocate: use delete
+// delete_cache: use delete
// Defines in addition the functions new and delete when USE_STM_MEMORY_MANAGER is defined
// The parameter Base=base_transaction_object allows to mic transaction_object and polymorphism
@@ -53,47 +82,47 @@
// class D : transaction_object<D, B> {}
// the single issue is the forward constructors from transaction_object<D, B> to B
//-----------------------------------------------------------------------------
-template <class Derived, typename Base=base_transaction_object>
+template <class Final, typename Base=base_transaction_object>
class transaction_object : public
#ifdef USE_STM_MEMORY_MANAGER
- memory_manager<Derived, Base>
+ memory_manager<Final, Base>
#else
Base
#endif
{
#ifdef USE_STM_MEMORY_MANAGER
- typedef memory_manager<Derived, Base> base_type;
+ typedef memory_manager<Final, Base> base_type;
#else
typedef Base base_type;
#endif
public:
- typedef transaction_object<Derived, Base> this_type;
+ typedef transaction_object<Final, Base> this_type;
//--------------------------------------------------------------------------
#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual base_transaction_object* clone(transaction* t) const {
- Derived* p = cache_allocate<Derived>(t);
+ virtual base_transaction_object* make_cache(transaction* t) const {
+ Final* p = cache_allocate<Final>(t);
if (p==0) {
throw std::bad_alloc();
}
- ::new (p) Derived(*static_cast<Derived const*>(this));
+ ::new (p) Final(*static_cast<Final const*>(this));
return p;
}
#else
- virtual base_transaction_object* clone(transaction*) const {
- Derived* tmp = new Derived(*static_cast<Derived const*>(this));
+ virtual base_transaction_object* make_cache(transaction*) const {
+ Final* tmp = new Final(*static_cast<Final const*>(this));
return tmp;
}
#endif
//--------------------------------------------------------------------------
#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual void cache_deallocate() {
- static_cast<Derived*>(this)->~Derived();
+ virtual void delete_cache() {
+ static_cast<Final*>(this)->~Final();
boost::stm::cache_deallocate(this);
}
#else
- virtual void cache_deallocate() {
+ virtual void delete_cache() {
delete this;
}
#endif
@@ -101,19 +130,19 @@
//--------------------------------------------------------------------------
virtual void copy_state(base_transaction_object const * const rhs)
{
- *static_cast<Derived *>(this) = *static_cast<Derived const * const>(rhs);
+ *static_cast<Final *>(this) = *static_cast<Final const * const>(rhs);
}
#if BUILD_MOVE_SEMANTICS
virtual void move_state(base_transaction_object * rhs)
{
- static_cast<Derived &>(*this) = draco_move
- (*(static_cast<Derived*>(rhs)));
+ static_cast<Final &>(*this) = draco_move
+ (*(static_cast<Final*>(rhs)));
}
#endif
};
-
+#endif
template <typename T> class native_trans :
public transaction_object< native_trans<T> >
{
Modified: sandbox/stm/branches/vbe/boost/stm/tx.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -16,8 +16,10 @@
#include <boost/stm/detail/config.hpp>
-#include <boost/stm/tx/shallow_transaction_object.hpp>
-#include <boost/stm/tx/deep_transaction_object.hpp>
+#include <boost/stm/transaction_object.hpp>
+//#include <boost/stm/tx/deep_transaction_object.hpp>
+//#include <boost/stm/tx/trivial_transaction_object.hpp>
+//#include <boost/stm/tx/shallow_transaction_object.hpp>
#include <boost/stm/tx_ptr.hpp>
#include <boost/stm/tx/mixin.hpp>
#include <boost/stm/tx/object.hpp>
Modified: sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -14,8 +14,106 @@
#ifndef BOOST_STM_TX_DEEP_TRANSACTION_OBJECT__HPP
#define BOOST_STM_TX_DEEP_TRANSACTION_OBJECT__HPP
+
+//-----------------------------------------------------------------------------
+#include <pthread.h>
+//-----------------------------------------------------------------------------
+#include <list>
+#include <new>
+//-----------------------------------------------------------------------------
+#include <boost/stm/detail/config.hpp>
+//-----------------------------------------------------------------------------
+#include <boost/stm/base_transaction_object.hpp>
+#include <boost/stm/cache_fct.hpp>
+#include <boost/stm/datatypes.hpp>
+#include <boost/stm/memory_managers/memory_manager.hpp>
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+namespace boost { namespace stm {
+
+//-----------------------------------------------------------------------------
+// forward declarations
+//-----------------------------------------------------------------------------
+class transaction;
+
+//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-#include <boost/stm/transaction_object.hpp>
+//-----------------------------------------------------------------------------
+// transaction object mixin
+// Provides the definition of the virtual functions
+// make_cache: use copy constructor
+// copy_state: use assignement
+// move_state and
+// delete_cache: use delete
+// Defines in addition the functions new and delete when USE_STM_MEMORY_MANAGER is defined
+
+// The parameter Base=base_transaction_object allows to mic transaction_object and polymorphism
+// class B : deep_transaction_object<B> {}
+// class D : deep_transaction_object<D, B> {}
+// the single issue is the forward constructors from transaction_object<D, B> to B
+//-----------------------------------------------------------------------------
+template <class Final, typename Base=base_transaction_object>
+class deep_transaction_object : public
+#ifdef USE_STM_MEMORY_MANAGER
+ memory_manager<Final, Base>
+#else
+ Base
+#endif
+{
+#ifdef USE_STM_MEMORY_MANAGER
+ typedef memory_manager<Final, Base> base_type;
+#else
+ typedef Base base_type;
+#endif
+public:
+
+ //--------------------------------------------------------------------------
+#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
+ virtual base_transaction_object* make_cache(transaction* t) const {
+ Final* p = cache_allocate<Final>(t);
+ ::new (p) Final(*static_cast<Final const*>(this));
+ return p;
+ }
+#else
+ virtual base_transaction_object* make_cache(transaction*) const {
+ Final* tmp = new Final(*static_cast<Final const*>(this));
+ return tmp;
+ }
+#endif
+
+ //--------------------------------------------------------------------------
+#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
+ virtual void delete_cache() {
+ static_cast<Final*>(this)->~Final();
+ boost::stm::cache_deallocate(this);
+ }
+#else
+ virtual void delete_cache() {
+ delete this;
+ }
+#endif
+
+ //--------------------------------------------------------------------------
+ virtual void copy_state(base_transaction_object const * const rhs)
+ {
+ *static_cast<Final *>(this) = *static_cast<Final const * const>(rhs);
+ }
+
+#if BUILD_MOVE_SEMANTICS
+ virtual void move_state(base_transaction_object * rhs)
+ {
+ static_cast<Final &>(*this) = draco_move
+ (*(static_cast<Final*>(rhs)));
+ }
+#endif
+
+};
+
+
+
+}}
+
//-----------------------------------------------------------------------------
#endif // BOOST_STM_TX_DEEP_TRANSACTION_OBJECT__HPP
Modified: sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -31,6 +31,13 @@
//-----------------------------------------------------------------------------
namespace boost { namespace stm {
+struct shallow_t {};
+const shallow_t shallow = {};
+
+ template <class T>
+ struct has_shallow_copy_semantics : boost::mpl::false_
+ {};
+
//-----------------------------------------------------------------------------
// forward declarations
//-----------------------------------------------------------------------------
@@ -41,10 +48,10 @@
//-----------------------------------------------------------------------------
// transaction object mixin making shallow copy
// Provides the definition of the virtual functions
-// clone: use copy constructor
-// copy_state: use assignement
+// make_cache: use shallow copy constructor on cache_allocated area
+// copy_state: use shallow assignement
// move_state and
-// cache_deallocate: use delete
+// delete_cache: use cache_deallocate
// Defines in addition the functions new and delete when USE_STM_MEMORY_MANAGER is defined
// The parameter Base=base_transaction_object allows to mic transaction_object and polymorphism
@@ -53,43 +60,43 @@
// the single issue is the forward constructors from transaction_object<D, B> to B
//-----------------------------------------------------------------------------
-template <class Derived, typename Base=base_transaction_object>
+template <class Final, typename Base=base_transaction_object>
class shallow_transaction_object : public
#ifdef USE_STM_MEMORY_MANAGER
- memory_manager<Derived, Base>
+ memory_manager<Final, Base>
#else
Base
#endif
{
#ifdef USE_STM_MEMORY_MANAGER
- typedef memory_manager<Derived, Base> base_type;
+ typedef memory_manager<Final, Base> base_type;
#else
typedef Base base_type;
#endif
public:
//--------------------------------------------------------------------------
- virtual base_transaction_object* clone(transaction* t) const {
- Derived* tmp = cache_clone(t, *static_cast<Derived const*>(this));
- return tmp;
+ virtual base_transaction_object* make_cache(transaction* t) const {
+ Final* p = cache_allocate<Final>(t);
+ return new(p) Final(this, shallow);
}
//--------------------------------------------------------------------------
- virtual void cache_deallocate() {
+ virtual void delete_cache() {
boost::stm::cache_deallocate(this);
}
//--------------------------------------------------------------------------
virtual void copy_state(base_transaction_object const * const rhs)
{
- boost::stm::cache_copy(static_cast<Derived const * const>(rhs), static_cast<Derived *>(this));
+ boost::stm::cache_copy(static_cast<Final const * const>(rhs), static_cast<Final *>(this));
}
#if BUILD_MOVE_SEMANTICS
virtual void move_state(base_transaction_object * rhs)
{
- static_cast<Derived &>(*this) = draco_move
- (*(static_cast<Derived*>(rhs)));
+ static_cast<Final &>(*this) = draco_move
+ (*(static_cast<Final*>(rhs)));
}
#endif
Added: sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -0,0 +1,115 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TX_TRIVIAL_TRANSACTION_OBJECT__HPP
+#define BOOST_STM_TX_TRIVIAL_TRANSACTION_OBJECT__HPP
+
+//-----------------------------------------------------------------------------
+//#include <stdarg.h>
+#include <pthread.h>
+//-----------------------------------------------------------------------------
+#include <list>
+//-----------------------------------------------------------------------------
+#include <boost/stm/detail/config.hpp>
+//-----------------------------------------------------------------------------
+#include <boost/stm/base_transaction_object.hpp>
+#include <boost/stm/cache_fct.hpp>
+#include <boost/stm/datatypes.hpp>
+#include <boost/stm/memory_managers/memory_manager.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+namespace boost { namespace stm {
+
+template <class T>
+struct has_trivial_copy_semantics :
+ boost::mpl::and_<
+ boost::has_trivial_copy_constructor<T>,
+ boost::has_trivial_assign<T>
+ >
+ {};
+
+//-----------------------------------------------------------------------------
+// forward declarations
+//-----------------------------------------------------------------------------
+class transaction;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// transaction object mixin making a trivial memcpy copy
+// Provides the definition of the virtual functions
+// make_cache: use memcpy on cache_allocated
+// copy_state: use memcpy
+// move_state and
+// delete_cache: use cache_allocated
+// Defines in addition the functions new and delete when USE_STM_MEMORY_MANAGER is defined
+
+// The parameter Base=base_transaction_object allows to mic transaction_object and polymorphism
+// class B : transaction_object<B> {}
+// class D : transaction_object<D, B> {}
+// the single issue is the forward constructors from transaction_object<D, B> to B
+//-----------------------------------------------------------------------------
+
+template <class Final, typename Base=base_transaction_object>
+class trivial_transaction_object : public
+#ifdef USE_STM_MEMORY_MANAGER
+ memory_manager<Final, Base>
+#else
+ Base
+#endif
+{
+#ifdef USE_STM_MEMORY_MANAGER
+ typedef memory_manager<Final, Base> base_type;
+#else
+ typedef Base base_type;
+#endif
+public:
+
+ //--------------------------------------------------------------------------
+ virtual base_transaction_object* make_cache(transaction* t) const {
+ Final* p = cache_allocate<Final>(t);
+ boost::stm::cache_copy(static_cast<Final const*>(this), p);
+ return p;
+ }
+
+ //--------------------------------------------------------------------------
+ virtual void delete_cache() {
+ boost::stm::cache_deallocate(this);
+ }
+
+ //--------------------------------------------------------------------------
+ virtual void copy_state(base_transaction_object const * const rhs)
+ {
+ boost::stm::cache_copy(static_cast<Final const * const>(rhs), static_cast<Final *>(this));
+ }
+
+#if BUILD_MOVE_SEMANTICS
+ virtual void move_state(base_transaction_object * rhs)
+ {
+ static_cast<Final &>(*this) = draco_move
+ (*(static_cast<Final*>(rhs)));
+ }
+#endif
+
+};
+
+
+}}
+#endif // BOOST_STM_TX_TRIVIAL_TRANSACTION_OBJECT__HPP
+
+
Modified: sandbox/stm/branches/vbe/boost/stm/txw/transactional_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/txw/transactional_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/txw/transactional_object.hpp 2010-01-07 12:03:15 EST (Thu, 07 Jan 2010)
@@ -29,7 +29,7 @@
// forward constructors to the wrapped type
// copy_state: relaying on the cache_copy<T> generic function
// move_state and
-// cache_deallocate: relaying on the cache_copy<T> generic function
+// delete_cache: relaying on the cache_copy<T> generic function
// Defines in addition the functions new and delete when USE_STM_MEMORY_MANAGER is defined
//
// If a class D inherits from B we have that transactional_object<D> dont inherits from transactional_object<B>, but
@@ -87,7 +87,7 @@
}
#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual base_transaction_object* clone(transaction* t) const {
+ virtual base_transaction_object* make_cache(transaction* t) const {
transactional_object<T>* p = cache_allocate<transactional_object<T> >(t);
if (p==0) {
throw std::bad_alloc();
@@ -96,19 +96,18 @@
return p;
}
#else
- virtual base_transaction_object* clone(transaction*) const {
- //return cache_clone(*this);
+ virtual base_transaction_object* make_cache(transaction*) const {
return new transactional_object<T>(*this);
}
#endif
#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual void cache_deallocate() {
+ virtual void delete_cache() {
static_cast<transactional_object<T>*>(this)->~transactional_object<T>();
boost::stm::cache_deallocate(this);
}
#else
- virtual void cache_deallocate() {
+ virtual void delete_cache() {
delete this;
}
#endif
@@ -208,7 +207,7 @@
#else //!BOOST_STM_NO_PARTIAL_SPECIALIZATION
template <class T>
-inline void cache_deallocate(transactional_object<std::vector<T> >* ptr) {
+inline void delete_cache(transactional_object<std::vector<T> >* ptr) {
delete ptr;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk