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 */
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()) {
return thread_id < num_threads && (enabled_array[thread_id] != THREAD_DISABLED);
}
+enabled_type_t Node::enabled_status(thread_id_t tid) {
+ int thread_id=id_to_int(tid);
+ if (thread_id < num_threads)
+ return enabled_array[thread_id];
+ else
+ return THREAD_DISABLED;
+}
+
bool Node::is_enabled(thread_id_t tid)
{
int thread_id=id_to_int(tid);
thread_id_t get_next_backtrack();
bool is_enabled(Thread *t);
bool is_enabled(thread_id_t tid);
+ enabled_type_t enabled_status(thread_id_t tid);
+
ModelAction * get_action() { return action; }
bool has_priority(thread_id_t tid);
int get_num_threads() {return num_threads;}
}
enabled_type_t Scheduler::get_enabled(Thread *t) {
- return enabled[id_to_int(t->get_id())];
+ int id = id_to_int(t->get_id());
+ ASSERT(id<enabled_len);
+ return enabled[id];
}
void Scheduler::update_sleep_set(Node *n) {