X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=1e28264fbcedf171c673bace33be6f41c3aa3f35;hb=c451049894af068c8ba22011e3094e66a45d20c3;hp=b9e9c02c533a0eb9850c9a77a142cd9b549ce3db;hpb=9115c8a01b0367665b4b7b3f74dc63a375ac81c6;p=model-checker.git diff --git a/action.cc b/action.cc index b9e9c02..1e28264 100644 --- a/action.cc +++ b/action.cc @@ -1,6 +1,7 @@ #include #define __STDC_FORMAT_MACROS #include +#include #include "model.h" #include "action.h" @@ -51,6 +52,11 @@ bool ModelAction::is_rmwc() const return type == ATOMIC_RMWC; } +bool ModelAction::is_fence() const +{ + return type == ATOMIC_FENCE; +} + bool ModelAction::is_initialization() const { return type == ATOMIC_INIT; @@ -166,8 +172,11 @@ void ModelAction::read_from(const ModelAction *act) { ASSERT(cv); reads_from = act; - if (act!=NULL && act->is_release() && this->is_acquire()) { - synchronize_with(act); + if (act != NULL && this->is_acquire()) { + std::vector< const ModelAction *, MyAlloc > release_heads; + model->get_release_seq_heads(this, &release_heads); + for (unsigned int i = 0; i < release_heads.size(); i++) + synchronize_with(release_heads[i]); } } @@ -177,10 +186,16 @@ void ModelAction::read_from(const ModelAction *act) * @param act The ModelAction to synchronize with */ void ModelAction::synchronize_with(const ModelAction *act) { + ASSERT(*act < *this); model->check_promises(cv, act->cv); cv->merge(act->cv); } +bool ModelAction::has_synchronized_with(const ModelAction *act) const +{ + return cv->has_synchronized_with(act->cv); +} + /** * Check whether 'this' happens before act, according to the memory-model's * happens before relation. This is checked via the ClockVector constructs. @@ -208,6 +223,9 @@ void ModelAction::print(void) const case THREAD_JOIN: type_str = "thread join"; break; + case THREAD_FINISH: + type_str = "thread finish"; + break; case ATOMIC_READ: type_str = "atomic read"; break; @@ -217,6 +235,9 @@ void ModelAction::print(void) const case ATOMIC_RMW: type_str = "atomic rmw"; break; + case ATOMIC_FENCE: + type_str = "fence"; + break; case ATOMIC_RMWR: type_str = "atomic rmwr"; break; @@ -255,8 +276,12 @@ void ModelAction::print(void) const printf("(%3d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-12" PRIu64, seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint); - if (reads_from) - printf(" Rf: %d", reads_from->get_seq_number()); + if (is_read()) { + if (reads_from) + printf(" Rf: %d", reads_from->get_seq_number()); + else + printf(" Rf: ?"); + } if (cv) { printf("\t"); cv->print();