Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59755 - in sandbox/stm/branches/vbe/boost/stm: . detail tx txw txw2
From: vicente.botet_at_[hidden]
Date: 2010-02-18 18:06:43


Author: viboes
Date: 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
New Revision: 59755
URL: http://svn.boost.org/trac/boost/changeset/59755

Log:
Boost.STM/vbe:
* New language-like macros allowing transparent exiting statements
* Correct BUG on mixing and derived classes adding assignment operator and shallow copy
* change abort to public
* cleanup
Text files modified:
   sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp | 2
   sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp | 14 +---
   sandbox/stm/branches/vbe/boost/stm/language_like.hpp | 115 +++++++++++++++++++++++++++++++++++++++
   sandbox/stm/branches/vbe/boost/stm/transaction.hpp | 53 +++++++++++++-----
   sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp | 20 +++---
   sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp | 44 ++++++++++-----
   sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp | 19 ++++++
   sandbox/stm/branches/vbe/boost/stm/tx/object.hpp | 38 ++++++++-----
   sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp | 43 ++++++++------
   sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp | 11 +--
   sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp | 2
   sandbox/stm/branches/vbe/boost/stm/txw/smart_ptr.hpp | 16 ----
   sandbox/stm/branches/vbe/boost/stm/txw2/smart_ptr.hpp | 18 +-----
   13 files changed, 274 insertions(+), 121 deletions(-)

Modified: sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/deleters.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -220,7 +220,7 @@
         return new non_transaction_object_deleter<T>(const_cast<T*>(&r));
     }
 
-
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
     template <typename T>

Modified: sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/detail/transaction_impl.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -840,7 +840,6 @@
    // this is an optimization to check forced to abort before obtaining the
    // transaction mutex, so if we do need to abort we do it now
    //--------------------------------------------------------------------------
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
 #ifndef DELAY_INVALIDATION_DOOMED_TXS_UNTIL_COMMIT
    if (forced_to_abort())
    {
@@ -872,7 +871,6 @@
         else
 #endif
         {
-
             lk_i.unlock();
             tx_type(eNormalTx);
 #if PERFORMING_LATM
@@ -899,7 +897,6 @@
    // anyway. so we actually lose performance by doing it here and then
    // doing it again inside abort()
    //--------------------------------------------------------------------------
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
    if (forced_to_abort())
    {
       synchro::unlock(*general_lock()); //TBR
@@ -920,10 +917,9 @@
 
       //-----------------------------------------------------------------------
       // before we get the transactions in flight mutex - get all the locks for
- // al threads, because aborted threads will try to obtain the
+ // all threads, because aborted threads will try to obtain the
       // transactionsInFlightMutex
       //-----------------------------------------------------------------------
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
       lock_all_mutexes(); //TBR
        //all_mutexes lk_all(this);
       synchro::lock(*inflight_lock());
@@ -932,7 +928,6 @@
 #if PERFORMING_COMPOSITION
       if (other_in_flight_same_thread_transactions())
       {
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
          transactionsInFlight_.erase(this);
          state_ = e_hand_off;
          unlock_all_mutexes();//TBR
@@ -944,13 +939,10 @@
 #endif
       {
          // commit releases the inflight mutex as soon as its done with it
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
          invalidating_deferred_commit();
       }
 
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
       ++global_clock();
- //std::cout << __LINE__ << " invalidating_deferred_end_transaction" << std::endl;
    }
 }
 
@@ -1332,7 +1324,9 @@
 
       synchro::unlock(*inflight_lock());
    }
- else unforce_to_abort();
+ else {
+ unforce_to_abort();
+ }
 }
 
 ////////////////////////////////////////////////////////////////////////////

Modified: sandbox/stm/branches/vbe/boost/stm/language_like.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/language_like.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/language_like.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -24,6 +24,33 @@
 // helper function to implement macros
 namespace boost { namespace stm { namespace detail {
 
+enum control_flow {
+ none,
+ break_,
+ continue_
+};
+
+
+struct commit_on_destruction {
+ transaction* tx_;
+ bool stop_;
+ commit_on_destruction(transaction& tx, bool &stop)
+ : tx_(&tx), stop_(stop) {}
+
+ ~commit_on_destruction() {
+ if (tx_!=0) {
+ tx_->commit();
+ stop_ = !(!tx_->committed() \
+ && tx_->check_throw_before_restart() \
+ && tx_->restart_if_not_inflight());
+ };
+ }
+
+ void release() {
+ tx_=0;
+ }
+};
+
 bool no_opt_false() {return false;}
 
 template <typename T>
@@ -45,6 +72,7 @@
     catch (...) {}
 }
 
+struct dummy{};
 }}}
 
 
