From 8b7d74d91f2562a4159819ba0caa74479bd296db Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Jun 2019 22:00:03 -0700 Subject: [PATCH 1/1] prune mod order --- execution.cc | 15 ++++++++++++--- execution.h | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/execution.cc b/execution.cc index 8b718ba5..f17ed53c 100644 --- a/execution.cc +++ b/execution.cc @@ -270,14 +270,18 @@ void ModelExecution::process_read(ModelAction *curr, SnapVectorsize();i++) { mo_graph->addEdge((*priorset)[i], rf); } read_from(curr, rf); get_thread(curr)->set_return_value(curr->get_return_value()); delete priorset; + if (canprune && curr->get_type() == ATOMIC_READ) { + int tid = id_to_int(curr->get_tid()); + (*obj_thrd_map.get(curr->get_location()))[tid].pop_back(); + } return; } priorset->clear(); @@ -764,7 +768,7 @@ ModelAction * ModelExecution::process_rmw(ModelAction *act) { * @return True if modification order edges were added; false otherwise */ -bool ModelExecution::r_modification_order(ModelAction *curr, const ModelAction *rf, SnapVector * priorset) +bool ModelExecution::r_modification_order(ModelAction *curr, const ModelAction *rf, SnapVector * priorset, bool * canprune) { SnapVector *thrd_lists = obj_thrd_map.get(curr->get_location()); unsigned int i; @@ -847,6 +851,11 @@ bool ModelExecution::r_modification_order(ModelAction *curr, const ModelAction * if (mo_graph->checkReachable(rf, prevrf)) return false; priorset->push_back(prevrf); + } else { + if (act->get_tid() == curr->get_tid()) { + //Can prune curr from obj list + *canprune = true; + } } } break; diff --git a/execution.h b/execution.h index 990a7a8a..20bbfdc6 100644 --- a/execution.h +++ b/execution.h @@ -143,7 +143,7 @@ private: SnapVector * build_may_read_from(ModelAction *curr); ModelAction * process_rmw(ModelAction *curr); - bool r_modification_order(ModelAction *curr, const ModelAction *rf, SnapVector *priorset); + bool r_modification_order(ModelAction *curr, const ModelAction *rf, SnapVector *priorset, bool *canprune); void w_modification_order(ModelAction *curr); void get_release_seq_heads(ModelAction *acquire, ModelAction *read, rel_heads_list_t *release_heads); bool release_seq_heads(const ModelAction *rf, rel_heads_list_t *release_heads) const; -- 2.34.1