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 cfb0b0bc781be4e334f3549e0dae6ba91173f330..50e052a14ebd147d1739d5ca2735c5d500122502 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 b15169137180d884857fa5341e07ff95d27ceab3..ea4ce20b6e27fec6c60f51f1232f8631d109538a 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 489939b739c97878a7a264b4af3d0cc08caf3e3a..74aaee698f0d9a05e74b030cf0e4cb285bc2fe12 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];
        }