@@ -71,6 +99,7 @@
 #define BOOST_STM_LABEL_CONTINUE(TX) BOOST_JOIN(__boost_stm_continue_, TX)
 #define BOOST_STM_LABEL_BREAK(TX) BOOST_JOIN(__boost_stm_break_, TX)
 #define BOOST_STM_LABEL_TRICK(TX) BOOST_JOIN(__boost_stm_trick_, TX)
+#define BOOST_STM_VAR_DESTR(TX) BOOST_JOIN(__boost_stm_destr_, TX)
 #define BOOST_STM_VAR_STOP __boost_stm_stop_
 
 #define BOOST_STM_MANAGE_BREAK_CONTINUE(TX) \
@@ -140,7 +169,7 @@
 
 //---------------------------------------------------------------------------
 // Usage
-// BOOST_STM_TRY_ATOMIC(_) {
+// BOOST_STM_TRANSACTION(_) {
 // transactional block
 // } BOOST_STM_RETRY // or BOOST_STM_CACHE_BEFORE_RETRY(E)
 // // or BOOST_STM_BEFORE_RETRY
@@ -167,6 +196,90 @@
 #define BOOST_STM_ATOMIC_IN_LOOP(TX) BOOST_STM_TRANSACTION_IN_LOOP(TX)
 
 //---------------------------------------------------------------------------
+// Usage
+// BOOST_STM_B_TRANSACTION(_) {
+// transactional block
+// } BOOST_STM_RETRY_END // or BOOST_STM_CACHE_BEFORE_RETRY(E)
+// // or BOOST_STM_BEFORE_RETRY
+//---------------------------------------------------------------------------
+
+#define BOOST_STM_B_TRANSACTION(TX) \
+if (bool BOOST_STM_VAR_STOP = boost::stm::detail::no_opt_false()) {} else \
+{ \
+ boost::stm::detail::control_flow ctrl; \
+ do { \
+ try{ \
+ boost::stm::transaction TX; \
+ boost::stm::detail::commit_on_destruction BOOST_STM_VAR_DESTR(TX)(TX, BOOST_STM_VAR_STOP); \
+ try{ \
+ { \
+ try {
+
+
+// abort on destruction if active
+// allow the user to compose exception handlers after his/her code
+// avoid the commit on destruction when an exception is thrown
+
+#define BOOST_STM_B_TRANSACTION_IN_LOOP(TX) \
+if (bool BOOST_STM_VAR_STOP = boost::stm::detail::no_opt_false()) {} else \
+{ \
+ boost::stm::detail::control_flow ctrl; \
+ do { \
+ try { \
+ boost::stm::transaction TX; \
+ boost::stm::detail::commit_on_destruction BOOST_STM_VAR_DESTR(TX)(TX, BOOST_STM_VAR_STOP); \
+ try { \
+ for (ctrl=boost::stm::detail::break_; \
+ ctrl==boost::stm::detail::break_; \
+ ctrl=boost::stm::detail::continue_) \
+ { \
+ try {
+
+ // user code here
+
+#define BOOST_STM_E_RETRY(TX) \
+ } catch(boost::stm::detail::dummy &ex) { throw; } \
+ ctrl=boost::stm::detail::none; \
+ } \
+ } catch(...) { \
+ BOOST_STM_VAR_DESTR(TX).release(); \
+ throw; \
+ } \
+ break; \
+ } BOOST_STM_RETRY
+
+#define BOOST_STM_E_BEFORE_RETRY(TX) \
+ } catch(boost::stm::detail::dummy &ex) { throw; } \
+ ctrl=boost::stm::detail::none; \
+ } \
+ } catch(...) { \
+ BOOST_STM_VAR_DESTR(TX).release(); \
+ throw; \
+ } \
+ break; \
+ } BOOST_STM_BEFORE_RETRY
+
+#define BOOST_STM_E_END(TX) \
+ } while(!BOOST_STM_VAR_STOP); \
+}
+
+#define BOOST_STM_RETRY_END(TX) \
+ BOOST_STM_E_RETRY(TX) \
+ BOOST_STM_E_END(TX)
+
+
+#define BOOST_STM_E_END_IN_LOOP(TX) \
+ } while(!BOOST_STM_VAR_STOP); \
+ if (ctrl==boost::stm::detail::continue_) continue; \
+ else if (ctrl==boost::stm::detail::break_) break; \
+ else ; \
+}
+
+#define BOOST_STM_RETRY_END_IN_LOOP(TX) \
+ BOOST_STM_E_RETRY(TX) \
+ BOOST_STM_E_END_IN_LOOP(TX)
+
+//---------------------------------------------------------------------------
 // Catch a named abort exception leting the user to do somethink before retry
 //---------------------------------------------------------------------------
 #define BOOST_STM_CACHE_BEFORE_RETRY(E) catch (boost::stm::aborted_tx &E)

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-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -1355,9 +1355,7 @@
 #endif
          base_transaction_object* returnValue = detail::make_cache_aux<Poly>::apply(in, *this);
          returnValue->transaction_thread(threadId_);
