model_print("BRF ");
act->print();
if (badrfset.contains(act)) {
- model_print("Desired Rf: %u \n",badrfset.get(act)->get_seq_number());
+ model_print("Desired Rf: %u \n", badrfset.get(act)->get_seq_number());
}
}
hash = hash ^ (hash << 3) ^ ((*it)->hash());
for (action_list_t::iterator it = list->begin(); it != list->end(); it++) {
const ModelAction *act = *it;
if (act->is_read()) {
- if (act->get_reads_from()!=lastwrmap.get(act->get_location()))
- badrfset.put(act,lastwrmap.get(act->get_location()));
+ if (act->get_reads_from() != lastwrmap.get(act->get_location()))
+ badrfset.put(act, lastwrmap.get(act->get_location()));
}
if (act->is_write())
lastwrmap.put(act->get_location(), act);
}
bool SCAnalysis::merge(ClockVector *cv, const ModelAction *act, const ModelAction *act2) {
- ClockVector * cv2=cvmap.get(act2);
- if (cv2==NULL)
+ ClockVector *cv2 = cvmap.get(act2);
+ if (cv2 == NULL)
return true;
if (cv2->getClock(act->get_tid()) >= act->get_seq_number() && act->get_seq_number() != 0) {
- cyclic=true;
+ cyclic = true;
//refuse to introduce cycles into clock vectors
return false;
}
if (threadlist->empty())
continue;
ModelAction *first = threadlist->front();
- if (act==NULL) {
- act=first;
+ if (act == NULL) {
+ act = first;
continue;
}
ClockVector *cv = cvmap.get(act);
if (act == NULL)
return act;
-
/* Find the model action with the earliest sequence number in case of a cycle.
*/
if (threadlist->empty())
continue;
ModelAction *first = threadlist->front();
- ClockVector *cv = cvmap.get(act);
ClockVector *cvfirst = cvmap.get(first);
- if (first->get_seq_number()<act->get_seq_number()&&
- (cv->synchronized_since(first)||!cvfirst->synchronized_since(act))) {
- act=first;
+ if (first->get_seq_number() < act->get_seq_number()) {
+ bool candidate = true;
+ for (int j = 0; j <= maxthreads; j++) {
+ action_list_t *threadlist2 = &threadlists[j];
+ if (threadlist2->empty())
+ continue;
+ ModelAction *check = threadlist2->front();
+ if ((check != first) &&
+ cvfirst->synchronized_since(check)) {
+ candidate = false;
+ break;
+ }
+ }
+ if (candidate)
+ act = first;
}
}
//add ordering constraints from this choice
if (updateConstraints(act)) {
//propagate changes if we have them
+ bool oc = cyclic;
computeCV(list);
+ if (!oc && cyclic)
+ model_print("XXXXXXXXXXXXXX\n");
}
//add action to end
sclist->push_back(act);
write -rf-> R =>
write2 -sc-> write */
if (cv->synchronized_since(write2)) {
- changed |= writecv==NULL || merge(writecv, write, write2);
+ changed |= writecv == NULL || merge(writecv, write, write2);
break;
}
}