fix git conflict
authorweiyu <weiyuluo1232@gmail.com>
Mon, 1 Jul 2019 18:47:38 +0000 (11:47 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Mon, 1 Jul 2019 18:47:38 +0000 (11:47 -0700)
1  2 
Makefile
execution.cc
execution.h

diff --combined Makefile
index fcebbf36c21ebcfd7988238d8ee3799fb00e5f27,0d2af4647ed740a8fb21decc2c36d6e0e5b71d40..214873ac0e0a7edacade3df693bbdc94193675c1
+++ b/Makefile
@@@ -5,7 -5,7 +5,7 @@@ OBJECTS := libthreads.o schedule.o mode
           datarace.o impatomic.o cmodelint.o \
           snapshot.o malloc.o mymemory.o common.o mutex.o conditionvariable.o \
           context.o execution.o libannotate.o plugins.o pthread.o futex.o fuzzer.o \
-          sleeps.o history.o funcnode.o
 -         sleeps.o history.o printf.o
++         sleeps.o history.o funcnode.o printf.o
  
  CPPFLAGS += -Iinclude -I.
  LDFLAGS := -ldl -lrt -rdynamic
@@@ -34,10 -34,10 +34,10 @@@ README.html: README.m
        $(MARKDOWN) $< > $@
  
  malloc.o: malloc.c
-       $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=0 $(CPPFLAGS) -Wno-unused-variable
+       $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=1 $(CPPFLAGS) -Wno-unused-variable
  
 -futex.o: futex.cc
 -      $(CXX) -fPIC -c futex.cc -std=c++11 $(CPPFLAGS)
 +#futex.o: futex.cc
 +#     $(CXX) -fPIC -c futex.cc -std=c++11 $(CPPFLAGS)
  
  %.o : %.cc
        $(CXX) -MMD -MF .$@.d -fPIC -c $< $(CPPFLAGS)
@@@ -92,3 -92,5 +92,5 @@@ pdfs: $(patsubst %.dot,%.pdf,$(wildcar
  tabbing:
        uncrustify -c C.cfg --no-backup --replace *.cc
        uncrustify -c C.cfg --no-backup --replace *.h
+       uncrustify -c C.cfg --no-backup --replace include/*
diff --combined execution.cc
index af98c2f32619364df8bf27520ad2de2244ce7bad,4b76520660e2f0fedc67d72c8f9f262bbed843fc..a72cb675bb5dd20df4c56bceecb3f840a21b30d3
@@@ -14,7 -14,6 +14,7 @@@
  #include "datarace.h"
  #include "threads-model.h"
  #include "bugmessage.h"
 +#include "history.h"
  #include "fuzzer.h"
  
  #define INITIAL_THREAD_ID       0
@@@ -56,7 -55,7 +56,7 @@@ ModelExecution::ModelExecution(ModelChe
        action_trace(),
        thread_map(2),  /* We'll always need at least 2 threads */
        pthread_map(0),
-       pthread_counter(0),
+       pthread_counter(1),
        obj_map(),
        condvar_waiters_map(),
        obj_thrd_map(),
@@@ -389,7 -388,10 +389,7 @@@ bool ModelExecution::process_mutex(Mode
   */
  void ModelExecution::process_write(ModelAction *curr)
  {
 -
        w_modification_order(curr);
 -
 -
        get_thread(curr)->set_return_value(VALUE_NONE);
  }
  
@@@ -776,9 -778,6 +776,6 @@@ bool ModelExecution::r_modification_ord
  
        /* Last SC fence in the current thread */
        ModelAction *last_sc_fence_local = get_last_seq_cst_fence(curr->get_tid(), NULL);
-       ModelAction *last_sc_write = NULL;
-       if (curr->is_seqcst())
-               last_sc_write = get_last_seq_cst_write(curr);
  
        int tid = curr->get_tid();
        ModelAction *prev_same_thread = NULL;
@@@ -1301,7 -1300,8 +1298,8 @@@ ModelAction * ModelExecution::get_paren
   */
  ClockVector * ModelExecution::get_cv(thread_id_t tid) const
  {
-       return get_parent_action(tid)->get_cv();
+       ModelAction *firstaction=get_parent_action(tid);
+       return firstaction != NULL ? firstaction->get_cv() : NULL;
  }
  
  bool valequals(uint64_t val1, uint64_t val2, int size) {
@@@ -1592,18 -1592,6 +1590,6 @@@ Thread * ModelExecution::action_select_
        /* Do not split atomic RMW */
        if (curr->is_rmwr())
                return get_thread(curr);
-       if (curr->is_write()) {
-               std::memory_order order = curr->get_mo();
-               switch(order) {
-               case std::memory_order_relaxed:
-                       return get_thread(curr);
-               case std::memory_order_release:
-                       return get_thread(curr);
-               default:
-                       return NULL;
-               }
-       }
        /* Follow CREATE with the created thread */
        /* which is not needed, because model.cc takes care of this */
        if (curr->get_type() == THREAD_CREATE)
@@@ -1629,9 -1617,6 +1615,9 @@@ Thread * ModelExecution::take_step(Mode
        curr = check_current_action(curr);
        ASSERT(curr);
  
 +      // model_print("poitner loc: %p, thread: %d, type: %d, order: %d, position: %s\n", curr, curr->get_tid(), curr->get_type(), curr->get_mo(), curr->get_position() );
 +      model->get_history()->add_func_atomic( curr, curr_thrd->get_id() );
 +
        if (curr_thrd->is_blocked() || curr_thrd->is_complete())
                scheduler->remove_thread(curr_thrd);
  
diff --combined execution.h
index 9487fd6e95b8dbd015244aab2e111ecc135e11f1,fa2b78b8a282fda6234f3090a00bda968104cc54..0a36d31cab50f5532f8171c9e3f83935ab39b840
@@@ -103,11 -103,10 +103,12 @@@ public
        action_list_t * get_action_trace() { return &action_trace; }
        Fuzzer * getFuzzer();
        CycleGraph * const get_mo_graph() { return mo_graph; }
-       HashTable<pthread_cond_t *, cdsc::condition_variable *, uintptr_t, 4> * getCondMap() {return &cond_map;}
-       HashTable<pthread_mutex_t *, cdsc::mutex *, uintptr_t, 4> * getMutexMap() {return &mutex_map;}
+       HashTable<pthread_cond_t *, cdsc::snapcondition_variable *, uintptr_t, 4> * getCondMap() {return &cond_map;}
+       HashTable<pthread_mutex_t *, cdsc::snapmutex *, uintptr_t, 4> * getMutexMap() {return &mutex_map;}
+       ModelAction * check_current_action(ModelAction *curr);
  
 +      SnapVector<func_id_list_t *> * get_thrd_func_list() { return &thrd_func_list; }
 +
        SNAPSHOTALLOC
  private:
        int get_execution_number() const;
        modelclock_t get_next_seq_num();
  
        bool next_execution();
-       ModelAction * check_current_action(ModelAction *curr);
        bool initialize_curr_action(ModelAction **curr);
        void process_read(ModelAction *curr, SnapVector<const ModelAction *> * rf_set);
        void process_write(ModelAction *curr);
  
        HashTable<void *, SnapVector<action_list_t> *, uintptr_t, 4> obj_thrd_map;
  
-       HashTable<pthread_mutex_t *, cdsc::mutex *, uintptr_t, 4> mutex_map;
-       HashTable<pthread_cond_t *, cdsc::condition_variable *, uintptr_t, 4> cond_map;
+       HashTable<pthread_mutex_t *, cdsc::snapmutex *, uintptr_t, 4> mutex_map;
+       HashTable<pthread_cond_t *, cdsc::snapcondition_variable *, uintptr_t, 4> cond_map;
  
        /**
         * List of pending release sequences. Release sequences might be
        Fuzzer * fuzzer;
  
        Thread * action_select_next_thread(const ModelAction *curr) const;
 +
 +      /* thrd_func_list stores a list of function ids for each thread. 
 +       * Each element in thrd_func_list stores the functions that
 +       * thread i has entered and yet to exit from */
 +      SnapVector< func_id_list_t * > thrd_func_list;
 +
  };
  
  #endif        /* __EXECUTION_H__ */