- //~ writeList().insert(tx_pair((base_transaction_object*)&in, returnValue));
          writeList().insert(tx_pair(&in, returnValue));
- //return *static_cast<T*>(returnValue);
          return *boost::safe_polymorphic_downcast<T*>(returnValue);
       }
       else {
@@ -1384,7 +1382,6 @@
          synchro::lock_guard<Mutex> lock(*mutex());
          bloom().insert((std::size_t)&in);
          }
- //~ writeList().insert(tx_pair((base_transaction_object*)&in, 0));
          writeList().insert(tx_pair(const_cast<T*>(&in), 0));
       }
       //-----------------------------------------------------------------------
@@ -1555,7 +1552,9 @@
    void verifyWrittenMemoryIsValidWithGlobalMemory();
 
    //--------------------------------------------------------------------------
+public:
    inline void abort() throw() { direct_updating() ? direct_abort() : deferred_abort(); }
+private:
    inline void deferred_abort(bool const &alreadyRemovedFromInflightList = false) throw();
    inline void direct_abort(bool const &alreadyRemovedFromInflightList = false) throw();
 
@@ -1582,7 +1581,9 @@
 #ifndef DISABLE_READ_SETS
    inline bool isReading() const { return !readListRef_.empty(); }
 #endif
- inline bool isWriting() const { return !write_list()->empty(); }
+ inline bool isWriting() const {
+ return !write_list()->empty();
+ }
    inline bool is_only_reading() const { return !isWriting(); }
 
    // undefined and hidden - never allow these - bad things would happen
@@ -1829,8 +1830,12 @@
 //private:
 #ifdef BOOST_STM_TX_CONTAINS_REFERENCES_TO_TSS_FIELDS
     mutable WriteContainer *write_list_ref_;
- inline WriteContainer *write_list() {return write_list_ref_;}
- inline const WriteContainer *write_list() const {return write_list_ref_;}
+ inline WriteContainer *write_list() {
+ return write_list_ref_;
+ }
+ inline const WriteContainer *write_list() const {
+ return write_list_ref_;
+ }
 
     mutable bloom_filter *bloomRef_;
 #if PERFORMING_WRITE_BLOOM
@@ -1854,8 +1859,12 @@
     inline void tx_type(TxType const &rhs) { *txTypeRef_ = rhs; }
     inline TxType& tx_type_ref() { return *txTypeRef_; }
 #else // BOOST_STM_TX_CONTAINS_REFERENCES_TO_TSS_FIELDS
- inline WriteContainer *write_list() {return &context_.writeMem;}
- inline const WriteContainer *write_list() const {return &context_.writeMem;}
+ inline WriteContainer *write_list() {
+ return &context_.writeMem;
+ }
+ inline const WriteContainer *write_list() const {
+ return &context_.writeMem;
+ }
 
     inline bloom_filter& bloom() { return context_.bloom; }
 #if PERFORMING_WRITE_BLOOM
