X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=ca1285612b00c75fd7294bee5af80d3aa52a3468;hb=1b793f0683aff025afe2e19519572e3599575a19;hp=5e050810e7526408828b27c74cad76fcdef95a4b;hpb=e60d8c23d30a0dfe66b8426f7f2ecf576e812028;p=model-checker.git diff --git a/action.cc b/action.cc index 5e05081..ca12856 100644 --- a/action.cc +++ b/action.cc @@ -36,6 +36,9 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, cv(NULL), sleep_flag(false) { + /* References to NULL atomic variables can end up here */ + ASSERT(loc || type == MODEL_FIXUP_RELSEQ); + Thread *t = thread ? thread : thread_current(); this->tid = t->get_id(); } @@ -111,6 +114,11 @@ bool ModelAction::is_write() const return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT; } +bool ModelAction::could_be_write() const +{ + return is_write() || is_rmwr(); +} + bool ModelAction::is_rmwr() const { return type == ATOMIC_RMWR; @@ -217,11 +225,11 @@ bool ModelAction::could_synchronize_with(const ModelAction *act) const // Explore interleavings of seqcst writes to guarantee total order // of seq_cst operations that don't commute - if ((is_write() || act->is_write()) && is_seqcst() && act->is_seqcst()) + if ((could_be_write() || act->could_be_write()) && is_seqcst() && act->is_seqcst()) return true; // Explore synchronizing read/write pairs - if (is_read() && is_acquire() && act->is_write() && act->is_release()) + if (is_read() && is_acquire() && act->could_be_write() && act->is_release()) return true; // Otherwise handle by reads_from relation