4 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc,
5 "Logging specific to algorithms for liveness properties verification");
7 xbt_dynar_t initial_pairs = NULL;
8 xbt_dynar_t reached_pairs;
9 extern mc_snapshot_t initial_snapshot;
11 mc_pair_t new_pair(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st){
13 p = xbt_new0(s_mc_pair_t, 1);
15 p->automaton_state = st;
17 mc_stats_pair->expanded_pairs++;
22 int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2){
24 if(s1->num_reg != s2->num_reg)
28 for(i=0 ; i< s1->num_reg ; i++){
30 if(s1->regions[i]->size != s2->regions[i]->size)
33 if(s1->regions[i]->start_addr != s2->regions[i]->start_addr)
36 if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0)
45 int reached(xbt_automaton_t a){
47 if(xbt_dynar_is_empty(reached_pairs)){
52 mc_pair_reached_t pair = NULL;
53 pair = xbt_new0(s_mc_pair_reached_t, 1);
54 pair->automaton_state = a->current_state;
55 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
56 pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
57 MC_take_snapshot(pair->system_state);
59 /* Get values of propositional symbols */
60 unsigned int cursor = 0;
61 xbt_propositional_symbol_t ps = NULL;
62 xbt_dynar_foreach(a->propositional_symbols, cursor, ps){
63 int (*f)() = ps->function;
65 xbt_dynar_push(pair->prop_ato, &res);
69 mc_pair_reached_t pair_test;
71 xbt_dynar_foreach(reached_pairs, cursor, pair_test){
72 if(automaton_state_compare(pair_test->automaton_state, pair->automaton_state) == 0){
73 //XBT_DEBUG("Same automaton state");
74 if(xbt_dynar_compare(pair_test->prop_ato, pair->prop_ato, propositional_symbols_compare_value) == 0){
75 //XBT_DEBUG("Same values of propositional symbols");
76 if(snapshot_compare(pair_test->system_state, pair->system_state) == 0){
77 //XBT_DEBUG("Same system state");
91 int set_pair_reached(xbt_automaton_t a){
97 mc_pair_reached_t pair = NULL;
98 pair = xbt_new0(s_mc_pair_reached_t, 1);
99 pair->automaton_state = a->current_state;
100 pair->prop_ato = xbt_dynar_new(sizeof(int), NULL);
101 pair->system_state = xbt_new0(s_mc_snapshot_t, 1);
102 MC_take_snapshot(pair->system_state);
104 /* Get values of propositional symbols */
105 unsigned int cursor = 0;
106 xbt_propositional_symbol_t ps = NULL;
107 xbt_dynar_foreach(a->propositional_symbols, cursor, ps){
108 int (*f)() = ps->function;
110 xbt_dynar_push(pair->prop_ato, &res);
113 xbt_dynar_push(reached_pairs, &pair);
124 void MC_pair_delete(mc_pair_t pair){
125 xbt_free(pair->graph_state->proc_status);
126 xbt_free(pair->graph_state);
127 //xbt_free(pair->automaton_state); -> FIXME : à implémenter
132 int MC_automaton_evaluate_label(xbt_automaton_t a, xbt_exp_label_t l){
136 int left_res = MC_automaton_evaluate_label(a, l->u.or_and.left_exp);
137 int right_res = MC_automaton_evaluate_label(a, l->u.or_and.right_exp);
138 return (left_res || right_res);
142 int left_res = MC_automaton_evaluate_label(a, l->u.or_and.left_exp);
143 int right_res = MC_automaton_evaluate_label(a, l->u.or_and.right_exp);
144 return (left_res && right_res);
148 int res = MC_automaton_evaluate_label(a, l->u.exp_not);
153 unsigned int cursor = 0;
154 xbt_propositional_symbol_t p = NULL;
155 xbt_dynar_foreach(a->propositional_symbols, cursor, p){
156 if(strcmp(p->pred, l->u.predicat) == 0){
157 int (*f)() = p->function;
175 /******************************* DFS with visited state *******************************/
177 xbt_dynar_t visited_pairs;
179 void set_pair_visited(mc_pair_t pair, int sc){
182 mc_visited_pair_t p = NULL;
183 p = xbt_new0(s_mc_visited_pair_t, 1);
185 p->search_cycle = sc;
187 xbt_sha((const char *)&p, hash);
188 xbt_dynar_push(visited_pairs, &hash);
193 int visited(mc_pair_t pair, int sc){
197 mc_visited_pair_t p = NULL;
198 p = xbt_new0(s_mc_visited_pair_t, 1);
200 p->search_cycle = sc;
202 xbt_sha((const char *)&p, hash);
203 if(xbt_dynar_member(visited_pairs, hash)){
213 void MC_vddfs_stateful_init(xbt_automaton_t a){
215 XBT_DEBUG("**************************************************");
216 XBT_DEBUG("Double-DFS stateful with visited state init");
217 XBT_DEBUG("**************************************************");
219 mc_pair_t mc_initial_pair;
220 mc_state_t initial_graph_state;
221 smx_process_t process;
222 mc_snapshot_t init_snapshot;
224 MC_wait_for_requests();
228 init_snapshot = xbt_new0(s_mc_snapshot_t, 1);
230 initial_graph_state = MC_state_pair_new();
231 xbt_swag_foreach(process, simix_global->process_list){
232 if(MC_process_is_enabled(process)){
233 MC_state_interleave_process(initial_graph_state, process);
237 visited_pairs = xbt_dynar_new(sizeof(char *), NULL);
238 reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
240 MC_take_snapshot(init_snapshot);
244 unsigned int cursor = 0;
245 xbt_state_t state = NULL;
247 xbt_dynar_foreach(a->states, cursor, state){
248 if(state->type == -1){
251 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
252 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
256 MC_vddfs_stateful(a, 0, 0);
258 MC_restore_snapshot(init_snapshot);
260 MC_vddfs_stateful(a, 0, 0);
263 if(state->type == 2){
266 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
267 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
271 MC_vddfs_stateful(a, 1, 0);
273 MC_restore_snapshot(init_snapshot);
275 MC_vddfs_stateful(a, 1, 0);
283 void MC_vddfs_stateful(xbt_automaton_t a, int search_cycle, int restore){
285 smx_process_t process = NULL;
288 if(xbt_fifo_size(mc_stack_liveness_stateful) == 0)
292 MC_restore_snapshot(((mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful)))->system_state);
297 /* Get current state */
298 mc_pair_t current_pair = (mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful));
301 xbt_swag_foreach(process, simix_global->process_list){
302 if(MC_process_is_enabled(process)){
303 MC_state_interleave_process(current_pair->graph_state, process);
308 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness_stateful), search_cycle);
309 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));
311 a->current_state = current_pair->automaton_state;
313 mc_stats_pair->visited_pairs++;
316 mc_state_t next_graph_state = NULL;
317 smx_req_t req = NULL;
321 xbt_transition_t transition_succ;
325 xbt_dynar_t successors = NULL;
327 mc_pair_t next_pair = NULL;
328 mc_snapshot_t next_snapshot = NULL;
329 mc_snapshot_t current_snapshot = NULL;
330 mc_pair_t pair_succ = NULL;
333 successors = xbt_dynar_new(sizeof(mc_pair_t), NULL);
337 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
340 current_snapshot = xbt_new0(s_mc_snapshot_t, 1);
341 MC_take_snapshot(current_snapshot);
345 /* Debug information */
346 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
347 req_str = MC_request_to_string(req, value);
348 XBT_DEBUG("Execute: %s", req_str);
352 MC_state_set_executed_request(current_pair->graph_state, req, value);
354 /* Answer the request */
355 SIMIX_request_pre(req, value);
357 /* Wait for requests (schedules processes) */
358 MC_wait_for_requests();
361 /* Create the new expanded graph_state */
364 next_graph_state = MC_state_pair_new();
366 /* Get enabled process and insert it in the interleave set of the next graph_state */
367 xbt_swag_foreach(process, simix_global->process_list){
368 if(MC_process_is_enabled(process)){
369 MC_state_interleave_process(next_graph_state, process);
373 next_snapshot = xbt_new0(s_mc_snapshot_t, 1);
374 MC_take_snapshot(next_snapshot);
376 xbt_dynar_reset(successors);
381 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
383 res = MC_automaton_evaluate_label(a, transition_succ->label);
387 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
388 xbt_dynar_push(successors, &next_pair);
394 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
396 res = MC_automaton_evaluate_label(a, transition_succ->label);
400 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
401 xbt_dynar_push(successors, &next_pair);
408 if(xbt_dynar_length(successors) == 0){
411 next_pair = new_pair(next_snapshot, next_graph_state, current_pair->automaton_state);
412 xbt_dynar_push(successors, &next_pair);
418 //XBT_DEBUG("Successors length %lu", xbt_dynar_length(successors));
422 xbt_dynar_foreach(successors, cursor, pair_succ){
424 /*XBT_DEBUG("Search reached pair %p : graph=%p, automaton=%p", pair_succ, pair_succ->graph_state, pair_succ->automaton_state);
426 XBT_DEBUG("Const char pair %s", (const char *)&pair_succ);
427 xbt_sha((const char *)&pair_succ, hash);
428 XBT_DEBUG("Hash pair_succ %s", hash);*/
430 if((search_cycle == 1) && (reached(a) == 1)){
431 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
432 XBT_INFO("| ACCEPTANCE CYCLE |");
433 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
434 XBT_INFO("Counter-example that violates formula :");
435 MC_show_stack_liveness_stateful(mc_stack_liveness_stateful);
436 MC_dump_stack_liveness_stateful(mc_stack_liveness_stateful);
437 MC_print_statistics_pairs(mc_stats_pair);
441 XBT_DEBUG("Search visited pair %p : graph %p, automaton %p", pair_succ, pair_succ->graph_state, pair_succ->automaton_state);
443 if(visited(pair_succ, search_cycle) == 0){
445 //mc_stats_pair->executed_transitions++;
446 set_pair_visited(pair_succ, search_cycle);
449 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
452 MC_vddfs_stateful(a, search_cycle, 0);
454 //XBT_DEBUG("Pair (graph=%p, automaton=%p) expanded", pair_succ->graph_state, pair_succ->automaton_state);
456 if((search_cycle == 0) && ((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
458 XBT_DEBUG("Acceptance pair : graph=%p, automaton=%p(%s)", pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
459 int res = set_pair_reached(a);
462 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
465 MC_vddfs_stateful(a, 1, 1);
469 xbt_dynar_pop(reached_pairs, NULL);
477 XBT_DEBUG("Pair already visited !");
483 if(MC_state_interleave_size(current_pair->graph_state) > 0){
484 MC_restore_snapshot(current_snapshot);
492 xbt_fifo_shift(mc_stack_liveness_stateful);
493 XBT_DEBUG("Pair (graph=%p, automaton =%p) shifted in stack", current_pair->graph_state, current_pair->automaton_state);
502 /********************* Double-DFS stateful without visited state *******************/
505 void MC_ddfs_stateful_init(xbt_automaton_t a){
507 XBT_DEBUG("**************************************************");
508 XBT_DEBUG("Double-DFS stateful without visited state init");
509 XBT_DEBUG("**************************************************");
511 mc_pair_t mc_initial_pair;
512 mc_state_t initial_graph_state;
513 smx_process_t process;
514 mc_snapshot_t init_snapshot;
516 MC_wait_for_requests();
520 init_snapshot = xbt_new0(s_mc_snapshot_t, 1);
522 initial_graph_state = MC_state_pair_new();
523 xbt_swag_foreach(process, simix_global->process_list){
524 if(MC_process_is_enabled(process)){
525 MC_state_interleave_process(initial_graph_state, process);
529 reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
531 MC_take_snapshot(init_snapshot);
535 unsigned int cursor = 0;
536 xbt_state_t state = NULL;
538 xbt_dynar_foreach(a->states, cursor, state){
539 if(state->type == -1){
542 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
543 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
547 MC_ddfs_stateful(a, 0, 0);
549 MC_restore_snapshot(init_snapshot);
551 MC_ddfs_stateful(a, 0, 0);
554 if(state->type == 2){
557 mc_initial_pair = new_pair(init_snapshot, initial_graph_state, state);
558 xbt_fifo_unshift(mc_stack_liveness_stateful, mc_initial_pair);
562 MC_ddfs_stateful(a, 1, 0);
564 MC_restore_snapshot(init_snapshot);
566 MC_ddfs_stateful(a, 1, 0);
574 void MC_ddfs_stateful(xbt_automaton_t a, int search_cycle, int restore){
576 smx_process_t process = NULL;
577 mc_pair_t current_pair = NULL;
579 if(xbt_fifo_size(mc_stack_liveness_stateful) == 0)
583 current_pair = (mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful));
584 MC_restore_snapshot(current_pair->system_state);
585 xbt_swag_foreach(process, simix_global->process_list){
586 if(MC_process_is_enabled(process)){
587 MC_state_interleave_process(current_pair->graph_state, process);
593 /* Get current state */
594 current_pair = (mc_pair_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateful));
597 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness_stateful), search_cycle);
598 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));
600 a->current_state = current_pair->automaton_state;
602 mc_stats_pair->visited_pairs++;
605 mc_state_t next_graph_state = NULL;
606 smx_req_t req = NULL;
610 xbt_transition_t transition_succ;
614 xbt_dynar_t successors = NULL;
616 mc_pair_t next_pair = NULL;
617 mc_snapshot_t next_snapshot = NULL;
618 mc_snapshot_t current_snapshot = NULL;
622 successors = xbt_dynar_new(sizeof(mc_pair_t), NULL);
625 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
628 current_snapshot = xbt_new0(s_mc_snapshot_t, 1);
629 MC_take_snapshot(current_snapshot);
633 /* Debug information */
634 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
635 req_str = MC_request_to_string(req, value);
636 XBT_DEBUG("Execute: %s", req_str);
640 MC_state_set_executed_request(current_pair->graph_state, req, value);
642 /* Answer the request */
643 SIMIX_request_pre(req, value);
645 /* Wait for requests (schedules processes) */
646 MC_wait_for_requests();
649 /* Create the new expanded graph_state */
652 next_graph_state = MC_state_pair_new();
654 /* Get enabled process and insert it in the interleave set of the next graph_state */
655 xbt_swag_foreach(process, simix_global->process_list){
656 if(MC_process_is_enabled(process)){
657 MC_state_interleave_process(next_graph_state, process);
661 next_snapshot = xbt_new0(s_mc_snapshot_t, 1);
662 MC_take_snapshot(next_snapshot);
664 xbt_dynar_reset(successors);
670 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
672 res = MC_automaton_evaluate_label(a, transition_succ->label);
674 if(res == 1){ // enabled transition in automaton
676 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
677 xbt_dynar_push(successors, &next_pair);
684 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
686 res = MC_automaton_evaluate_label(a, transition_succ->label);
688 if(res == 2){ // transition always enabled in automaton
690 next_pair = new_pair(next_snapshot,next_graph_state, transition_succ->dst);
691 xbt_dynar_push(successors, &next_pair);
699 if(xbt_dynar_length(successors) == 0){
702 next_pair = new_pair(next_snapshot, next_graph_state, current_pair->automaton_state);
703 xbt_dynar_push(successors, &next_pair);
708 //XBT_DEBUG("Successors in automaton %lu", xbt_dynar_length(successors));
711 xbt_dynar_foreach(successors, cursor, pair_succ){
713 //XBT_DEBUG("Search visited pair : graph=%p, automaton=%p", pair_succ->graph_state, pair_succ->automaton_state);
715 if((search_cycle == 1) && (reached(a) == 1)){
716 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
717 XBT_INFO("| ACCEPTANCE CYCLE |");
718 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
719 XBT_INFO("Counter-example that violates formula :");
720 MC_show_stack_liveness_stateful(mc_stack_liveness_stateful);
721 MC_dump_stack_liveness_stateful(mc_stack_liveness_stateful);
722 MC_print_statistics_pairs(mc_stats_pair);
726 //mc_stats_pair->executed_transitions++;
729 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
732 MC_ddfs_stateful(a, search_cycle, 0);
735 if((search_cycle == 0) && ((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
737 int res = set_pair_reached(a);
738 XBT_DEBUG("Acceptance pair : graph=%p, automaton=%p(%s)", pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
741 xbt_fifo_unshift(mc_stack_liveness_stateful, pair_succ);
744 MC_ddfs_stateful(a, 1, 1);
748 xbt_dynar_pop(reached_pairs, NULL);
755 if(MC_state_interleave_size(current_pair->graph_state) > 0){
756 XBT_DEBUG("Backtracking to depth %u", xbt_fifo_size(mc_stack_liveness_stateful));
757 MC_restore_snapshot(current_snapshot);
765 xbt_fifo_shift(mc_stack_liveness_stateful);
766 XBT_DEBUG("Pair (graph=%p, automaton =%p) shifted in stack", current_pair->graph_state, current_pair->automaton_state);
773 /********************* Double-DFS stateless *******************/
775 void MC_pair_stateless_delete(mc_pair_stateless_t pair){
776 xbt_free(pair->graph_state->proc_status);
777 xbt_free(pair->graph_state);
778 //xbt_free(pair->automaton_state); -> FIXME : à implémenter
782 mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st){
783 mc_pair_stateless_t p = NULL;
784 p = xbt_new0(s_mc_pair_stateless_t, 1);
785 p->automaton_state = st;
787 mc_stats_pair->expanded_pairs++;
793 void MC_ddfs_stateless_init(xbt_automaton_t a){
795 XBT_DEBUG("**************************************************");
796 XBT_DEBUG("Double-DFS stateless init");
797 XBT_DEBUG("**************************************************");
799 mc_pair_stateless_t mc_initial_pair = NULL;
800 mc_state_t initial_graph_state = NULL;
801 smx_process_t process;
803 MC_wait_for_requests();
806 initial_graph_state = MC_state_pair_new();
807 xbt_swag_foreach(process, simix_global->process_list){
808 if(MC_process_is_enabled(process)){
809 MC_state_interleave_process(initial_graph_state, process);
813 reached_pairs = xbt_dynar_new(sizeof(mc_pair_reached_t), NULL);
815 initial_snapshot = xbt_new0(s_mc_snapshot_t, 1);
816 MC_take_snapshot(initial_snapshot);
820 unsigned int cursor = 0;
823 xbt_dynar_foreach(a->states, cursor, state){
824 if(state->type == -1){
827 mc_initial_pair = new_pair_stateless(initial_graph_state, state);
828 xbt_fifo_unshift(mc_stack_liveness_stateless, mc_initial_pair);
832 MC_ddfs_stateless(a, 0, 0);
834 MC_restore_snapshot(initial_snapshot);
836 MC_ddfs_stateless(a, 0, 0);
839 if(state->type == 2){
842 mc_initial_pair = new_pair_stateless(initial_graph_state, state);
843 xbt_fifo_unshift(mc_stack_liveness_stateless, mc_initial_pair);
847 MC_ddfs_stateless(a, 1, 0);
849 MC_restore_snapshot(initial_snapshot);
851 MC_ddfs_stateless(a, 1, 0);
860 void MC_ddfs_stateless(xbt_automaton_t a, int search_cycle, int replay){
862 smx_process_t process;
863 mc_pair_stateless_t current_pair = NULL;
865 if(xbt_fifo_size(mc_stack_liveness_stateless) == 0)
869 MC_replay_liveness(mc_stack_liveness_stateless);
870 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateless));
871 xbt_swag_foreach(process, simix_global->process_list){
872 if(MC_process_is_enabled(process)){
873 MC_state_interleave_process(current_pair->graph_state, process);
878 /* Get current state */
879 current_pair = (mc_pair_stateless_t)xbt_fifo_get_item_content(xbt_fifo_get_first_item(mc_stack_liveness_stateless));
881 /* Update current state in automaton */
882 a->current_state = current_pair->automaton_state;
884 XBT_DEBUG("********************* ( Depth = %d, search_cycle = %d )", xbt_fifo_size(mc_stack_liveness_stateless), search_cycle);
885 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));
888 mc_stats_pair->visited_pairs++;
891 mc_state_t next_graph_state = NULL;
892 smx_req_t req = NULL;
895 xbt_transition_t transition_succ;
896 unsigned int cursor = 0;
899 mc_pair_stateless_t next_pair = NULL;
900 mc_pair_stateless_t pair_succ;
902 xbt_dynar_t successors = NULL;
905 successors = xbt_dynar_new(sizeof(mc_pair_stateless_t), NULL);
908 while((req = MC_state_get_request(current_pair->graph_state, &value)) != NULL){
911 /* Debug information */
912 if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){
913 req_str = MC_request_to_string(req, value);
914 XBT_DEBUG("Execute: %s", req_str);
920 MC_state_set_executed_request(current_pair->graph_state, req, value);
922 /* Answer the request */
923 SIMIX_request_pre(req, value);
925 /* Wait for requests (schedules processes) */
926 MC_wait_for_requests();
931 /* Create the new expanded graph_state */
932 next_graph_state = MC_state_pair_new();
934 /* Get enabled process and insert it in the interleave set of the next graph_state */
935 xbt_swag_foreach(process, simix_global->process_list){
936 if(MC_process_is_enabled(process)){
937 MC_state_interleave_process(next_graph_state, process);
941 xbt_dynar_reset(successors);
947 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
949 res = MC_automaton_evaluate_label(a, transition_succ->label);
951 if(res == 1){ // enabled transition in automaton
953 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst);
954 xbt_dynar_push(successors, &next_pair);
962 xbt_dynar_foreach(current_pair->automaton_state->out, cursor, transition_succ){
964 res = MC_automaton_evaluate_label(a, transition_succ->label);
966 if(res == 2){ // enabled transition in automaton
968 next_pair = new_pair_stateless(next_graph_state, transition_succ->dst);
969 xbt_dynar_push(successors, &next_pair);
976 if(xbt_dynar_length(successors) == 0){
978 next_pair = new_pair_stateless(next_graph_state, current_pair->automaton_state);
979 xbt_dynar_push(successors, &next_pair);
985 xbt_dynar_foreach(successors, cursor, pair_succ){
987 if((search_cycle == 1) && (reached(a) == 1)){
988 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
989 XBT_INFO("| ACCEPTANCE CYCLE |");
990 XBT_INFO("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
991 XBT_INFO("Counter-example that violates formula :");
992 MC_show_stack_liveness_stateless(mc_stack_liveness_stateless);
993 MC_dump_stack_liveness_stateless(mc_stack_liveness_stateless);
994 MC_print_statistics_pairs(mc_stats_pair);
999 xbt_fifo_unshift(mc_stack_liveness_stateless, pair_succ);
1002 MC_ddfs_stateless(a, search_cycle, 0);
1005 if((search_cycle == 0) && ((pair_succ->automaton_state->type == 1) || (pair_succ->automaton_state->type == 2))){
1007 XBT_DEBUG("Acceptance pair %p : graph=%p, automaton=%p(%s)", pair_succ, pair_succ->graph_state, pair_succ->automaton_state, pair_succ->automaton_state->id);
1008 int res = set_pair_reached(a);
1011 xbt_fifo_unshift(mc_stack_liveness_stateless, pair_succ);
1014 MC_ddfs_stateless(a, 1, 1);
1018 xbt_dynar_pop(reached_pairs, NULL);
1024 if(MC_state_interleave_size(current_pair->graph_state) > 0){
1025 XBT_DEBUG("Backtracking to depth %u", xbt_fifo_size(mc_stack_liveness_stateless));
1026 MC_replay_liveness(mc_stack_liveness_stateless);
1032 xbt_fifo_shift(mc_stack_liveness_stateless);
1033 XBT_DEBUG("Pair (graph=%p, automaton =%p, search_cycle = %u) shifted in stack", current_pair->graph_state, current_pair->automaton_state, search_cycle);