4 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
5 "Logging specific to algorithms for liveness properties verification");
7 xbt_dynar_t reached_pairs;
8 xbt_dynar_t reached_pairs_hash;
9 xbt_dynar_t visited_pairs;
10 xbt_dynar_t visited_pairs_hash;
11 xbt_dynar_t successors;
14 /* fast implementation of djb2 algorithm */
15 unsigned int hash_region(char *str, int str_len){
18 register unsigned int hash = 5381;
22 hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
29 int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
32 if(s1->num_reg != s2->num_reg){
33 //XBT_DEBUG("Different num_reg (s1 = %d, s2 = %d)", s1->num_reg, s2->num_reg);
39 for(i=0 ; i< s1->num_reg ; i++){
41 if(s1->regions[i]->type != s2->regions[i]->type){
42 //XBT_DEBUG("Different type of region");
46 switch(s1->regions[i]->type){
48 if(s1->regions[i]->size != s2->regions[i]->size){
49 //XBT_DEBUG("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
52 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
53 //XBT_DEBUG("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
56 if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){
57 //XBT_DEBUG("Different heap (mmalloc_compare)");
62 if(s1->regions[i]->size != s2->regions[i]->size){
63 //XBT_DEBUG("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
66 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
67 //XBT_DEBUG("Different start addr of libsimgrid (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
70 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
71 //XBT_DEBUG("Different memcmp for data in libsimgrid");
76 if(s1->regions[i]->size != s2->regions[i]->size){
77 //XBT_DEBUG("Different size of program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
80 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
81 //XBT_DEBUG("Different start addr of program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
84 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
85 //XBT_DEBUG("Different memcmp for data in program");
90 if(s1->regions[i]->size != s2->regions[i]->size){
91 //XBT_DEBUG("Different size of stack (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
94 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
95 //XBT_DEBUG("Different start addr of stack (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
98 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
99 //XBT_DEBUG("Different memcmp for data in stack");
110 int reached(xbt_state_t st){
113 if(xbt_dynar_is_empty(reached_pairs)){
121 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
122 MC_take_snapshot_liveness(sn);
124 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
128 /* Get values of propositional symbols */
129 unsigned int cursor = 0;
130 xbt_propositional_symbol_t ps = NULL;
131 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
134 xbt_dynar_push_as(prop_ato, int, res);
138 mc_pair_reached_t pair_test = NULL;
141 xbt_dynar_foreach(reached_pairs, cursor, pair_test){
142 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
143 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
144 if(snapshot_compare(pair_test->system_state, sn) == 0){
145 MC_free_snapshot(sn);
146 xbt_dynar_reset(prop_ato);
155 MC_free_snapshot(sn);
156 xbt_dynar_reset(prop_ato);
164 void set_pair_reached(xbt_state_t st){
169 mc_pair_reached_t pair = NULL;
170 pair = xbt_new0(s_mc_pair_reached_t, 1);
171 pair->automaton_state = st;
172 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
173 pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
174 MC_take_snapshot_liveness(pair->system_state);
176 /* Get values of propositional symbols */
177 unsigned int cursor = 0;
178 xbt_propositional_symbol_t ps = NULL;
182 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
185 xbt_dynar_push_as(pair->prop_ato, int, res);
188 xbt_dynar_push(reached_pairs, &pair);
194 int reached_hash(xbt_state_t st){
197 if(xbt_dynar_is_empty(reached_pairs_hash)){
205 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
206 MC_take_snapshot_liveness(sn);
209 unsigned int hash_regions[sn->num_reg];
210 for(j=0; j<sn->num_reg; j++){
211 hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
215 /* Get values of propositional symbols */
216 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
217 unsigned int cursor = 0;
218 xbt_propositional_symbol_t ps = NULL;
222 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
225 xbt_dynar_push_as(prop_ato, int, res);
228 mc_pair_reached_hash_t pair_test = NULL;
234 xbt_dynar_foreach(reached_pairs_hash, cursor, pair_test){
236 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
237 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
238 for(j=0 ; j< sn->num_reg ; j++){
239 if(hash_regions[j] != pair_test->hash_regions[j]){
243 if(region_diff == 0){
244 MC_free_snapshot(sn);
245 xbt_dynar_reset(prop_ato);
257 MC_free_snapshot(sn);
258 xbt_dynar_reset(prop_ato);
266 void set_pair_reached_hash(xbt_state_t st){
270 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
271 MC_take_snapshot_liveness(sn);
273 mc_pair_reached_hash_t pair = NULL;
274 pair = xbt_new0(s_mc_pair_reached_hash_t, 1);
275 pair->automaton_state = st;
276 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
277 pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
281 for(i=0 ; i< sn->num_reg ; i++){
282 pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
285 /* Get values of propositional symbols */
286 unsigned int cursor = 0;
287 xbt_propositional_symbol_t ps = NULL;
291 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
294 xbt_dynar_push_as(pair->prop_ato, int, res);
297 xbt_dynar_push(reached_pairs_hash, &pair);
299 MC_free_snapshot(sn);
306 int visited(xbt_state_t st, int sc){
309 if(xbt_dynar_is_empty(visited_pairs)){
317 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
318 MC_take_snapshot_liveness(sn);
320 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
322 /* Get values of propositional symbols */
323 unsigned int cursor = 0;
324 xbt_propositional_symbol_t ps = NULL;
328 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
331 xbt_dynar_push_as(prop_ato, int, res);
335 mc_pair_visited_t pair_test = NULL;
337 xbt_dynar_foreach(visited_pairs, cursor, pair_test){
338 if(pair_test->search_cycle == sc) {
339 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
340 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
341 if(snapshot_compare(pair_test->system_state, sn) == 0){
343 MC_free_snapshot(sn);
344 xbt_dynar_reset(prop_ato);
357 MC_free_snapshot(sn);
358 xbt_dynar_reset(prop_ato);
367 int visited_hash(xbt_state_t st, int sc){
370 if(xbt_dynar_is_empty(visited_pairs_hash)){
378 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
379 MC_take_snapshot_liveness(sn);
382 unsigned int hash_regions[sn->num_reg];
383 for(j=0; j<sn->num_reg; j++){
384 hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
388 /* Get values of propositional symbols */
389 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
390 unsigned int cursor = 0;
391 xbt_propositional_symbol_t ps = NULL;
395 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
398 xbt_dynar_push_as(prop_ato, int, res);
401 mc_pair_visited_hash_t pair_test = NULL;
406 xbt_dynar_foreach(visited_pairs_hash, cursor, pair_test){
408 if(pair_test->search_cycle == sc) {
409 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
410 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
411 for(j=0 ; j< sn->num_reg ; j++){
412 if(hash_regions[j] != pair_test->hash_regions[j]){
416 if(region_diff == 0){
417 MC_free_snapshot(sn);
418 xbt_dynar_reset(prop_ato);
430 MC_free_snapshot(sn);
431 xbt_dynar_reset(prop_ato);
439 void set_pair_visited_hash(xbt_state_t st, int sc){
443 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
444 MC_take_snapshot_liveness(sn);
446 mc_pair_visited_hash_t pair = NULL;
447 pair = xbt_new0(s_mc_pair_visited_hash_t, 1);
448 pair->automaton_state = st;
449 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
450 pair->search_cycle = sc;
451 pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
455 for(i=0 ; i< sn->num_reg ; i++){
456 pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
459 /* Get values of propositional symbols */
460 unsigned int cursor = 0;
461 xbt_propositional_symbol_t ps = NULL;
465 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
468 xbt_dynar_push_as(pair->prop_ato, int, res);
471 xbt_dynar_push(visited_pairs_hash, &pair);
473 MC_free_snapshot(sn);
479 void set_pair_visited(xbt_state_t st, int sc){
484 mc_pair_visited_t pair = NULL;
485 pair = xbt_new0(s_mc_pair_visited_t, 1);
486 pair->automaton_state = st;
487 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
488 pair->search_cycle = sc;
489 pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
490 MC_take_snapshot_liveness(pair->system_state);
493 /* Get values of propositional symbols */
494 unsigned int cursor = 0;
495 xbt_propositional_symbol_t ps = NULL;
499 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
502 xbt_dynar_push_as(pair->prop_ato, int, res);
505 xbt_dynar_push(visited_pairs, &pair);
512 void MC_pair_delete(mc_pair_t pair){
513 xbt_free(pair->graph_state->proc_status);
514 xbt_free(pair->graph_state);
520 int MC_automaton_evaluate_label(xbt_exp_label_t l){
524 int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
525 int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
526 return (left_res || right_res);
530 int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
531 int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
532 return (left_res && right_res);
536 int res = MC_automaton_evaluate_label(l->u.exp_not);
541 unsigned int cursor = 0;
542 xbt_propositional_symbol_t p = NULL;
544 xbt_dynar_foreach(automaton->propositional_symbols, cursor, p){
545 if(strcmp(p->pred, l->u.predicat) == 0){
566 /********************* Double-DFS stateless *******************/
568 void MC_pair_stateless_delete(mc_pair_stateless_t pair){
569 xbt_free(pair->graph_state->proc_status);
570 xbt_free(pair->graph_state);
574 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st, int r){
575 mc_pair_stateless_t p = NULL;
576 p = xbt_new0(s_mc_pair_stateless_t, 1);
577 p->automaton_state = st;
580 mc_stats_pair->expanded_pairs++;
584 void MC_ddfs_init(void){
586 XBT_DEBUG("**************************************************");
587 XBT_DEBUG("Double-DFS init");
588 XBT_DEBUG("**************************************************");
590 mc_pair_stateless_t mc_initial_pair = NULL;
591 mc_state_t initial_graph_state = NULL;
592 smx_process_t process;
594 MC_wait_for_requests();
598 initial_graph_state = MC_state_pair_new();
599 xbt_swag_foreach(process, simix_global->process_list){
600 if(MC_process_is_enabled(process)){
601 MC_state_interleave_process(initial_graph_state, process);
605 //reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
606 reached_pairs_hash = xbt_dynar_new(sizeof(mc_pair_reached_hash_t), NULL);
607 //visited_pairs = xbt_dynar_new(sizeof(mc_pair_visited_t), NULL);
608 visited_pairs_hash = xbt_dynar_new(sizeof(mc_pair_visited_hash_t), NULL);
609 successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
611 /* Save the initial state */
612 initial_snapshot_liveness = xbt_new0(s_mc_snapshot_t, 1);
613 MC_take_snapshot_to_restore_liveness(initial_snapshot_liveness);
617 unsigned int cursor = 0;
620 xbt_dynar_foreach(automaton->states, cursor, state){
621 if(state->type == -1){
624 mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
625 xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
629 MC_restore_snapshot(initial_snapshot_liveness);
636 if(state->type == 2){
639 mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
640 xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
643 //set_pair_reached(state);
644 set_pair_reached_hash(state);
647 MC_restore_snapshot(initial_snapshot_liveness);
660 void MC_ddfs(int search_cycle){
662 smx_process_t process;
663 mc_pair_stateless_t current_pair = NULL;
665 if(xbt_fifo_size(mc_stack_liveness) == 0)
669 /* Get current pair */
670 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness));
672 /* Update current state in buchi automaton */
673 automaton->current_state = current_pair->automaton_state;
676 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness), search_cycle);
677 XBT_DEBUG("Pair : graph=%p, automaton=%p(%s), %u interleave", current_pair->graph_state, current_pair->automaton_state, current_pair->automaton_state->id, MC_state_interleave_size(current_pair->graph_state));
679 mc_stats_pair->visited_pairs++;
684 mc_state_t next_graph_state = NULL;
685 smx_req_t req = NULL;
688 xbt_transition_t transition_succ;
689 unsigned int cursor = 0;
692 mc_pair_stateless_t next_pair = NULL;
693 mc_pair_stateless_t pair_succ;
695 if(xbt_fifo_size(mc_stack_liveness) < MAX_DEPTH_LIVENESS){
697 //set_pair_visited(current_pair->automaton_state, search_cycle);
698 set_pair_visited_hash(current_pair->automaton_state, search_cycle);
700 //XBT_DEBUG("Visited pairs : %lu", xbt_dynar_length(visited_pairs));
701 XBT_DEBUG("Visited pairs : %lu", xbt_dynar_length(visited_pairs_hash));
703 if(current_pair->requests > 0){
705 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
707 /* Debug information */
708 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
709 req_str = MC_request_to_string(req, value);
710 XBT_DEBUG("Execute: %s", req_str);
714 MC_state_set_executed_request(current_pair->graph_state, req, value);
716 /* Answer the request */
717 SIMIX_request_pre(req, value);
719 /* Wait for requests (schedules processes) */
720 MC_wait_for_requests();
725 /* Create the new expanded graph_state */
726 next_graph_state = MC_state_pair_new();
728 /* Get enabled process and insert it in the interleave set of the next graph_state */
729 xbt_swag_foreach(process, simix_global->process_list){
730 if(MC_process_is_enabled(process)){
731 MC_state_interleave_process(next_graph_state, process);
735 xbt_dynar_reset(successors);
741 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
743 res = MC_automaton_evaluate_label(transition_succ->label);
745 if(res == 1){ // enabled transition in automaton
747 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
748 xbt_dynar_push(successors, &next_pair);
756 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
758 res = MC_automaton_evaluate_label(transition_succ->label);
760 if(res == 2){ // true transition in automaton
762 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
763 xbt_dynar_push(successors, &next_pair);
771 xbt_dynar_foreach(successors, cursor, pair_succ){
773 if(search_cycle == 1){
775 if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){
777 //if(reached(pair_succ->automaton_state)){
778 if(reached_hash(pair_succ->automaton_state)){
780 XBT_DEBUG("Next pair (depth = %d, %d interleave) already reached !", xbt_fifo_size(mc_stack_liveness) + 1, MC_state_interleave_size(pair_succ->graph_state));
782 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
783 XBT_INFO("| ACCEPTANCE CYCLE |");
784 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
785 XBT_INFO("Counter-example that violates formula :");
786 MC_show_stack_liveness(mc_stack_liveness);
787 MC_dump_stack_liveness(mc_stack_liveness);
788 MC_print_statistics_pairs(mc_stats_pair);
793 XBT_DEBUG("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
795 //set_pair_reached(pair_succ->automaton_state);
796 set_pair_reached_hash(pair_succ->automaton_state);
798 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
799 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
802 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
805 MC_ddfs(search_cycle);
811 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
812 //if(!visited(pair_succ->automaton_state, search_cycle)){
815 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
818 MC_ddfs(search_cycle);
822 XBT_DEBUG("Next pair already visited ! ");
830 if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
832 XBT_DEBUG("Next pair (depth =%d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
834 //set_pair_reached(pair_succ->automaton_state);
835 set_pair_reached_hash(pair_succ->automaton_state);
839 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
840 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
844 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
845 //if(!visited(pair_succ->automaton_state, search_cycle)){
848 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
851 MC_ddfs(search_cycle);
855 XBT_DEBUG("Next pair already visited ! ");
862 /* Restore system before checking others successors */
863 if(cursor != (xbt_dynar_length(successors) - 1))
864 MC_replay_liveness(mc_stack_liveness, 1);
869 if(MC_state_interleave_size(current_pair->graph_state) > 0){
870 XBT_DEBUG("Backtracking to depth %u", xbt_fifo_size(mc_stack_liveness));
871 MC_replay_liveness(mc_stack_liveness, 0);
876 }else{ /*No request to execute, search evolution in Büchi automaton */
880 /* Create the new expanded graph_state */
881 next_graph_state = MC_state_pair_new();
883 xbt_dynar_reset(successors);
889 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
891 res = MC_automaton_evaluate_label(transition_succ->label);
893 if(res == 1){ // enabled transition in automaton
895 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
896 xbt_dynar_push(successors, &next_pair);
904 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
906 res = MC_automaton_evaluate_label(transition_succ->label);
908 if(res == 2){ // true transition in automaton
910 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
911 xbt_dynar_push(successors, &next_pair);
919 xbt_dynar_foreach(successors, cursor, pair_succ){
921 if(search_cycle == 1){
923 if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){
925 //if(reached(pair_succ->automaton_state)){
926 if(reached_hash(pair_succ->automaton_state)){
928 XBT_DEBUG("Next pair (depth = %d) already reached !", xbt_fifo_size(mc_stack_liveness) + 1);
930 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
931 XBT_INFO("| ACCEPTANCE CYCLE |");
932 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
933 XBT_INFO("Counter-example that violates formula :");
934 MC_show_stack_liveness(mc_stack_liveness);
935 MC_dump_stack_liveness(mc_stack_liveness);
936 MC_print_statistics_pairs(mc_stats_pair);
941 XBT_DEBUG("Next pair (depth = %d) -> Acceptance pair : graph=%p, automaton=%p(%s)", xbt_fifo_size(mc_stack_liveness) + 1, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
943 //set_pair_reached(pair_succ->automaton_state);
944 set_pair_reached_hash(pair_succ->automaton_state);
946 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
947 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
950 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
953 MC_ddfs(search_cycle);
959 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
960 //if(!visited(pair_succ->automaton_state, search_cycle)){
963 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
966 MC_ddfs(search_cycle);
970 XBT_DEBUG("Next pair already visited ! ");
978 if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
980 //set_pair_reached(pair_succ->automaton_state);
981 set_pair_reached_hash(pair_succ->automaton_state);
985 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
986 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
990 //if(!visited_hash(pair_succ->automaton_state, search_cycle)){
991 if(!visited(pair_succ->automaton_state, search_cycle)){
994 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
997 MC_ddfs(search_cycle);
1001 XBT_DEBUG("Next pair already visited ! ");
1007 /* Restore system before checking others successors */
1008 if(cursor != xbt_dynar_length(successors) - 1)
1009 MC_replay_liveness(mc_stack_liveness, 1);
1018 XBT_DEBUG("Max depth reached");
1022 if(xbt_fifo_size(mc_stack_liveness) == MAX_DEPTH_LIVENESS ){
1023 XBT_DEBUG("Pair (graph=%p, automaton =%p, search_cycle = %u, depth = %d) shifted in stack, maximum depth reached", current_pair->graph_state, current_pair->automaton_state, search_cycle, xbt_fifo_size(mc_stack_liveness) );
1025 XBT_DEBUG("Pair (graph=%p, automaton =%p, search_cycle = %u, depth = %d) shifted in stack", current_pair->graph_state, current_pair->automaton_state, search_cycle, xbt_fifo_size(mc_stack_liveness) );
1030 xbt_fifo_shift(mc_stack_liveness);
1031 if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){
1032 //xbt_dynar_pop(reached_pairs, NULL);
1033 xbt_dynar_pop(reached_pairs_hash, NULL);