fixup usage of int vs. thread_id_t
authorBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 22:26:52 +0000 (15:26 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 22:36:02 +0000 (15:36 -0700)
datarace.cc
libthreads.cc
model.cc

index d6e0875c1a5562315b26367a3582452d5c41b07d..f5501fe07629d39cd588156c8f219495640a6ecc 100644 (file)
@@ -123,8 +123,8 @@ bool checkDataRaces() {
 void printRace(struct DataRace * race) {
        printf("Datarace detected\n");
        printf("Location %p\n", race->address);
-       printf("Initial access: thread %u clock %u, iswrite %u\n",race->oldthread,race->oldclock, race->isoldwrite);
-       printf("Second access: thread %u clock %u, iswrite %u\n", race->newaction->get_tid(), race->newaction->get_seq_number() , race->isnewwrite);
+       printf("Initial access: thread %u clock %u, iswrite %u\n", id_to_int(race->oldthread), race->oldclock, race->isoldwrite);
+       printf("Second access: thread %u clock %u, iswrite %u\n", id_to_int(race->newaction->get_tid()), race->newaction->get_seq_number(), race->isnewwrite);
 }
 
 /** This function does race detection for a write on an expanded record. */
index 4d6a0243c53b7fe880952747236bd8327c04a108..f973176ba8344a497e687b8f452fdefed031fe5e 100644 (file)
@@ -23,7 +23,7 @@ int thrd_create(thrd_t *t, thrd_start_t start_routine, void *arg)
 int thrd_join(thrd_t t)
 {
        Thread *th = model->get_thread(thrd_to_id(t));
-       model->switch_to_master(new ModelAction(THREAD_JOIN, std::memory_order_seq_cst, th, thrd_to_id(t)));
+       model->switch_to_master(new ModelAction(THREAD_JOIN, std::memory_order_seq_cst, th, id_to_int(thrd_to_id(t))));
        return 0;
 }
 
index 8d8944d71ab27e59af1108e2a66debd3d6999596..788a6706b26074b91db6de091f12ef532c54bd27 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -178,7 +178,7 @@ Thread * ModelChecker::get_next_thread(ModelAction *curr)
        } else {
                tid = next->get_tid();
        }
-       DEBUG("*** ModelChecker chose next thread = %d ***\n", tid);
+       DEBUG("*** ModelChecker chose next thread = %d ***\n", id_to_int(tid));
        ASSERT(tid != THREAD_ID_T_NONE);
        return thread_map->get(id_to_int(tid));
 }
@@ -324,7 +324,8 @@ void ModelChecker::set_backtracking(ModelAction *act)
                if (!node->set_backtrack(tid))
                        continue;
                DEBUG("Setting backtrack: conflict = %d, instead tid = %d\n",
-                                       prev->get_tid(), t->get_id());
+                                       id_to_int(prev->get_tid()),
+                                       id_to_int(t->get_id()));
                if (DBG_ENABLED()) {
                        prev->print();
                        act->print();
@@ -794,8 +795,7 @@ bool ModelChecker::isfinalfeasible() {
 
 /** Close out a RMWR by converting previous RMWR into a RMW or READ. */
 ModelAction * ModelChecker::process_rmw(ModelAction *act) {
-       int tid = id_to_int(act->get_tid());
-       ModelAction *lastread = get_last_action(tid);
+       ModelAction *lastread = get_last_action(act->get_tid());
        lastread->process_rmw(act);
        if (act->is_rmw() && lastread->get_reads_from()!=NULL) {
                mo_graph->addRMWEdge(lastread->get_reads_from(), lastread);
@@ -1776,7 +1776,8 @@ bool ModelChecker::take_step() {
        if (!isfeasible())
                return false;
 
-       DEBUG("(%d, %d)\n", curr ? curr->get_id() : -1, next ? next->get_id() : -1);
+       DEBUG("(%d, %d)\n", curr ? id_to_int(curr->get_id()) : -1,
+                       next ? id_to_int(next->get_id()) : -1);
 
        /* next == NULL -> don't take any more steps */
        if (!next)