From 3a9f39376685cfded500079d79790d87d581aea4 Mon Sep 17 00:00:00 2001 From: weiyu Date: Fri, 12 Jul 2019 12:09:12 -0700 Subject: [PATCH] fix a bug --- cmodelint.cc | 10 ++++------ history.cc | 3 +++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmodelint.cc b/cmodelint.cc index c42ffe41..734a9542 100644 --- a/cmodelint.cc +++ b/cmodelint.cc @@ -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 * 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()); - */ } diff --git a/history.cc b/history.cc index d81c50fb..4ddba7b5 100644 --- a/history.cc +++ b/history.cc @@ -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(); -- 2.34.1