From a954c752ac2dd5458564fa75b22ab9f488009733 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 29 Dec 2019 19:34:30 -0800 Subject: [PATCH] difs --- execution.cc | 41 +++++++++++++++++++++++++++-------------- main.cc | 9 ++++----- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/execution.cc b/execution.cc index 54e14c30..40aa6814 100644 --- a/execution.cc +++ b/execution.cc @@ -1692,6 +1692,12 @@ void ModelExecution::removeAction(ModelAction *act) { SnapVector *vec = get_safe_ptr_vect_action(&obj_wr_thrd_map, act->get_location()); (*vec)[act->get_tid()].erase(listref); } + //Clear it from last_sc_map + if (obj_last_sc_map.get(act->get_location()) == act) { + obj_last_sc_map.remove(act->get_location()); + } + + //Remove from Cyclegraph mo_graph->freeAction(act); } @@ -1769,6 +1775,12 @@ void ModelExecution::collectActions() { } } } + for (sllnode * it2 = action_trace.end();it2 != it;it2=it2->getPrev()) { + ModelAction *act = it2->getVal(); + if (act->is_read() && act->get_reads_from()->is_free()) { + act->set_read_from(NULL); + } + } for (;it != NULL;) { ModelAction *act = it->getVal(); //Do iteration early since we may delete node... @@ -1781,22 +1793,23 @@ void ModelExecution::collectActions() { } if (act->is_read()) { - if (islastact) { - act->set_read_from(NULL); - continue; - } else if (act->get_reads_from()->is_free()) { + if (!islastact && act->get_reads_from()->is_free()) { removeAction(act); delete act; - } else { - const ModelAction *rel_fence =act->get_last_fence_release(); - if (rel_fence != NULL) { - modelclock_t relfenceseq = rel_fence->get_seq_number(); - thread_id_t relfence_tid = rel_fence->get_tid(); - modelclock_t tid_clock = cvmin->getClock(relfence_tid); - //Remove references to irrelevant release fences - if (relfenceseq <= tid_clock) - act->set_last_fence_release(NULL); - } + continue; + } + if (islastact && act->get_reads_from()->is_free()) { + act->set_read_from(NULL); + } + + const ModelAction *rel_fence =act->get_last_fence_release(); + if (rel_fence != NULL) { + modelclock_t relfenceseq = rel_fence->get_seq_number(); + thread_id_t relfence_tid = rel_fence->get_tid(); + modelclock_t tid_clock = cvmin->getClock(relfence_tid); + //Remove references to irrelevant release fences + if (relfenceseq <= tid_clock) + act->set_last_fence_release(NULL); } } else if (islastact) { continue; diff --git a/main.cc b/main.cc index 989876c9..f445e08f 100644 --- a/main.cc +++ b/main.cc @@ -91,17 +91,16 @@ void parse_options(struct model_params *params) { const char *shortopts = "hrnt:o:x:v:m:f::"; const struct option longopts[] = { {"help", no_argument, NULL, 'h'}, - {"verbose", optional_argument, NULL, 'v'}, + {"removevisible", no_argument, NULL, 'r'}, {"analysis", required_argument, NULL, 't'}, {"options", required_argument, NULL, 'o'}, {"maxexecutions", required_argument, NULL, 'x'}, + {"verbose", optional_argument, NULL, 'v'}, {"minsize", required_argument, NULL, 'm'}, {"freqfree", required_argument, NULL, 'f'}, - {"removevisible", no_argument, NULL, 'r'}, {0, 0, 0, 0} /* Terminator */ }; int opt, longindex; - int tmpoptind = optind; bool error = false; char * options = getenv("C11TESTER"); @@ -167,8 +166,8 @@ void parse_options(struct model_params *params) { } } - /* Restore (global) optind for potential use by user program */ - optind = tmpoptind; + /* Special value to reset implementation as described by Linux man page. */ + optind = 0; if (error) print_usage(params); -- 2.34.1