X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=model.cc;h=7808b104969f72fd9f9b62fe25a8574fffdac9b5;hb=37bf8e7d54c72e0aeee029a491e45bb9d7b2f409;hp=7181f86977688054159da03d0c3a7921ce23c958;hpb=b5cdd7ee16b73bbfe53040d23994351f85f83785;p=model-checker.git diff --git a/model.cc b/model.cc index 7181f86..7808b10 100644 --- a/model.cc +++ b/model.cc @@ -383,8 +383,12 @@ void ModelChecker::set_backtracking(ModelAction *act) for(int i = low_tid; i < high_tid; i++) { thread_id_t tid = int_to_id(i); + /* Make sure this thread can be enabled here. */ + if (i >= node->get_num_threads()) + break; + /* Don't backtrack into a point where the thread is disabled or sleeping. */ - if (node->get_enabled_array()[i]!=THREAD_ENABLED) + if (node->enabled_status(tid)!=THREAD_ENABLED) continue; /* Check if this has been explored already */ @@ -2021,7 +2025,8 @@ void ModelChecker::build_reads_from_past(ModelAction *curr) bool ModelChecker::sleep_can_read_from(ModelAction * curr, const ModelAction *write) { while(true) { Node *prevnode=write->get_node()->get_parent(); - bool thread_sleep=prevnode->get_enabled_array()[id_to_int(curr->get_tid())]==THREAD_SLEEP_SET; + + bool thread_sleep=prevnode->enabled_status(curr->get_tid())==THREAD_SLEEP_SET; if (write->is_release()&&thread_sleep) return true; if (!write->is_rmw()) {