fix a bug
authorweiyu <weiyuluo1232@gmail.com>
Fri, 12 Jul 2019 19:09:12 +0000 (12:09 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Fri, 12 Jul 2019 19:09:12 +0000 (12:09 -0700)
cmodelint.cc
history.cc

index c42ffe4187b1fdc2a02a467c4de19296f1c5a2ad..734a95428097b6b78773d60f3d462a42ef62db5d 100644 (file)
@@ -363,18 +363,18 @@ void cds_atomic_thread_fence(int atomic_index, const char * position) {
 
 void cds_func_entry(const char * funcName) {
        if (!model) return;
-       /*
+
        Thread * th = thread_current();
        uint32_t func_id;
 
        ModelHistory *history = model->get_history();
        if ( !history->getFuncMap()->contains(funcName) ) {
-               /* add func id to func map */
+               // add func id to func map
                func_id = history->get_func_counter();
                history->incr_func_counter();
                history->getFuncMap()->put(funcName, func_id);
 
-               /* add func id to reverse func map */
+               // add func id to reverse func map
                ModelVector<const char *> * func_map_rev = history->getFuncMapRev();
                if ( func_map_rev->size() <= func_id )
                        func_map_rev->resize( func_id + 1 );
@@ -384,12 +384,11 @@ void cds_func_entry(const char * funcName) {
        }
 
        history->enter_function(func_id, th->get_id());
-       */
 }
 
 void cds_func_exit(const char * funcName) {
        if (!model) return;
-       /*
+
        Thread * th = thread_current();
        uint32_t func_id;
 
@@ -397,5 +396,4 @@ void cds_func_exit(const char * funcName) {
        func_id = history->getFuncMap()->get(funcName);
 
        history->exit_function(func_id, th->get_id());
-       */
 }
index d81c50fb5f3ffde57279c8b001c59a53dc003351..4ddba7b59ec6792237e0a46c57473ea92988dcac 100644 (file)
@@ -123,6 +123,9 @@ void ModelHistory::link_insts(func_inst_list_t * inst_list)
        func_inst_list_t::iterator it = inst_list->begin();
        func_inst_list_t::iterator prev;
 
+       if (inst_list->size() == 0)
+               return;
+
        /* add the first instruction to the list of entry insts */
        FuncInst * entry_inst = *it;
        FuncNode * func_node = entry_inst->get_func_node();