diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index 4ee2d8a86..c5890f5e2 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -50,22 +50,6 @@ extern const char hex_digits[256]; extern const char oct_digits[64]; - -#ifdef CHECK_WITH_VALGRIND -static map handle_map; - -void thread_vthr_delete(vpiHandle item) -{ - handle_map[item] = true; -} - -static void thread_vthr_delete_real(vpiHandle item) -{ - struct __vpiVThrVec*obj = dynamic_cast<__vpiVThrVec*>(item); - delete obj; -} -#endif - struct __vpiVThrWord : public __vpiHandle { __vpiVThrWord(); int get_type_code(void) const; @@ -200,6 +184,8 @@ vpiHandle vpip_make_vthr_word(unsigned base, const char*type) } #ifdef CHECK_WITH_VALGRIND +static map handle_map; + void thread_word_delete(vpiHandle item) { handle_map[item] = false; @@ -210,15 +196,6 @@ static void thread_word_delete_real(vpiHandle item) struct __vpiVThrWord*obj = dynamic_cast<__vpiVThrWord*>(item); delete obj; } - -void vpi_handle_delete() -{ - map::iterator iter; - for (iter = handle_map.begin(); iter != handle_map.end(); ++ iter ) { - if (iter->second) thread_vthr_delete_real(iter->first); - else thread_word_delete_real(iter->first); - } -} #endif class __vpiVThrStrStack : public __vpiHandle { @@ -547,6 +524,29 @@ vpiHandle __vpiVThrVec4Stack::vpi_put_value(p_vpi_value vp, int /*flags*/) } } +#ifdef CHECK_WITH_VALGRIND +void thread_vthr_delete(vpiHandle item) +{ + handle_map[item] = true; +} + +static void thread_vthr_delete_real(vpiHandle item) +{ + class __vpiVThrVec4Stack*obj = dynamic_cast<__vpiVThrVec4Stack*>(item); + delete obj; +} + +void vpi_handle_delete() +{ + map::iterator iter; + for (iter = handle_map.begin(); iter != handle_map.end(); ++ iter ) { + if (iter->second) thread_vthr_delete_real(iter->first); + else thread_word_delete_real(iter->first); + } +} +#endif + + vpiHandle vpip_make_vthr_str_stack(unsigned depth) { class __vpiVThrStrStack*obj = new __vpiVThrStrStack(depth);