merge massive speedup with release sequence support...
[model-checker.git] / action.cc
index 8dba82f3a8ff7d97967410cfa75b33a84394de98..c1adc2e7bc65cd94d26a4b7cf93ac3482c2b2d1a 100644 (file)
--- a/action.cc
+++ b/action.cc
 
 #define ACTION_INITIAL_CLOCK 0
 
 
 #define ACTION_INITIAL_CLOCK 0
 
-ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, uint64_t value) :
+/**
+ * @brief Construct a new ModelAction
+ *
+ * @param type The type of action
+ * @param order The memory order of this action. A "don't care" for non-ATOMIC
+ * actions (e.g., THREAD_* or MODEL_* actions).
+ * @param loc The location that this action acts upon
+ * @param value (optional) A value associated with the action (e.g., the value
+ * read or written). Defaults to a given macro constant, for debugging purposes.
+ * @param thread (optional) The Thread in which this action occurred. If NULL
+ * (default), then a Thread is assigned according to the scheduler.
+ */
+ModelAction::ModelAction(action_type_t type, memory_order order, void *loc,
+               uint64_t value, Thread *thread) :
        type(type),
        order(order),
        location(loc),
        type(type),
        order(order),
        location(loc),
@@ -22,7 +35,7 @@ ModelAction::ModelAction(action_type_t type, memory_order order, void *loc, uint
        seq_number(ACTION_INITIAL_CLOCK),
        cv(NULL)
 {
        seq_number(ACTION_INITIAL_CLOCK),
        cv(NULL)
 {
-       Thread *t = thread_current();
+       Thread *t = thread ? thread : thread_current();
        this->tid = t->get_id();
 }
 
        this->tid = t->get_id();
 }
 
@@ -52,6 +65,11 @@ void ModelAction::set_seq_number(modelclock_t num)
        seq_number = num;
 }
 
        seq_number = num;
 }
 
+bool ModelAction::is_relseq_fixup() const
+{
+       return type == MODEL_FIXUP_RELSEQ;
+}
+
 bool ModelAction::is_mutex_op() const
 {
        return type == ATOMIC_LOCK || type == ATOMIC_TRYLOCK || type == ATOMIC_UNLOCK;
 bool ModelAction::is_mutex_op() const
 {
        return type == ATOMIC_LOCK || type == ATOMIC_TRYLOCK || type == ATOMIC_UNLOCK;
@@ -307,6 +325,9 @@ void ModelAction::print() const
 {
        const char *type_str, *mo_str;
        switch (this->type) {
 {
        const char *type_str, *mo_str;
        switch (this->type) {
+       case MODEL_FIXUP_RELSEQ:
+               type_str = "relseq fixup";
+               break;
        case THREAD_CREATE:
                type_str = "thread create";
                break;
        case THREAD_CREATE:
                type_str = "thread create";
                break;