bug fixes
authorroot <root@dw-6.eecs.uci.edu>
Thu, 27 Jun 2019 22:12:34 +0000 (15:12 -0700)
committerroot <root@dw-6.eecs.uci.edu>
Thu, 27 Jun 2019 22:12:34 +0000 (15:12 -0700)
execution.cc
model.cc
threads-model.h
threads.cc

index 2c08711eee0d1a655272bd56f1adf0d900ef599d..2e7442515b4cf47556817f727ba3bd8a7e65b466 100644 (file)
@@ -64,7 +64,7 @@ ModelExecution::ModelExecution(ModelChecker *m, Scheduler *scheduler, NodeStack
        thrd_last_fence_release(),
        node_stack(node_stack),
        priv(new struct model_snapshot_members ()),
        thrd_last_fence_release(),
        node_stack(node_stack),
        priv(new struct model_snapshot_members ()),
-                        mo_graph(new CycleGraph()),
+       mo_graph(new CycleGraph()),
        fuzzer(new Fuzzer())
 {
        /* Initialize a model-checker thread, for special ModelActions */
        fuzzer(new Fuzzer())
 {
        /* Initialize a model-checker thread, for special ModelActions */
index 7f38adc37e149403828d993676e366fb70bc653d..b4bbb70e926bfdba2610509f4cdfc8265b137e1d 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -162,7 +162,7 @@ void ModelChecker::print_bugs() const
                                                        bugs->size(),
                                                        bugs->size() > 1 ? "s" : "");
        for (unsigned int i = 0;i < bugs->size();i++)
                                                        bugs->size(),
                                                        bugs->size() > 1 ? "s" : "");
        for (unsigned int i = 0;i < bugs->size();i++)
-               (*bugs)[i]->print();
+               (*bugs)[i] -> print();
 }
 
 /**
 }
 
 /**
@@ -173,15 +173,15 @@ void ModelChecker::print_bugs() const
  */
 void ModelChecker::record_stats()
 {
  */
 void ModelChecker::record_stats()
 {
-       stats.num_total++;
+       stats.num_total ++;
        if (!execution->isfeasibleprefix())
        if (!execution->isfeasibleprefix())
-               stats.num_infeasible++;
+               stats.num_infeasible ++;
        else if (execution->have_bug_reports())
        else if (execution->have_bug_reports())
-               stats.num_buggy_executions++;
+               stats.num_buggy_executions ++;
        else if (execution->is_complete_execution())
        else if (execution->is_complete_execution())
-               stats.num_complete++;
+               stats.num_complete ++;
        else {
        else {
-               stats.num_redundant++;
+               stats.num_redundant ++;
 
                /**
                 * @todo We can violate this ASSERT() when fairness/sleep sets
 
                /**
                 * @todo We can violate this ASSERT() when fairness/sleep sets
@@ -262,15 +262,15 @@ bool ModelChecker::next_execution()
                return true;
        }
 // test code
                return true;
        }
 // test code
-       execution_number++;
+       execution_number ++;
        reset_to_initial_state();
        return false;
 }
 
 /** @brief Run trace analyses on complete trace */
 void ModelChecker::run_trace_analyses() {
        reset_to_initial_state();
        return false;
 }
 
 /** @brief Run trace analyses on complete trace */
 void ModelChecker::run_trace_analyses() {
-       for (unsigned int i = 0;i < trace_analyses.size();i++)
-               trace_analyses[i]->analyze(execution->get_action_trace());
+       for (unsigned int i = 0;i < trace_analyses.size();i ++)
+               trace_analyses[i] -> analyze(execution->get_action_trace());
 }
 
 /**
 }
 
 /**
@@ -373,7 +373,9 @@ void ModelChecker::do_restart()
 }
 
 void ModelChecker::startMainThread() {
 }
 
 void ModelChecker::startMainThread() {
-       init_thread->setContext();
+       init_thread->set_state(THREAD_RUNNING);
+       scheduler->set_current_thread(init_thread);
+       thread_startup();
 }
 
 /** @brief Run ModelChecker for the user program */
 }
 
 /** @brief Run ModelChecker for the user program */
@@ -383,7 +385,7 @@ void ModelChecker::run()
        char random_state[256];
        initstate(423121, random_state, sizeof(random_state));
 
        char random_state[256];
        initstate(423121, random_state, sizeof(random_state));
 
-       for(int exec = 0;exec < params.maxexecutions;exec++) {
+       for(int exec = 0;exec < params.maxexecutions;exec ++) {
                Thread * t = init_thread;
 
                do {
                Thread * t = init_thread;
 
                do {
index 513142b53c41734832c1110f3d5dff4ae5baf1f0..02f20b030778420d46a247e7a3980f34bf20396b 100644 (file)
@@ -50,7 +50,6 @@ public:
        static int swap(ucontext_t *ctxt, Thread *t);
        static int swap(Thread *t, ucontext_t *ctxt);
 
        static int swap(ucontext_t *ctxt, Thread *t);
        static int swap(Thread *t, ucontext_t *ctxt);
 
-       void setContext();
        thread_state get_state() const { return state; }
        void set_state(thread_state s);
        thread_id_t get_id() const;
        thread_state get_state() const { return state; }
        void set_state(thread_state s);
        thread_id_t get_id() const;
@@ -162,6 +161,7 @@ private:
 };
 
 Thread * thread_current();
 };
 
 Thread * thread_current();
+void thread_startup();
 
 static inline thread_id_t thrd_to_id(thrd_t t)
 {
 
 static inline thread_id_t thrd_to_id(thrd_t t)
 {
index 56942f5f7d277ac12c00dc17ba4bc9ff3e31aa75..67f681ca7052538afb794ff87bb9708ff3655daa 100644 (file)
@@ -86,11 +86,6 @@ int Thread::create_context()
        return 0;
 }
 
        return 0;
 }
 
-void Thread::setContext() {
-       set_state(THREAD_RUNNING);
-       setcontext(&context);
-}
-
 /**
  * Swaps the current context to another thread of execution. This form switches
  * from a user Thread to a system context.
 /**
  * Swaps the current context to another thread of execution. This form switches
  * from a user Thread to a system context.