difs
authorroot <root@plrg-1.ics.uci.edu>
Mon, 30 Dec 2019 03:34:30 +0000 (19:34 -0800)
committerroot <root@plrg-1.ics.uci.edu>
Mon, 30 Dec 2019 03:34:30 +0000 (19:34 -0800)
execution.cc
main.cc

index 54e14c30fd03cb924ccc300cb3bfd84388c6a550..40aa6814c84e6bd47d006b47b47eb8e532797cf5 100644 (file)
@@ -1692,6 +1692,12 @@ void ModelExecution::removeAction(ModelAction *act) {
                        SnapVector<action_list_t> *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<ModelAction*> * 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 989876c933590f1fa074a3a53fd56050bbcd6b4b..f445e08feb675ddb82dc60137446717a2cb15a18 100644 (file)
--- 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);