bug fixes
authorroot <root@dw-6.eecs.uci.edu>
Wed, 31 Jul 2019 01:48:04 +0000 (18:48 -0700)
committerroot <root@dw-6.eecs.uci.edu>
Wed, 31 Jul 2019 01:48:04 +0000 (18:48 -0700)
execution.cc
history.cc
stl-model.h

index cfb0b0b..50e052a 100644 (file)
@@ -1104,8 +1104,9 @@ void ModelExecution::add_action_to_lists(ModelAction *act)
                if (uninit_id >= (int)vec->size()) {
                        int oldsize = (int) vec->size();
                        vec->resize(uninit_id + 1);
-                       for(int i=oldsize;i<uninit_id+1;i++)
-                               new (&vec[i]) action_list_t();
+                       for(int i=oldsize;i<uninit_id+1;i++) {
+                         new(&(*vec)[i]) action_list_t();
+                       }
                }
                (*vec)[uninit_id].push_front(uninit);
        }
@@ -1122,7 +1123,7 @@ void ModelExecution::add_action_to_lists(ModelAction *act)
                uint oldsize =vec->size();
                vec->resize(priv->next_thread_id);
                for(uint i=oldsize;i<priv->next_thread_id;i++)
-                       new (&vec[i]) action_list_t();
+                 new (&(*vec)[i]) action_list_t();
        }
        (*vec)[tid].push_back(act);
        if (uninit)
@@ -1151,7 +1152,7 @@ void ModelExecution::add_action_to_lists(ModelAction *act)
                        uint oldsize = vec->size();
                        vec->resize(priv->next_thread_id);
                        for(uint i=oldsize;i<priv->next_thread_id;i++)
-                               new (&vec[i]) action_list_t();
+                         new (&(*vec)[i]) action_list_t();
                }
                (*vec)[tid].push_back(act);
        }
@@ -1213,7 +1214,7 @@ void ModelExecution::add_normal_write_to_lists(ModelAction *act)
                uint oldsize =vec->size();
                vec->resize(priv->next_thread_id);
                for(uint i=oldsize;i<priv->next_thread_id;i++)
-                       new (&vec[i]) action_list_t();
+                 new (&(*vec)[i]) action_list_t();
        }
        insertIntoActionList(&(*vec)[tid],act);
 
@@ -1230,7 +1231,7 @@ void ModelExecution::add_write_to_lists(ModelAction *write) {
                uint oldsize =vec->size();
                vec->resize(priv->next_thread_id);
                for(uint i=oldsize;i<priv->next_thread_id;i++)
-                       new (&vec[i]) action_list_t();
+                 new (&(*vec)[i]) action_list_t();
        }
        (*vec)[tid].push_back(write);
 }
index b151691..ea4ce20 100644 (file)
@@ -26,7 +26,11 @@ void ModelHistory::enter_function(const uint32_t func_id, thread_id_t tid)
                thrd_func_inst_lists = model->get_execution()->get_thrd_func_inst_lists();
 
        if ( thrd_func_list->size() <= id ) {
-               thrd_func_list->resize( id + 1 );
+         uint oldsize = thrd_func_list->size();
+         thrd_func_list->resize( id + 1 );
+         for(uint i=oldsize; i<id+1; i++) {
+           new(&(*thrd_func_list)[i]) func_id_list_t();
+         }
                thrd_func_inst_lists->resize( id + 1 );
        }
 
index 489939b..74aaee6 100644 (file)
@@ -59,15 +59,21 @@ public:
        void pop_front() {
                mllnode<_Tp> *tmp = head;
                head = head->next;
-               head->prev = NULL;
+               if (head == NULL)
+                 tail = NULL;
+               else
+                 head->prev = NULL;
                delete tmp;
                _size--;
        }
 
        void pop_back() {
                mllnode<_Tp> *tmp = tail;
-               tail = tail->next;
-               tail->next = NULL;
+               tail = tail->prev;
+               if (tail == NULL)
+                 head = NULL;
+               else
+                 tail->next = NULL;
                delete tmp;
                _size--;
        }
@@ -211,15 +217,21 @@ public:
        void pop_front() {
                sllnode<_Tp> *tmp = head;
                head = head->next;
-               head->prev = NULL;
+               if (head == NULL)
+                 tail = NULL;
+               else
+                 head->prev = NULL;
                delete tmp;
                _size--;
        }
 
        void pop_back() {
                sllnode<_Tp> *tmp = tail;
-               tail = tail->next;
-               tail->next = NULL;
+               tail = tail->prev;
+               if (tail == NULL)
+                 head = NULL;
+               else
+                   tail->next = NULL;
                delete tmp;
                _size--;
        }
@@ -358,11 +370,11 @@ public:
                array[_size++] = item;
        }
 
-       type operator[](uint index) const {
+       type operator[](int index) const {
                return array[index];
        }
 
-       type & operator[](uint index) {
+       type & operator[](int index) {
                return array[index];
        }
 
@@ -463,11 +475,11 @@ public:
                array[_size++] = item;
        }
 
-       type & operator[](uint index) {
+       type operator[](int index) const {
                return array[index];
        }
 
-       type operator[](uint index) const {
+       type & operator[](int index) {
                return array[index];
        }