From a8f851f59ea79d298e34885557b4aa832434e98b Mon Sep 17 00:00:00 2001 From: Brian Demsky Date: Mon, 22 Jul 2019 15:35:57 -0700 Subject: [PATCH] Support for reading from nonatomic stores...A little slow due to all of the backtrace calls. --- execution.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/execution.cc b/execution.cc index 3f8a78cf..706e078d 100644 --- a/execution.cc +++ b/execution.cc @@ -260,6 +260,7 @@ ModelAction * ModelExecution::convertNonAtomicStore(void * location) { getStoreThreadAndClock(location, &storethread, &storeclock); setAtomicStoreFlag(location); ModelAction * act = new ModelAction(NONATOMIC_WRITE, memory_order_relaxed, location, value, get_thread(storethread)); + act->set_seq_number(storeclock); add_normal_write_to_lists(act); add_write_to_lists(act); w_modification_order(act); @@ -276,13 +277,13 @@ ModelAction * ModelExecution::convertNonAtomicStore(void * location) { void ModelExecution::process_read(ModelAction *curr, SnapVector * rf_set) { SnapVector * priorset = new SnapVector(); - while(true) { - bool hasnonatomicstore = hasNonAtomicStore(curr->get_location()); - if (hasnonatomicstore) { - ModelAction * nonatomicstore = convertNonAtomicStore(curr->get_location()); - rf_set->push_back(nonatomicstore); - } + bool hasnonatomicstore = hasNonAtomicStore(curr->get_location()); + if (hasnonatomicstore) { + ModelAction * nonatomicstore = convertNonAtomicStore(curr->get_location()); + rf_set->push_back(nonatomicstore); + } + while(true) { int index = fuzzer->selectWrite(curr, rf_set); ModelAction *rf = (*rf_set)[index]; @@ -1138,8 +1139,6 @@ void insertIntoActionList(action_list_t *list, ModelAction *act) { for(;rit != list->rend();rit++) { if ((*rit)->get_seq_number() == next_seq) { action_list_t::iterator it = rit.base(); - it++; //get to right sequence number - it++; //get to item after it list->insert(it, act); break; } @@ -1160,8 +1159,6 @@ void insertIntoActionListAndSetCV(action_list_t *list, ModelAction *act) { if ((*rit)->get_seq_number() == next_seq) { act->create_cv((*rit)); action_list_t::iterator it = rit.base(); - it++; //get to right sequence number - it++; //get to item after it list->insert(it, act); break; } @@ -1180,9 +1177,10 @@ void insertIntoActionListAndSetCV(action_list_t *list, ModelAction *act) { void ModelExecution::add_normal_write_to_lists(ModelAction *act) { int tid = id_to_int(act->get_tid()); + insertIntoActionListAndSetCV(&action_trace, act); + action_list_t *list = get_safe_ptr_action(&obj_map, act->get_location()); insertIntoActionList(list, act); - insertIntoActionListAndSetCV(&action_trace, act); // Update obj_thrd_map, a per location, per thread, order of actions SnapVector *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location()); -- 2.34.1