OBJECTS = libthreads.o schedule.o model.o threads.o librace.o action.o \
nodestack.o clockvector.o main.o snapshot-interface.o cyclegraph.o \
datarace.o impatomic.o cmodelint.o \
- snapshot.o malloc.o mymemory.o common.o
+ snapshot.o malloc.o mymemory.o common.o mutex.o
CPPFLAGS += -Iinclude -I. -rdynamic
LDFLAGS = -ldl -lrt
ATOMIC_RMWC, /**< Convert an atomic RMW action into a READ */
ATOMIC_INIT, /**< Initialization of an atomic object (e.g.,
* atomic_init()) */
- ATOMIC_FENCE
+ ATOMIC_FENCE,
+ ATOMIC_LOCK,
+ ATOMIC_TRYLOCK,
+ ATOMIC_UNLOCK
} action_type_t;
/* Forward declaration */
curr = tmp;
compute_promises(curr);
} else {
- ModelAction *tmp = node_stack->explore_action(curr);
+ ModelAction *tmp = node_stack->explore_action(curr, NULL);
if (tmp) {
/* Discard duplicate ModelAction; use action from NodeStack */
/* First restore type and order in case of RMW operation */
* @param nthreads The number of threads which exist at this point in the
* execution trace.
*/
-Node::Node(ModelAction *act, Node *par, int nthreads)
+Node::Node(ModelAction *act, Node *par, int nthreads, bool *enabled)
: action(act),
parent(par),
num_threads(nthreads),
{
if (act)
act->set_node(this);
+ enabled_array=(bool *)MYMALLOC(sizeof(bool)*num_threads);
+ if (enabled)
+ memcpy(enabled_array, enabled, sizeof(bool)*num_threads);
+ else
+ for(int i=0;i<num_threads;i++)
+ enabled_array[i]=false;
}
/** @brief Node desctructor */
{
if (action)
delete action;
+ MYFREE(enabled_array);
}
/** Prints debugging info for the ModelAction associated with this Node */
bool Node::is_enabled(Thread *t)
{
- return id_to_int(t->get_id()) < num_threads;
+ int thread_id=id_to_int(t->get_id());
+ return thread_id < num_threads && enabled_array[thread_id];
}
/**
printf("............................................\n");
}
-ModelAction * NodeStack::explore_action(ModelAction *act)
+ModelAction * NodeStack::explore_action(ModelAction *act, bool * enabled)
{
DBG();
/* Record action */
get_head()->explore_child(act);
- node_list.push_back(new Node(act, get_head(), model->get_num_threads()));
+ node_list.push_back(new Node(act, get_head(), model->get_num_threads(), enabled));
total_nodes++;
iter++;
return NULL;
*/
class Node {
public:
- Node(ModelAction *act = NULL, Node *par = NULL, int nthreads = 1);
+ Node(ModelAction *act = NULL, Node *par = NULL, int nthreads = 1, bool *enabled_array = NULL);
~Node();
/* return true = thread choice has already been explored */
bool has_been_explored(thread_id_t tid);
std::vector< bool, MyAlloc<bool> > explored_children;
std::vector< bool, MyAlloc<bool> > backtrack;
int numBacktracks;
+ bool *enabled_array;
/** The set of ModelActions that this the action at this Node may read
* from. Only meaningful if this Node represents a 'read' action. */
public:
NodeStack();
~NodeStack();
- ModelAction * explore_action(ModelAction *act);
+ ModelAction * explore_action(ModelAction *act, bool * enabled);
Node * get_head();
Node * get_next();
void reset_execution();