@@ -1986,8 +1995,12 @@
 
 #ifdef BOOST_STM_TX_CONTAINS_REFERENCES_TO_TSS_FIELDS
     mutable WriteContainer *write_list_ref_;
- inline WriteContainer *write_list() {return write_list_ref_;}
- inline const WriteContainer *write_list() const {return write_list_ref_;}
+ inline WriteContainer *write_list() {
+ return write_list_ref_;
+ }
+ inline const WriteContainer *write_list() const {
+ return write_list_ref_;
+ }
 
     mutable bloom_filter *bloomRef_;
 #if PERFORMING_WRITE_BLOOM
@@ -2011,8 +2024,12 @@
     inline void tx_type(TxType const &rhs) { *txTypeRef_ = rhs; }
     inline TxType& tx_type_ref() { return *txTypeRef_; }
 #else // BOOST_STM_TX_CONTAINS_REFERENCES_TO_TSS_FIELDS
- inline WriteContainer *write_list() {return &context_.tx_.writeMem;}
- inline const WriteContainer *write_list() const {return &context_.tx_.writeMem;}
+ inline WriteContainer *write_list() {
+ return &context_.tx_.writeMem;
+ }
+ inline const WriteContainer *write_list() const {
+ return &context_.tx_.writeMem;
+ }
 
     inline bloom_filter& bloom() { return context_.tx_.bloom; }
 #if PERFORMING_WRITE_BLOOM
@@ -2143,8 +2160,12 @@
 ////////////////////////////////////////
 
    mutable WriteContainer *write_list_ref_;
- inline WriteContainer *write_list() {return write_list_ref_;}
- inline const WriteContainer *write_list() const {return write_list_ref_;}
+ inline WriteContainer *write_list() {
+ return write_list_ref_;
+ }
+ inline const WriteContainer *write_list() const {
+ return write_list_ref_;
+ }
 #ifndef DISABLE_READ_SETS
    mutable ReadContainer &readListRef_;
 #endif
@@ -2293,7 +2314,9 @@
 
    inline transaction_state const & state() const { return state_; }
 
