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);
40 for(i=0 ; i< s1->num_reg ; i++){
42 if(s1->regions[i]->type != s2->regions[i]->type){
43 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
44 XBT_DEBUG("Different type of region");
51 switch(s1->regions[i]->type){
53 if(s1->regions[i]->size != s2->regions[i]->size){
54 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
55 XBT_DEBUG("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
61 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
62 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
63 XBT_DEBUG("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
69 if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){
70 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
71 XBT_DEBUG("Different heap (mmalloc_compare)");
79 if(s1->regions[i]->size != s2->regions[i]->size){
80 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
81 XBT_DEBUG("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
87 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
88 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
89 XBT_DEBUG("Different start addr of libsimgrid (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
95 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
96 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
97 XBT_DEBUG("Different memcmp for data in libsimgrid");
105 if(s1->regions[i]->size != s2->regions[i]->size){
106 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
107 XBT_DEBUG("Different size of program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
113 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
114 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
115 XBT_DEBUG("Different start addr of program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
121 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
122 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
123 XBT_DEBUG("Different memcmp for data in program");
131 if(s1->regions[i]->size != s2->regions[i]->size){
132 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
133 XBT_DEBUG("Different size of stack (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size);
139 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){
140 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
141 XBT_DEBUG("Different start addr of stack (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr);
147 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){
148 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
149 XBT_DEBUG("Different memcmp for data in stack");
161 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
169 int reached(xbt_state_t st){
172 if(xbt_dynar_is_empty(reached_pairs)){
180 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
181 MC_take_snapshot_liveness(sn);
183 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
187 /* Get values of propositional symbols */
188 unsigned int cursor = 0;
189 xbt_propositional_symbol_t ps = NULL;
190 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
193 xbt_dynar_push_as(prop_ato, int, res);
197 mc_pair_reached_t pair_test = NULL;
200 xbt_dynar_foreach(reached_pairs, cursor, pair_test){
201 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
202 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
203 XBT_DEBUG("Pair reached %d", cursor+1);
204 if(snapshot_compare(pair_test->system_state, sn) == 0){
205 MC_free_snapshot(sn);
206 xbt_dynar_reset(prop_ato);
215 MC_free_snapshot(sn);
216 xbt_dynar_reset(prop_ato);
224 void set_pair_reached(xbt_state_t st){
229 mc_pair_reached_t pair = NULL;
230 pair = xbt_new0(s_mc_pair_reached_t, 1);
231 pair->automaton_state = st;
232 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
233 pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
234 MC_take_snapshot_liveness(pair->system_state);
236 /* Get values of propositional symbols */
237 unsigned int cursor = 0;
238 xbt_propositional_symbol_t ps = NULL;
242 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
245 xbt_dynar_push_as(pair->prop_ato, int, res);
248 xbt_dynar_push(reached_pairs, &pair);
254 int reached_hash(xbt_state_t st){
257 if(xbt_dynar_is_empty(reached_pairs_hash)){
265 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
266 MC_take_snapshot_liveness(sn);
269 unsigned int hash_regions[sn->num_reg];
270 for(j=0; j<sn->num_reg; j++){
271 hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
275 /* Get values of propositional symbols */
276 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
277 unsigned int cursor = 0;
278 xbt_propositional_symbol_t ps = NULL;
282 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
285 xbt_dynar_push_as(prop_ato, int, res);
288 mc_pair_reached_hash_t pair_test = NULL;
294 xbt_dynar_foreach(reached_pairs_hash, cursor, pair_test){
296 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
297 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
298 for(j=0 ; j< sn->num_reg ; j++){
299 if(hash_regions[j] != pair_test->hash_regions[j]){
303 if(region_diff == 0){
304 MC_free_snapshot(sn);
305 xbt_dynar_reset(prop_ato);
317 MC_free_snapshot(sn);
318 xbt_dynar_reset(prop_ato);
326 void set_pair_reached_hash(xbt_state_t st){
330 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
331 MC_take_snapshot_liveness(sn);
333 mc_pair_reached_hash_t pair = NULL;
334 pair = xbt_new0(s_mc_pair_reached_hash_t, 1);
335 pair->automaton_state = st;
336 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
337 pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
341 for(i=0 ; i< sn->num_reg ; i++){
342 pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
345 /* Get values of propositional symbols */
346 unsigned int cursor = 0;
347 xbt_propositional_symbol_t ps = NULL;
351 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
354 xbt_dynar_push_as(pair->prop_ato, int, res);
357 xbt_dynar_push(reached_pairs_hash, &pair);
359 MC_free_snapshot(sn);
366 int visited(xbt_state_t st, int sc){
369 if(xbt_dynar_is_empty(visited_pairs)){
377 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
378 MC_take_snapshot_liveness(sn);
380 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
382 /* Get values of propositional symbols */
383 unsigned int cursor = 0;
384 xbt_propositional_symbol_t ps = NULL;
388 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
391 xbt_dynar_push_as(prop_ato, int, res);
395 mc_pair_visited_t pair_test = NULL;
397 xbt_dynar_foreach(visited_pairs, cursor, pair_test){
398 if(pair_test->search_cycle == sc) {
399 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
400 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
401 if(snapshot_compare(pair_test->system_state, sn) == 0){
403 MC_free_snapshot(sn);
404 xbt_dynar_reset(prop_ato);
417 MC_free_snapshot(sn);
418 xbt_dynar_reset(prop_ato);
427 int visited_hash(xbt_state_t st, int sc){
430 if(xbt_dynar_is_empty(visited_pairs_hash)){
438 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
439 MC_take_snapshot_liveness(sn);
442 unsigned int hash_regions[sn->num_reg];
443 for(j=0; j<sn->num_reg; j++){
444 hash_regions[j] = hash_region(sn->regions[j]->data, sn->regions[j]->size);
448 /* Get values of propositional symbols */
449 xbt_dynar_t prop_ato = xbt_dynar_new(sizeof(int), NULL);
450 unsigned int cursor = 0;
451 xbt_propositional_symbol_t ps = NULL;
455 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
458 xbt_dynar_push_as(prop_ato, int, res);
461 mc_pair_visited_hash_t pair_test = NULL;
466 xbt_dynar_foreach(visited_pairs_hash, cursor, pair_test){
468 if(pair_test->search_cycle == sc) {
469 if(automaton_state_compare(pair_test->automaton_state, st) == 0){
470 if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){
471 for(j=0 ; j< sn->num_reg ; j++){
472 if(hash_regions[j] != pair_test->hash_regions[j]){
476 if(region_diff == 0){
477 MC_free_snapshot(sn);
478 xbt_dynar_reset(prop_ato);
490 MC_free_snapshot(sn);
491 xbt_dynar_reset(prop_ato);
499 void set_pair_visited_hash(xbt_state_t st, int sc){
503 mc_snapshot_t sn = xbt_new0(s_mc_snapshot_t, 1);
504 MC_take_snapshot_liveness(sn);
506 mc_pair_visited_hash_t pair = NULL;
507 pair = xbt_new0(s_mc_pair_visited_hash_t, 1);
508 pair->automaton_state = st;
509 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
510 pair->search_cycle = sc;
511 pair->hash_regions = malloc(sizeof(unsigned int) * sn->num_reg);
515 for(i=0 ; i< sn->num_reg ; i++){
516 pair->hash_regions[i] = hash_region(sn->regions[i]->data, sn->regions[i]->size);
519 /* Get values of propositional symbols */
520 unsigned int cursor = 0;
521 xbt_propositional_symbol_t ps = NULL;
525 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
528 xbt_dynar_push_as(pair->prop_ato, int, res);
531 xbt_dynar_push(visited_pairs_hash, &pair);
533 MC_free_snapshot(sn);
539 void set_pair_visited(xbt_state_t st, int sc){
544 mc_pair_visited_t pair = NULL;
545 pair = xbt_new0(s_mc_pair_visited_t, 1);
546 pair->automaton_state = st;
547 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
548 pair->search_cycle = sc;
549 pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
550 MC_take_snapshot_liveness(pair->system_state);
553 /* Get values of propositional symbols */
554 unsigned int cursor = 0;
555 xbt_propositional_symbol_t ps = NULL;
559 xbt_dynar_foreach(automaton->propositional_symbols, cursor, ps){
562 xbt_dynar_push_as(pair->prop_ato, int, res);
565 xbt_dynar_push(visited_pairs, &pair);
572 void MC_pair_delete(mc_pair_t pair){
573 xbt_free(pair->graph_state->proc_status);
574 xbt_free(pair->graph_state);
580 int MC_automaton_evaluate_label(xbt_exp_label_t l){
584 int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
585 int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
586 return (left_res || right_res);
590 int left_res = MC_automaton_evaluate_label(l->u.or_and.left_exp);
591 int right_res = MC_automaton_evaluate_label(l->u.or_and.right_exp);
592 return (left_res && right_res);
596 int res = MC_automaton_evaluate_label(l->u.exp_not);
601 unsigned int cursor = 0;
602 xbt_propositional_symbol_t p = NULL;
604 xbt_dynar_foreach(automaton->propositional_symbols, cursor, p){
605 if(strcmp(p->pred, l->u.predicat) == 0){
626 /********************* Double-DFS stateless *******************/
628 void MC_pair_stateless_delete(mc_pair_stateless_t pair){
629 xbt_free(pair->graph_state->proc_status);
630 xbt_free(pair->graph_state);
634 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st, int r){
635 mc_pair_stateless_t p = NULL;
636 p = xbt_new0(s_mc_pair_stateless_t, 1);
637 p->automaton_state = st;
640 mc_stats_pair->expanded_pairs++;
644 void MC_ddfs_init(void){
646 XBT_DEBUG("**************************************************");
647 XBT_DEBUG("Double-DFS init");
648 XBT_DEBUG("**************************************************");
650 mc_pair_stateless_t mc_initial_pair = NULL;
651 mc_state_t initial_graph_state = NULL;
652 smx_process_t process;
654 MC_wait_for_requests();
658 initial_graph_state = MC_state_pair_new();
659 xbt_swag_foreach(process, simix_global->process_list){
660 if(MC_process_is_enabled(process)){
661 MC_state_interleave_process(initial_graph_state, process);
665 reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
666 //reached_pairs_hash = xbt_dynar_new(sizeof(mc_pair_reached_hash_t), NULL);
667 //visited_pairs = xbt_dynar_new(sizeof(mc_pair_visited_t), NULL);
668 visited_pairs_hash = xbt_dynar_new(sizeof(mc_pair_visited_hash_t), NULL);
669 successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
671 /* Save the initial state */
672 initial_snapshot_liveness = xbt_new0(s_mc_snapshot_t, 1);
673 MC_take_snapshot_to_restore_liveness(initial_snapshot_liveness);
677 unsigned int cursor = 0;
680 xbt_dynar_foreach(automaton->states, cursor, state){
681 if(state->type == -1){
684 mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
685 xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
689 MC_restore_snapshot(initial_snapshot_liveness);
696 if(state->type == 2){
699 mc_initial_pair = new_pair_stateless(initial_graph_state, state, MC_state_interleave_size(initial_graph_state));
700 xbt_fifo_unshift(mc_stack_liveness, mc_initial_pair);
703 set_pair_reached(state);
704 //set_pair_reached_hash(state);
707 MC_restore_snapshot(initial_snapshot_liveness);
720 void MC_ddfs(int search_cycle){
722 smx_process_t process;
723 mc_pair_stateless_t current_pair = NULL;
725 if(xbt_fifo_size(mc_stack_liveness) == 0)
729 /* Get current pair */
730 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness));
732 /* Update current state in buchi automaton */
733 automaton->current_state = current_pair->automaton_state;
736 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness), search_cycle);
737 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));
739 mc_stats_pair->visited_pairs++;
744 mc_state_t next_graph_state = NULL;
745 smx_req_t req = NULL;
748 xbt_transition_t transition_succ;
749 unsigned int cursor = 0;
752 mc_pair_stateless_t next_pair = NULL;
753 mc_pair_stateless_t pair_succ;
755 if(xbt_fifo_size(mc_stack_liveness) < MAX_DEPTH_LIVENESS){
757 //set_pair_visited(current_pair->automaton_state, search_cycle);
758 set_pair_visited_hash(current_pair->automaton_state, search_cycle);
760 //XBT_DEBUG("Visited pairs : %lu", xbt_dynar_length(visited_pairs));
761 XBT_DEBUG("Visited pairs : %lu", xbt_dynar_length(visited_pairs_hash));
763 if(current_pair->requests > 0){
765 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
767 /* Debug information */
768 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
769 req_str = MC_request_to_string(req, value);
770 XBT_DEBUG("Execute: %s", req_str);
774 MC_state_set_executed_request(current_pair->graph_state, req, value);
776 /* Answer the request */
777 SIMIX_request_pre(req, value);
779 /* Wait for requests (schedules processes) */
780 MC_wait_for_requests();
785 /* Create the new expanded graph_state */
786 next_graph_state = MC_state_pair_new();
788 /* Get enabled process and insert it in the interleave set of the next graph_state */
789 xbt_swag_foreach(process, simix_global->process_list){
790 if(MC_process_is_enabled(process)){
791 MC_state_interleave_process(next_graph_state, process);
795 xbt_dynar_reset(successors);
801 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
803 res = MC_automaton_evaluate_label(transition_succ->label);
805 if(res == 1){ // enabled transition in automaton
807 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
808 xbt_dynar_push(successors, &next_pair);
816 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
818 res = MC_automaton_evaluate_label(transition_succ->label);
820 if(res == 2){ // true transition in automaton
822 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
823 xbt_dynar_push(successors, &next_pair);
831 xbt_dynar_foreach(successors, cursor, pair_succ){
833 if(search_cycle == 1){
835 if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){
837 if(reached(pair_succ->automaton_state)){
838 //if(reached_hash(pair_succ->automaton_state)){
840 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));
842 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
843 XBT_INFO("| ACCEPTANCE CYCLE |");
844 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
845 XBT_INFO("Counter-example that violates formula :");
846 MC_show_stack_liveness(mc_stack_liveness);
847 MC_dump_stack_liveness(mc_stack_liveness);
848 MC_print_statistics_pairs(mc_stats_pair);
853 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);
855 set_pair_reached(pair_succ->automaton_state);
856 //set_pair_reached_hash(pair_succ->automaton_state);
858 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
859 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
862 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
865 MC_ddfs(search_cycle);
871 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
872 //if(!visited(pair_succ->automaton_state, search_cycle)){
875 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
878 MC_ddfs(search_cycle);
882 XBT_DEBUG("Next pair already visited ! ");
890 if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
892 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);
894 set_pair_reached(pair_succ->automaton_state);
895 //set_pair_reached_hash(pair_succ->automaton_state);
899 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
900 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
904 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
905 //if(!visited(pair_succ->automaton_state, search_cycle)){
908 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
911 MC_ddfs(search_cycle);
915 XBT_DEBUG("Next pair already visited ! ");
922 /* Restore system before checking others successors */
923 if(cursor != (xbt_dynar_length(successors) - 1))
924 MC_replay_liveness(mc_stack_liveness, 1);
929 if(MC_state_interleave_size(current_pair->graph_state) > 0){
930 XBT_DEBUG("Backtracking to depth %u", xbt_fifo_size(mc_stack_liveness));
931 MC_replay_liveness(mc_stack_liveness, 0);
936 }else{ /*No request to execute, search evolution in Büchi automaton */
940 /* Create the new expanded graph_state */
941 next_graph_state = MC_state_pair_new();
943 xbt_dynar_reset(successors);
949 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
951 res = MC_automaton_evaluate_label(transition_succ->label);
953 if(res == 1){ // enabled transition in automaton
955 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
956 xbt_dynar_push(successors, &next_pair);
964 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
966 res = MC_automaton_evaluate_label(transition_succ->label);
968 if(res == 2){ // true transition in automaton
970 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst, MC_state_interleave_size(next_graph_state));
971 xbt_dynar_push(successors, &next_pair);
979 xbt_dynar_foreach(successors, cursor, pair_succ){
981 if(search_cycle == 1){
983 if((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2)){
985 if(reached(pair_succ->automaton_state)){
986 //if(reached_hash(pair_succ->automaton_state)){
988 XBT_DEBUG("Next pair (depth = %d) already reached !", xbt_fifo_size(mc_stack_liveness) + 1);
990 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
991 XBT_INFO("| ACCEPTANCE CYCLE |");
992 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
993 XBT_INFO("Counter-example that violates formula :");
994 MC_show_stack_liveness(mc_stack_liveness);
995 MC_dump_stack_liveness(mc_stack_liveness);
996 MC_print_statistics_pairs(mc_stats_pair);
1001 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);
1003 set_pair_reached(pair_succ->automaton_state);
1004 //set_pair_reached_hash(pair_succ->automaton_state);
1006 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1007 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1010 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1013 MC_ddfs(search_cycle);
1019 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1020 //if(!visited(pair_succ->automaton_state, search_cycle)){
1023 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1026 MC_ddfs(search_cycle);
1030 XBT_DEBUG("Next pair already visited ! ");
1038 if(((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
1040 set_pair_reached(pair_succ->automaton_state);
1041 //set_pair_reached_hash(pair_succ->automaton_state);
1045 XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs));
1046 //XBT_DEBUG("Reached pairs : %lu", xbt_dynar_length(reached_pairs_hash));
1050 if(!visited_hash(pair_succ->automaton_state, search_cycle)){
1051 //if(!visited(pair_succ->automaton_state, search_cycle)){
1054 xbt_fifo_unshift(mc_stack_liveness, pair_succ);
1057 MC_ddfs(search_cycle);
1061 XBT_DEBUG("Next pair already visited ! ");
1067 /* Restore system before checking others successors */
1068 if(cursor != xbt_dynar_length(successors) - 1)
1069 MC_replay_liveness(mc_stack_liveness, 1);
1078 XBT_DEBUG("Max depth reached");
1082 if(xbt_fifo_size(mc_stack_liveness) == MAX_DEPTH_LIVENESS ){
1083 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) );
1085 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) );
1090 xbt_fifo_shift(mc_stack_liveness);
1091 if((current_pair->automaton_state->type == 1) || (current_pair->automaton_state->type == 2)){
1092 xbt_dynar_pop(reached_pairs, NULL);
1093 //xbt_dynar_pop(reached_pairs_hash, NULL);