diff options
Diffstat (limited to 'libitm')
-rw-r--r-- | libitm/beginend.cc | 6 | ||||
-rw-r--r-- | libitm/method-ml.cc | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/libitm/beginend.cc b/libitm/beginend.cc index d04f3e9..c6550a3 100644 --- a/libitm/beginend.cc +++ b/libitm/beginend.cc @@ -431,7 +431,7 @@ GTM::gtm_transaction_cp::save(gtm_thread* tx) // Save everything that we might have to restore on restarts or aborts. jb = tx->jb; undolog_size = tx->undolog.size(); - memcpy(&alloc_actions, &tx->alloc_actions, sizeof(alloc_actions)); + alloc_actions = tx->alloc_actions; user_actions_size = tx->user_actions.size(); id = tx->id; prop = tx->prop; @@ -449,7 +449,7 @@ GTM::gtm_transaction_cp::commit(gtm_thread* tx) // commits of nested transactions. Allocation actions must be committed // before committing the snapshot. tx->jb = jb; - memcpy(&tx->alloc_actions, &alloc_actions, sizeof(alloc_actions)); + tx->alloc_actions = alloc_actions; tx->id = id; tx->prop = prop; } @@ -485,7 +485,7 @@ GTM::gtm_thread::rollback (gtm_transaction_cp *cp, bool aborting) prop = cp->prop; if (cp->disp != abi_disp()) set_abi_disp(cp->disp); - memcpy(&alloc_actions, &cp->alloc_actions, sizeof(alloc_actions)); + alloc_actions = cp->alloc_actions; nesting = cp->nesting; } else diff --git a/libitm/method-ml.cc b/libitm/method-ml.cc index fcae334..b857bff 100644 --- a/libitm/method-ml.cc +++ b/libitm/method-ml.cc @@ -138,7 +138,11 @@ struct ml_mg : public method_group // This store is only executed while holding the serial lock, so relaxed // memory order is sufficient here. Same holds for the memset. time.store(0, memory_order_relaxed); - memset(orecs, 0, sizeof(atomic<gtm_word>) * L2O_ORECS); + // The memset below isn't strictly kosher because it bypasses + // the non-trivial assignment operator defined by std::atomic. Using + // a local void* is enough to prevent GCC from warning for this. + void *p = orecs; + memset(p, 0, sizeof(atomic<gtm_word>) * L2O_ORECS); } }; |