X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=d8ce567039bfc451c13916aefc6d15b4b5211e38;hb=HEAD;hp=814c7fb1be0f05df2e42725ef6fb7cd86c641b1c;hpb=805cb1992146bc8f5d69e3e98a4b2f941a407001;p=c11tester.git diff --git a/action.cc b/action.cc index 814c7fb1..d8ce5670 100644 --- a/action.cc +++ b/action.cc @@ -38,8 +38,6 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, last_fence_release(NULL), cv(NULL), rf_cv(NULL), - trace_ref(NULL), - thrdmap_ref(NULL), action_ref(NULL), value(value), type(type), @@ -48,7 +46,7 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, seq_number(ACTION_INITIAL_CLOCK) { /* References to NULL atomic variables can end up here */ - ASSERT(loc || type == ATOMIC_FENCE); + ASSERT(loc || type == ATOMIC_FENCE || type == ATOMIC_NOP); Thread *t = thread ? thread : thread_current(); this->tid = t!= NULL ? t->get_id() : -1; @@ -72,8 +70,6 @@ ModelAction::ModelAction(action_type_t type, memory_order order, uint64_t value, last_fence_release(NULL), cv(NULL), rf_cv(NULL), - trace_ref(NULL), - thrdmap_ref(NULL), action_ref(NULL), value(value), type(type), @@ -105,8 +101,6 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, last_fence_release(NULL), cv(NULL), rf_cv(NULL), - trace_ref(NULL), - thrdmap_ref(NULL), action_ref(NULL), value(value), type(type), @@ -117,8 +111,7 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, /* References to NULL atomic variables can end up here */ ASSERT(loc); this->size = size; - Thread *t = thread_current(); - this->tid = t->get_id(); + this->tid = thread_current_id(); } @@ -142,8 +135,6 @@ ModelAction::ModelAction(action_type_t type, const char * position, memory_order last_fence_release(NULL), cv(NULL), rf_cv(NULL), - trace_ref(NULL), - thrdmap_ref(NULL), action_ref(NULL), value(value), type(type), @@ -154,8 +145,7 @@ ModelAction::ModelAction(action_type_t type, const char * position, memory_order /* References to NULL atomic variables can end up here */ ASSERT(loc); this->size = size; - Thread *t = thread_current(); - this->tid = t->get_id(); + this->tid = thread_current_id(); } @@ -180,8 +170,6 @@ ModelAction::ModelAction(action_type_t type, const char * position, memory_order last_fence_release(NULL), cv(NULL), rf_cv(NULL), - trace_ref(NULL), - thrdmap_ref(NULL), action_ref(NULL), value(value), type(type), @@ -207,9 +195,11 @@ ModelAction::~ModelAction() * vectors which have already been rolled back to an unallocated state. */ - /* - if (cv) - delete cv; */ + + if (cv) + delete cv; + if (rf_cv) + delete rf_cv; } int ModelAction::getSize() const { @@ -261,6 +251,10 @@ bool ModelAction::is_wait() const { return type == ATOMIC_WAIT || type == ATOMIC_TIMEDWAIT; } +bool ModelAction::is_timedwait() const { + return type == ATOMIC_TIMEDWAIT; +} + bool ModelAction::is_notify() const { return type == ATOMIC_NOTIFY_ONE || type == ATOMIC_NOTIFY_ALL; } @@ -305,6 +299,11 @@ bool ModelAction::is_write() const return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT || type == NONATOMIC_WRITE; } +bool ModelAction::is_create() const +{ + return type == THREAD_CREATE || type == PTHREAD_CREATE; +} + bool ModelAction::is_free() const { return type == READY_FREE; @@ -723,6 +722,9 @@ void ModelAction::print() const model_print("%-4d %-2d %-14s %7s %14p %-#18" PRIx64, seq_number, id_to_int(tid), type_str, mo_str, location, get_return_value()); if (is_read()) { + if (is_write()) { + model_print("(%" PRIx64 ")", get_write_value()); + } if (reads_from) model_print(" %-3d", reads_from->get_seq_number()); else