X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0ddad0a8665a95e6f16b6f765efca789459a818d..b7c05078f9a89dba063df2fc7edea55ae1d6a3ed:/src/mc/private.h diff --git a/src/mc/private.h b/src/mc/private.h index 31fa84a6ed..d277c41014 100644 --- a/src/mc/private.h +++ b/src/mc/private.h @@ -1,5 +1,3 @@ -/* $Id: private.h 5497 2008-05-26 12:19:15Z cristianrosa $ */ - /* Copyright (c) 2007 Arnaud Legrand, Bruno Donnassolo. All rights reserved. */ @@ -17,13 +15,17 @@ #include "xbt/config.h" #include "xbt/function_types.h" #include "xbt/mmalloc.h" -#include "../simix/private.h" +#include "../simix/smx_private.h" #include "xbt/automaton.h" #include "xbt/hash.h" +#include "msg/msg.h" +#include "msg/datatypes.h" +#include "simix/datatypes.h" /****************************** Snapshots ***********************************/ typedef struct s_mc_mem_region{ + int type; void *start_addr; void *data; size_t size; @@ -34,7 +36,11 @@ typedef struct s_mc_snapshot{ mc_mem_region_t *regions; } s_mc_snapshot_t, *mc_snapshot_t; +extern char *prog_name; + void MC_take_snapshot(mc_snapshot_t); +void MC_take_snapshot_liveness(mc_snapshot_t s); +void MC_take_snapshot_to_restore_liveness(mc_snapshot_t s); void MC_restore_snapshot(mc_snapshot_t); void MC_free_snapshot(mc_snapshot_t); @@ -43,33 +49,30 @@ extern double *mc_time; /* Bound of the MC depth-first search algorithm */ #define MAX_DEPTH 1000 +#define MAX_DEPTH_LIVENESS 500 int MC_deadlock_check(void); void MC_replay(xbt_fifo_t stack); -void MC_replay_liveness(xbt_fifo_t stack); +void MC_replay_liveness(xbt_fifo_t stack, int all_stack); void MC_wait_for_requests(void); void MC_get_enabled_processes(); -void MC_show_deadlock(smx_req_t req); -void MC_show_deadlock_stateful(smx_req_t req); +void MC_show_deadlock(smx_simcall_t req); +void MC_show_deadlock_stateful(smx_simcall_t req); void MC_show_stack_safety_stateless(xbt_fifo_t stack); void MC_dump_stack_safety_stateless(xbt_fifo_t stack); void MC_show_stack_safety_stateful(xbt_fifo_t stack); void MC_dump_stack_safety_stateful(xbt_fifo_t stack); /********************************* Requests ***********************************/ -int MC_request_depend(smx_req_t req1, smx_req_t req2); -char* MC_request_to_string(smx_req_t req, int value); -unsigned int MC_request_testany_fail(smx_req_t req); +int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2); +char* MC_request_to_string(smx_simcall_t req, int value); +unsigned int MC_request_testany_fail(smx_simcall_t req); /*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/ -int MC_request_is_visible(smx_req_t req); -int MC_request_is_enabled(smx_req_t req); -int MC_request_is_enabled_by_idx(smx_req_t req, unsigned int idx); +int MC_request_is_visible(smx_simcall_t req); +int MC_request_is_enabled(smx_simcall_t req); +int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx); int MC_process_is_enabled(smx_process_t process); -/********************************** DPOR **************************************/ -void MC_dpor_init(void); -void MC_dpor(void); -void MC_dpor_exit(void); /******************************** States **************************************/ /* Possible exploration status of a process in a state */ @@ -91,8 +94,8 @@ typedef struct mc_state { unsigned long max_pid; /* Maximum pid at state's creation time */ mc_procstate_t proc_status; /* State's exploration status by process */ s_smx_action_t internal_comm; /* To be referenced by the internal_req */ - s_smx_req_t internal_req; /* Internal translation of request */ - s_smx_req_t executed_req; /* The executed request of the state */ + s_smx_simcall_t internal_req; /* Internal translation of request */ + s_smx_simcall_t executed_req; /* The executed request of the state */ int req_num; /* The request number (in the case of a multi-request like waitany ) */ } s_mc_state_t, *mc_state_t; @@ -104,10 +107,10 @@ void MC_state_delete(mc_state_t state); void MC_state_interleave_process(mc_state_t state, smx_process_t process); unsigned int MC_state_interleave_size(mc_state_t state); int MC_state_process_is_done(mc_state_t state, smx_process_t process); -void MC_state_set_executed_request(mc_state_t state, smx_req_t req, int value); -smx_req_t MC_state_get_executed_request(mc_state_t state, int *value); -smx_req_t MC_state_get_internal_request(mc_state_t state); -smx_req_t MC_state_get_request(mc_state_t state, int *value); +void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value); +smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value); +smx_simcall_t MC_state_get_internal_request(mc_state_t state); +smx_simcall_t MC_state_get_request(mc_state_t state, int *value); /****************************** Statistics ************************************/ typedef struct mc_stats { @@ -184,8 +187,33 @@ typedef struct s_memory_map { memory_map_t get_memory_map(void); +/********************************** DPOR for safety (stateless) **************************************/ +void MC_dpor_init(void); +void MC_dpor(void); +void MC_dpor_exit(void); + +/***** DPOR for safety (stateful) **** */ + +typedef struct s_mc_state_with_snapshot{ + mc_snapshot_t system_state; + mc_state_t graph_state; +}s_mc_state_ws_t, *mc_state_ws_t; + +extern xbt_fifo_t mc_stack_safety_stateful; + +void MC_init_stateful(void); +void MC_modelcheck_stateful(void); +mc_state_ws_t new_state_ws(mc_snapshot_t s, mc_state_t gs); +void MC_dpor_stateful_init(void); +void MC_dpor_stateful(void); +void MC_exit_stateful(void); + + /********************************** Double-DFS for liveness property**************************************/ +extern mc_snapshot_t initial_snapshot_liveness; +extern xbt_automaton_t automaton; + typedef struct s_mc_pair{ mc_snapshot_t system_state; mc_state_t graph_state; @@ -196,132 +224,66 @@ typedef struct s_mc_pair_reached{ xbt_state_t automaton_state; xbt_dynar_t prop_ato; mc_snapshot_t system_state; - + //xbt_dict_t rdv_points; }s_mc_pair_reached_t, *mc_pair_reached_t; -extern xbt_fifo_t mc_stack_liveness_stateful; +typedef struct s_mc_pair_visited{ + xbt_state_t automaton_state; + xbt_dynar_t prop_ato; + mc_snapshot_t system_state; + int search_cycle; +}s_mc_pair_visited_t, *mc_pair_visited_t; + +typedef struct s_mc_pair_visited_hash{ + xbt_state_t automaton_state; + xbt_dynar_t prop_ato; + unsigned int *hash_regions; + int search_cycle; +}s_mc_pair_visited_hash_t, *mc_pair_visited_hash_t; -int MC_automaton_evaluate_label(xbt_automaton_t a, xbt_exp_label_t l); +typedef struct s_mc_pair_reached_hash{ + xbt_state_t automaton_state; + xbt_dynar_t prop_ato; + unsigned int *hash_regions; +}s_mc_pair_reached_hash_t, *mc_pair_reached_hash_t; + + + +int MC_automaton_evaluate_label(xbt_exp_label_t l); mc_pair_t new_pair(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st); -int reached(xbt_automaton_t a); -int set_pair_reached(xbt_automaton_t a); +int reached(xbt_state_t st); +void set_pair_reached(xbt_state_t st); +int reached_hash(xbt_state_t st); +void set_pair_reached_hash(xbt_state_t st); int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2); -void MC_show_stack_liveness_stateful(xbt_fifo_t stack); -void MC_dump_stack_liveness_stateful(xbt_fifo_t stack); void MC_pair_delete(mc_pair_t pair); void MC_exit_liveness(void); mc_state_t MC_state_pair_new(void); +int visited(xbt_state_t st, int search_cycle); +void set_pair_visited(xbt_state_t st, int search_cycle); +int visited_hash(xbt_state_t st, int search_cycle); +void set_pair_visited_hash(xbt_state_t st, int search_cycle); +unsigned int hash_region(char *str, int str_len); +int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2); -/* **** Double-DFS stateful without visited state **** */ - -void MC_ddfs_stateful_init(xbt_automaton_t a); -void MC_ddfs_stateful(xbt_automaton_t a, int search_cycle, int restore); - -/* **** Double-DFS stateful with visited state **** */ - -typedef struct s_mc_visited_pair{ - mc_pair_t pair; - int search_cycle; -}s_mc_visited_pair_t, *mc_visited_pair_t; - -void MC_vddfs_stateful_init(xbt_automaton_t a); -void MC_vddfs_stateful(xbt_automaton_t automaton, int search_cycle, int restore); -void set_pair_visited(mc_pair_t p, int search_cycle); -int visited(mc_pair_t p, int search_cycle); /* **** Double-DFS stateless **** */ typedef struct s_mc_pair_stateless{ mc_state_t graph_state; xbt_state_t automaton_state; + int requests; }s_mc_pair_stateless_t, *mc_pair_stateless_t; -extern xbt_fifo_t mc_stack_liveness_stateless; +extern xbt_fifo_t mc_stack_liveness; -mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st); -void MC_ddfs_stateless_init(xbt_automaton_t a); -void MC_ddfs_stateless(xbt_automaton_t a, int search_cycle, int replay); -void MC_show_stack_liveness_stateless(xbt_fifo_t stack); -void MC_dump_stack_liveness_stateless(xbt_fifo_t stack); +mc_pair_stateless_t new_pair_stateless(mc_state_t sg, xbt_state_t st, int r); +void MC_ddfs_init(void); +void MC_ddfs(int search_cycle); +void MC_show_stack_liveness(xbt_fifo_t stack); +void MC_dump_stack_liveness(xbt_fifo_t stack); void MC_pair_stateless_delete(mc_pair_stateless_t pair); -/* **** DPOR Cristian stateful **** */ - -typedef struct s_mc_state_with_snapshot{ - mc_snapshot_t system_state; - mc_state_t graph_state; -}s_mc_state_ws_t, *mc_state_ws_t; - -extern xbt_fifo_t mc_stack_safety_stateful; - -void MC_init_stateful(void); -void MC_modelcheck_stateful(void); -mc_state_ws_t new_state_ws(mc_snapshot_t s, mc_state_t gs); -void MC_dpor_stateful_init(void); -void MC_dpor_stateful(void); -void MC_exit_stateful(void); - -/* **** DPOR 2 (invisible and independant transitions) **** */ - -typedef struct s_mc_prop_ato{ - char *id; - int value; -}s_mc_prop_ato_t, *mc_prop_ato_t; - -typedef struct s_mc_pair_prop{ - mc_snapshot_t system_state; - mc_state_t graph_state; - xbt_state_t automaton_state; - int num; - xbt_dynar_t propositions; - int fully_expanded; - int interleave; -}s_mc_pair_prop_t, *mc_pair_prop_t; - -mc_prop_ato_t new_proposition(char* id, int value); -mc_pair_prop_t new_pair_prop(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st); -int reached_prop(mc_pair_prop_t pair); -void set_pair_prop_reached(mc_pair_prop_t pair); -void MC_dpor2_init(xbt_automaton_t a); -void MC_dpor2(xbt_automaton_t a, int search_cycle); -int invisible(mc_pair_prop_t p, mc_pair_prop_t np); -void set_fully_expanded(mc_pair_prop_t pair); - -/* **** DPOR 3 (invisible and independant transitions with coloration of pairs) **** */ - -typedef enum { - GREEN=0, - ORANGE, - RED -} e_mc_color_pair_t; - -typedef struct s_mc_pair_prop_col{ - mc_snapshot_t system_state; - mc_state_t graph_state; - xbt_state_t automaton_state; - int num; - xbt_dynar_t propositions; - int fully_expanded; - int interleave; - e_mc_color_pair_t color; - int expanded; -}s_mc_pair_prop_col_t, *mc_pair_prop_col_t; - -typedef struct s_mc_visited_pair_prop_col{ - mc_pair_prop_col_t pair; - int search_cycle; -}s_mc_visited_pair_prop_col_t, *mc_visited_pair_prop_col_t; - -void MC_dpor3_init(xbt_automaton_t a); -void MC_dpor3(xbt_automaton_t a, int search_cycle); -mc_pair_prop_col_t new_pair_prop_col(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st); -void set_expanded(mc_pair_prop_col_t pair); -int reached_prop_col(mc_pair_prop_col_t pair); -void set_pair_prop_col_reached(mc_pair_prop_col_t pair); -int invisible_col(mc_pair_prop_col_t p, mc_pair_prop_col_t np); -void set_fully_expanded_col(mc_pair_prop_col_t pair); -void set_pair_prop_col_visited(mc_pair_prop_col_t pair, int sc); -int visited_pair_prop_col(mc_pair_prop_col_t pair, int sc); #endif