X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ea9cce21b6d3f37823143217f1ca183bb2f0c9ac..b5a933f5e08d4a47ab3ac8b3a7c381f53a057ddc:/src/mc/mc_visited.cpp diff --git a/src/mc/mc_visited.cpp b/src/mc/mc_visited.cpp index 3fd5249198..59c43c5c1a 100644 --- a/src/mc/mc_visited.cpp +++ b/src/mc/mc_visited.cpp @@ -37,9 +37,8 @@ static int is_exploration_stack_state(mc_visited_state_t state){ void visited_state_free(mc_visited_state_t state) { if (state) { - if(!is_exploration_stack_state(state)){ - MC_free_snapshot(state->system_state); - } + if(!is_exploration_stack_state(state)) + delete state->system_state; xbt_free(state); } } @@ -55,18 +54,18 @@ void visited_state_free_voidp(void *s) */ static mc_visited_state_t visited_state_new() { - mc_process_t process = &(mc_model_checker->process); + simgrid::mc::Process* process = &(mc_model_checker->process()); mc_visited_state_t new_state = xbt_new0(s_mc_visited_state_t, 1); new_state->heap_bytes_used = mmalloc_get_bytes_used_remote( - MC_process_get_heap(process)->heaplimit, - MC_process_get_malloc_info(process)); + process->get_heap()->heaplimit, + process->get_malloc_info()); - if (MC_process_is_self(&mc_model_checker->process)) { + if (mc_model_checker->process().is_self()) { new_state->nb_processes = xbt_swag_size(simix_global->process_list); } else { - MC_process_smx_refresh(&mc_model_checker->process); + MC_process_smx_refresh(&mc_model_checker->process()); new_state->nb_processes = xbt_dynar_length( - mc_model_checker->process.smx_process_infos); + mc_model_checker->process().smx_process_infos); } new_state->system_state = MC_take_snapshot(mc_stats->expanded_states); @@ -77,21 +76,21 @@ static mc_visited_state_t visited_state_new() mc_visited_pair_t MC_visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state) { - mc_process_t process = &(mc_model_checker->process); + simgrid::mc::Process* process = &(mc_model_checker->process()); mc_visited_pair_t pair = NULL; pair = xbt_new0(s_mc_visited_pair_t, 1); pair->graph_state = graph_state; if(pair->graph_state->system_state == NULL) pair->graph_state->system_state = MC_take_snapshot(pair_num); pair->heap_bytes_used = mmalloc_get_bytes_used_remote( - MC_process_get_heap(process)->heaplimit, - MC_process_get_malloc_info(process)); - if (MC_process_is_self(&mc_model_checker->process)) { + process->get_heap()->heaplimit, + process->get_malloc_info()); + if (mc_model_checker->process().is_self()) { pair->nb_processes = xbt_swag_size(simix_global->process_list); } else { - MC_process_smx_refresh(&mc_model_checker->process); + MC_process_smx_refresh(&mc_model_checker->process()); pair->nb_processes = xbt_dynar_length( - mc_model_checker->process.smx_process_infos); + mc_model_checker->process().smx_process_infos); } pair->automaton_state = automaton_state; pair->num = pair_num; @@ -147,9 +146,6 @@ void MC_visited_pair_delete(mc_visited_pair_t p) */ int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max) { - - xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap); - int cursor = 0, previous_cursor; int nb_processes, heap_bytes_used, nb_processes_test, heap_bytes_used_test; void *ref_test; @@ -219,13 +215,10 @@ int get_search_interval(xbt_dynar_t list, void *ref, int *min, int *max) *max = next_cursor; next_cursor++; } - mmalloc_set_current_heap(heap); return -1; } } } - - mmalloc_set_current_heap(heap); return cursor; } @@ -257,8 +250,6 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state) } } - xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap); - mc_visited_state_t new_state = visited_state_new(); graph_state->system_state = new_state->system_state; graph_state->in_visited_states = 1; @@ -267,7 +258,6 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state) if (xbt_dynar_is_empty(visited_states)) { xbt_dynar_push(visited_states, &new_state); - mmalloc_set_current_heap(heap); return NULL; } else { @@ -295,8 +285,6 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state) XBT_DEBUG("State %d already visited ! (equal to state %d (state %d in dot_output))", new_state->num, state_test->num, new_state->other_num); xbt_dynar_remove_at(visited_states, (min + res) - 1, NULL); xbt_dynar_insert_at(visited_states, (min+res) - 1, &new_state); - if(!raw_mem_set) - MC_SET_STD_HEAP; return new_state->other_num; } */ @@ -325,7 +313,6 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state) xbt_dynar_insert_at(visited_states, cursor, &new_state); XBT_DEBUG("Replace visited state %d with the new visited state %d", state_test->num, new_state->num); - mmalloc_set_current_heap(heap); return state_test; } cursor++; @@ -362,7 +349,7 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state) unsigned int cursor2 = 0; unsigned int index2 = 0; xbt_dynar_foreach(visited_states, cursor2, state_test){ - if (!mc_important_snapshot(state_test->system_state) && state_test->num < min2) { + if (state_test->num < min2) { index2 = cursor2; min2 = state_test->num; } @@ -373,7 +360,6 @@ mc_visited_state_t is_visited_state(mc_state_t graph_state) XBT_DEBUG("Remove visited state (maximum number of stored states reached)"); } - mmalloc_set_current_heap(heap); return NULL; } } @@ -386,8 +372,6 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) { if (_sg_mc_visited == 0) return -1; - xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap); - mc_visited_pair_t new_visited_pair = NULL; if (visited_pair == NULL) { @@ -433,8 +417,6 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) { MC_pair_delete(pair_test); } } - if(!raw_mem_set) - MC_SET_STD_HEAP; return pair->other_num; } */ cursor = min; @@ -460,7 +442,6 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) { } else { MC_visited_pair_delete(pair_test); } - mmalloc_set_current_heap(heap); return new_visited_pair->other_num; } } @@ -485,7 +466,7 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) { unsigned int cursor2 = 0; unsigned int index2 = 0; xbt_dynar_foreach(visited_pairs, cursor2, pair_test) { - if (!mc_important_snapshot(pair_test->graph_state->system_state) && pair_test->num < min2) { + if (pair_test->num < min2) { index2 = cursor2; min2 = pair_test->num; } @@ -501,8 +482,6 @@ int is_visited_pair(mc_visited_pair_t visited_pair, mc_pair_t pair) { } } - - mmalloc_set_current_heap(heap); return -1; }