- inline WriteContainer& writeList() { return *write_list(); }
+ inline WriteContainer& writeList() {
+ return *write_list();
+ }
     #ifndef DISABLE_READ_SETS
    inline ReadContainer& readList() { return readListRef_; }
     #endif

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-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -61,8 +61,10 @@
     Base
 #endif
 {
- Final* final() { return static_cast<Final*>(this); }
- const Final* final() const { return static_cast<Final const*>(this); }
+ Final* final() {
+ return static_cast<Final*>(this); }
+ const Final* final() const {
+ return static_cast<Final const*>(this); }
 public:
 
     //--------------------------------------------------------------------------
@@ -103,7 +105,7 @@
    //--------------------------------------------------------------------------
    virtual void copy_cache(base_transaction_object const & rhs)
    {
- *final() =
+ *final() =
        *boost::safe_polymorphic_downcast_2<Final const *, Base const>(&rhs);
    }
 
@@ -121,7 +123,7 @@
 
 #if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
 template <class Final, typename Base>
-Final*
+Final*
 deep_transaction_object<Final,Base>::
 make_cache(Final const* rhs, transaction& t) {
         Final* p = cache_allocate<Final>(t);
@@ -129,7 +131,7 @@
         return p;
     }
 template <class Final, typename Base>
-base_transaction_object*
+base_transaction_object*
 deep_transaction_object<Final,Base>::
 make_cache(transaction& t) const {
         Final const* f=boost::safe_polymorphic_downcast_2<Final const*, Base const>(this);
@@ -137,14 +139,14 @@
     }
 #else
 template <class Final, typename Base>
-Final*
+Final*
 deep_transaction_object<Final,Base>::
 make_cache(Final const* rhs, transaction& ) {
         Final* tmp = new Final(*rhs);
         return tmp;
     }
 template <class Final, typename Base>
-base_transaction_object*
+base_transaction_object*
 deep_transaction_object<Final,Base>::
 make_cache(transaction& t) const {
         Final* tmp = new Final(*boost::safe_polymorphic_downcast_2<Final const*, Base const>(this));
@@ -152,14 +154,14 @@
     }
 #endif
 #endif
-
+
 
 
 template <class Final, class Base1, class Base2>
 class deep_transaction_object2 :
 #ifdef USE_STM_MEMORY_MANAGER
     public memory_manager<Final, Base1>, public Base2
-#else
+#else
     public Base1, public Base2
 #endif
 {

Modified: sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -32,32 +32,29 @@
 class mixin : public transaction_object< Final, Base >
 {
 protected:
+public:
     T val_;
 public:
     typedef mixin<Final, T, Base> this_type;
     typedef Final final_type;
     typedef T value_type;
     //-----------------------------------------------------------------------------
- mixin() : val_() {
- //std::cerr << __LINE__ << " mixin val_=" << val_ << std::endl;
- }
+ mixin() : val_() {}
 
- mixin(mixin const& r) : val_(r.value()) {
- //std::cerr << __LINE__ << " mixin val_=" << val_ << std::endl;
- }
+ mixin(mixin const& r) : val_(r.value()) {}
     template<typename F, typename U>
- mixin(mixin<F,U> const& r) : val_(r.value()) {
- //std::cerr << __LINE__ << " mixin val_=" << val_ << std::endl;
+ mixin(mixin<F,U> const& r) : val_(r.value()) {}
+ mixin(T v) : val_(v) {}
+ mixin& operator=(mixin const& rhs) {
+ if (this!=&rhs) {
+ ref()=rhs.value();
+ }
+ return *this;
     }
 
- mixin(T v) : val_(v) {
- //std::cerr << __LINE__ << " mixin val_=" << v << std::endl;
- }
     // contructor from a convertible to T
     template <typename U>
- mixin(U v) : val_(v) {
- //std::cerr << __LINE__ << " mixin val_=" << v << std::endl;
- }
+ mixin(U v) : val_(v) {}
 
     operator T() const { return value(); }
     operator T&() { return ref(); }
@@ -92,10 +89,27 @@
         }
         return val_;
     }
+ // shallow copy
+ mixin(mixin const& rhs, stm::shallow_t)
+ : val_(rhs.val_)
+ {}
+ // shallow assignment
+ mixin& shallow_assign(mixin const& rhs)
+ {
+ val_=rhs.val_;
+ return *this;
+ }
 };
 
 
-}}}
+
+}
+// shallow trait
+template <typename F, typename T, typename B>
+struct has_shallow_copy_semantics<tx::mixin<F,T,B> > : boost::mpl::true_
+{};
+
+}}
 #endif //BOOST_STM_TX_MIXIN__HPP
 
 

Modified: sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -27,6 +27,7 @@
 // a non-transactional view on a non-transactional context
 // Note: the sizeof(numeric<T>)>>>>=sizeof(T)
 //-----------------------------------------------------------------------------
+
 template <typename T>
 class numeric : public mixin< numeric<T>, T >
 {
@@ -38,9 +39,27 @@
     numeric(numeric<U> const& r) : base_type(r) {}
     template <typename U>
     numeric(U v) : base_type(v) {}
+
+ // shallow copy
+ numeric(numeric const& rhs, stm::shallow_t)
+ : base_type(rhs, stm::shallow)
+ {}
+ // shallow assignment
+ numeric& shallow_assign(numeric const& rhs)
+ {
+ this->base_type::shallow_assign(rhs);
+ return *this;
+ }
+
 };
 
+}
+// shallow trait
+template <typename T>
+struct has_shallow_copy_semantics<tx::numeric<T> > : boost::mpl::true_
+{};
 
