X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=3aeb7377e2b328fad8b24748744274ab1386e25d;hb=5d87d23f622d396fd2e1c94d61f901429c5f35ac;hp=09352da0b0f30f030c5fb423ddd5d60dfdb5dd0c;hpb=8f379cb70822bfd5498da9997ad4f7c3b37a18ed;p=model-checker.git diff --git a/action.cc b/action.cc index 09352da..3aeb737 100644 --- a/action.cc +++ b/action.cc @@ -8,6 +8,7 @@ #include "clockvector.h" #include "common.h" #include "threads.h" +#include "nodestack.h" #define ACTION_INITIAL_CLOCK 0 @@ -30,8 +31,10 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, location(loc), value(value), reads_from(NULL), + node(NULL), seq_number(ACTION_INITIAL_CLOCK), - cv(NULL) + cv(NULL), + sleep_flag(false) { Thread *t = thread ? thread : thread_current(); this->tid = t->get_id(); @@ -412,3 +415,18 @@ void ModelAction::print() const } else printf("\n"); } + +/** @brief Print nicely-formatted info about this ModelAction */ +unsigned int ModelAction::hash() const +{ + unsigned int hash=(unsigned int) this->type; + hash^=((unsigned int)this->order)<<3; + hash^=seq_number<<5; + hash^=tid<<6; + + if (is_read()) { + if (reads_from) + hash^=reads_from->get_seq_number(); + } + return hash; +}