X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/199b029b33b5b9fbe1eacb50828914f3b38bde2f..737d112f2cd532ed9c2f46a7318b67afc2e4463e:/src/mc/private.h diff --git a/src/mc/private.h b/src/mc/private.h index 56a10029da..6b4e47d68e 100644 --- a/src/mc/private.h +++ b/src/mc/private.h @@ -16,7 +16,7 @@ #include "xbt/setset.h" #include "xbt/config.h" #include "xbt/function_types.h" -#include "mmalloc.h" +#include "xbt/mmalloc.h" #include "../simix/private.h" /****************************** Snapshots ***********************************/ @@ -61,32 +61,77 @@ void MC_dfs_init(void); void MC_dpor_init(void); void MC_dfs(void); void MC_dpor(void); +void MC_dfs_exit(void); +void MC_dpor_exit(void); + + /******************************* Transitions **********************************/ +typedef enum { + mc_isend, + mc_irecv, + mc_test, + mc_wait, + mc_waitany, + mc_random +} mc_trans_type_t; + typedef struct s_mc_transition{ XBT_SETSET_HEADERS; char* name; - unsigned int refcount; - mc_trans_type_t type; smx_process_t process; - smx_rdv_t rdv; - smx_comm_t comm; /* reference to the simix network communication */ + mc_trans_type_t type; + + union { + struct { + smx_rdv_t rdv; + } isend; + + struct { + smx_rdv_t rdv; + } irecv; + + struct { + smx_comm_t comm; + } wait; + + struct { + smx_comm_t comm; + } test; + + struct { + xbt_dynar_t comms; + } waitany; + + struct { + int value; + } random; + }; } s_mc_transition_t; +mc_transition_t MC_trans_isend_new(smx_rdv_t); +mc_transition_t MC_trans_irecv_new(smx_rdv_t); +mc_transition_t MC_trans_wait_new(smx_comm_t); +mc_transition_t MC_trans_test_new(smx_comm_t); +mc_transition_t MC_trans_waitany_new(xbt_dynar_t); +mc_transition_t MC_trans_random_new(int); void MC_transition_delete(mc_transition_t); int MC_transition_depend(mc_transition_t, mc_transition_t); +void MC_trans_compute_enabled(xbt_setset_set_t, xbt_setset_set_t); /******************************** States **************************************/ typedef struct mc_state{ - xbt_setset_set_t transitions; - xbt_setset_set_t enabled_transitions; - xbt_setset_set_t interleave; - xbt_setset_set_t done; - mc_transition_t executed_transition; + xbt_setset_set_t created_transitions; /* created in this state */ + xbt_setset_set_t transitions; /* created in this state + inherited */ + xbt_setset_set_t enabled_transitions; /* they can be executed by the mc */ + xbt_setset_set_t interleave; /* the ones to be executed by the mc */ + xbt_setset_set_t done; /* already executed transitions */ + mc_transition_t executed_transition; /* last executed transition */ } s_mc_state_t, *mc_state_t; extern xbt_fifo_t mc_stack; extern xbt_setset_t mc_setset; +extern mc_state_t mc_current_state; mc_state_t MC_state_new(void); void MC_state_delete(mc_state_t); @@ -108,14 +153,13 @@ void MC_print_statistics(mc_stats_t); /* Normally the system should operate in std, for switching to raw mode */ /* you must wrap the code between MC_SET_RAW_MODE and MC_UNSET_RAW_MODE */ -extern void *actual_heap; extern void *std_heap; extern void *raw_heap; extern void *libsimgrid_data_addr_start; extern size_t libsimgrid_data_size; -#define MC_SET_RAW_MEM actual_heap = raw_heap -#define MC_UNSET_RAW_MEM actual_heap = std_heap +#define MC_SET_RAW_MEM mmalloc_set_current_heap(raw_heap) +#define MC_UNSET_RAW_MEM mmalloc_set_current_heap(std_heap) /******************************* MEMORY MAPPINGS ***************************/ /* These functions and data structures implements a binary interface for */