+namespace tx {
 typedef numeric<bool> boolean;
 
 typedef numeric<char> char_t;

Modified: sandbox/stm/branches/vbe/boost/stm/tx/object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/object.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -33,27 +33,35 @@
 public:
     typedef mixin< object<T>, T > base_type;
     //-----------------------------------------------------------------------------
- object() : base_type() {
- //std::cerr << __LINE__ << " object" << std::endl;
- }
+ object() : base_type() {}
     template<typename U>
- object(object<U> const& r) : base_type(r) {
- //std::cerr << __LINE__ << " object" << std::endl;
- }
- object(object const& r) : base_type(r) {
- //std::cerr << __LINE__ << " object" << std::endl;
- }
+ object(object<U> const& r) : base_type(r) {}
+ object(object const& r) : base_type(r) {}
     // contructor from a convertible to T
     template <typename U>
- object(U v) : base_type(v) {
- //std::cerr << __LINE__ << " object" << std::endl;
- }
- object(T v) : base_type(v) {
- //std::cerr << __LINE__ << " object" << std::endl;
+ object(U v) : base_type(v) {}
+ object(T v) : base_type(v) {}
+ // shallow copy
+ object(object const& rhs, stm::shallow_t)
+ : base_type(rhs, stm::shallow)
+ {}
+ // shallow assignment
+ object& shallow_assign(object const& rhs)
+ {
+ this->base_type::shallow_assign(rhs);
+ return *this;
     }
+
 };
 
-}}}
+
+}
+// shallow trait
+template <typename T>
+struct has_shallow_copy_semantics<tx::object<T> > : boost::mpl::true_
+{};
+
+}}
 #endif //BOOST_STM_TX_OBJECT__HPP
 
 

Modified: sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -34,30 +34,17 @@
 
 public:
     //-----------------------------------------------------------------------------
- pointer() : base_type(static_cast<T*>(0)) {
- //std::cerr << __LINE__ << " pointer" << std::endl;
- }
- //pointer(pointer const& r) : base_type(*((base_type const*)(&r))) {
- pointer(pointer const& r) : base_type(r) {
- //std::cerr << __LINE__ << " pointer" << std::endl;
- }
+ pointer() : base_type(static_cast<T*>(0)) {}
+ pointer(pointer const& r) : base_type(r) {}
     template<class U>
- pointer(pointer<U> const& r) : base_type(r) {
- //std::cerr << __LINE__ << " pointer" << std::endl;
- }
+ pointer(pointer<U> const& r) : base_type(r) {}
 
     template<class U, class V, class B>
- pointer(mixin<U, V*, B> const& rhs) : base_type(rhs.value()) {
- //std::cerr << __LINE__ << " pointer" << std::endl;
- }
+ pointer(mixin<U, V*, B> const& rhs) : base_type(rhs.value()) {}
 
- pointer(T* v) : base_type(v) {
- //std::cerr << __LINE__ << " pointer" << std::endl;
- }
+ pointer(T* v) : base_type(v) {}
     template <typename U>
- pointer(U* v) : base_type(v) {
- //std::cerr << __LINE__ << " pointer" << std::endl;
- }
+ pointer(U* v) : base_type(v) {}
 
     template<class U, class V, class B>
     pointer& operator=(mixin<U, V*, B> const& rhs) {
@@ -80,7 +67,25 @@
     }
     #endif
 
+ // shallow copy
+ pointer(pointer const& rhs, stm::shallow_t)
+ : base_type(rhs, stm::shallow)
+ {}
+ // shallow assignment
+ pointer& shallow_assign(pointer const& rhs)
+ {
+ this->base_type::shallow_assign(rhs);
+ return *this;
+ }
+
 };
+}
+// shallow trait
+template <typename T>
+struct has_shallow_copy_semantics<tx::pointer<T> > : boost::mpl::true_
+{};
+
+namespace tx {
 
 template <typename T>
 pointer<T> address_of(object<T>& obj) {

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-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -35,10 +35,9 @@
 struct shallow_t {};
 const shallow_t shallow = {};
 
- template <class T>
- struct has_shallow_copy_semantics : boost::mpl::false_
- {};
-
+template <class T>
+struct has_shallow_copy_semantics : boost::mpl::false_
+{};
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -88,7 +87,7 @@
    //--------------------------------------------------------------------------
    virtual void copy_cache(base_transaction_object const &rhs)
    {
- final()->shallow_assign(*boost::safe_polymorphic_downcast_2<Final const *, Base const>(&rhs));
+ final()->shallow_assign(*boost::safe_polymorphic_downcast_2<Final const *, Base const>(&rhs));
    }
 
 #if BUILD_MOVE_SEMANTICS
@@ -104,7 +103,7 @@
 class shallow_transaction_object2 :
 #ifdef USE_STM_MEMORY_MANAGER
     public memory_manager<Final, Base1>, public Base2
-#else
+#else
     public Base1, public Base2
 #endif
 {

Modified: sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -113,7 +113,7 @@
 class trivial_transaction_object2 :
 #ifdef USE_STM_MEMORY_MANAGER
     public memory_manager<Final, Base1>, public Base2
-#else
+#else
     public Base1, public Base2
 #endif
 {

Modified: sandbox/stm/branches/vbe/boost/stm/txw/smart_ptr.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/txw/smart_ptr.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/txw/smart_ptr.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -407,13 +407,7 @@
     mutable bool written_;
 
     inline upgrd_ptr(transaction &t, tx_ptr<T> tx_obj) : tx_(&t),
- ptr_(const_cast<transactional_object<T>*>(t.read_ptr(tx_obj.ptr_))), written_(false) {
- std::cout << __LINE__ << " ptr_ " << ptr_ << std::endl;
- if (ptr_!=0) {
- std::cout << __LINE__ << " ptr_->value" << ptr_->value << std::endl;
- std::cout << __LINE__ << " &ptr_->value" << &ptr_->value << std::endl;
- }
- }
+ ptr_(const_cast<transactional_object<T>*>(t.read_ptr(tx_obj.ptr_))), written_(false) {}
 
     template<class Y>
     upgrd_ptr & operator=(tx_ptr<Y> const& r) { // never throws
@@ -427,7 +421,6 @@
     }
 
     const T* get() const {
- std::cout << __LINE__ << " ptr_" << ptr_ << std::endl;
             if (ptr_==0) return 0;
         if (tx_->forced_to_abort()) {
             tx_->lock_and_abort();
@@ -446,12 +439,7 @@
             }
         }
 
- std::cout << __LINE__ << " ptr_" << ptr_ << std::endl;
- if (ptr_!=0) {
- std::cout << __LINE__ << " ptr_->value" << ptr_->value << std::endl;
- std::cout << __LINE__ << " &ptr_->value" << &ptr_->value << std::endl;
- }
- if (ptr_==0) return 0;
+ if (ptr_==0) return 0;
         return &ptr_->value;
     }
 

Modified: sandbox/stm/branches/vbe/boost/stm/txw2/smart_ptr.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/txw2/smart_ptr.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/txw2/smart_ptr.hpp 2010-02-18 18:06:41 EST (Thu, 18 Feb 2010)
@@ -407,13 +407,7 @@
     mutable bool written_;
 
     inline upgrd_ptr(transaction &t, tx_ptr<T> tx_obj) : tx_(&t),
- ptr_(const_cast<transactional_object<T>*>(t.read_ptr(tx_obj.ptr_))), written_(false) {
- std::cout << __LINE__ << " ptr_ " << ptr_ << std::endl;
- if (ptr_!=0) {
- std::cout << __LINE__ << " ptr_->value" << ptr_->value << std::endl;
- std::cout << __LINE__ << " &ptr_->value" << &ptr_->value << std::endl;
- }
- }
+ ptr_(const_cast<transactional_object<T>*>(t.read_ptr(tx_obj.ptr_))), written_(false) {}
 
     template<class Y>
     upgrd_ptr & operator=(tx_ptr<Y> const& r) { // never throws
@@ -427,8 +421,7 @@
     }
 
     const T* get() const {
- std::cout << __LINE__ << " ptr_" << ptr_ << std::endl;
- if (ptr_==0) return 0;
+ if (ptr_==0) return 0;
         if (tx_->forced_to_abort()) {
             tx_->lock_and_abort();
             throw aborted_transaction_exception("aborting transaction");
@@ -446,12 +439,7 @@
             }
         }
 
- std::cout << __LINE__ << " ptr_" << ptr_ << std::endl;
- if (ptr_!=0) {
- std::cout << __LINE__ << " ptr_->value" << ptr_->value << std::endl;
- std::cout << __LINE__ << " &ptr_->value" << &ptr_->value << std::endl;
- }
- if (ptr_==0) return 0;
+ if (ptr_==0) return 0;
         return &ptr_->value;
     }
 


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