void MC_dpor(void)
{
char *req_str;
- unsigned int value;
+ int value;
smx_req_t req = NULL;
mc_state_t state = NULL, prev_state = NULL, next_state = NULL;
smx_process_t process = NULL;
next_state = MC_state_new();
xbt_fifo_unshift(mc_stack, next_state);
-
/* Get an enabled process and insert it in the interleave set of the next state */
xbt_swag_foreach(process, simix_global->process_list){
if(SIMIX_process_is_enabled(process)){
executed before it. If it does then add it to the interleave set of the
state that executed that previous request. */
while ((state = xbt_fifo_shift(mc_stack)) != NULL) {
- req = MC_state_get_executed_request(state, &value);
+ req = MC_state_get_internal_request(state);
xbt_fifo_foreach(mc_stack, item, prev_state, mc_state_t) {
- if(MC_request_depend(req, MC_state_get_executed_request(prev_state, &value))){
+ if(MC_request_depend(req, MC_state_get_internal_request(prev_state))){
if(XBT_LOG_ISENABLED(mc_dpor, xbt_log_priority_debug)){
DEBUG0("Dependent Transitions:");
req_str = MC_request_to_string(MC_state_get_executed_request(prev_state, &value));
DEBUG2("%s (state=%p)", req_str, prev_state);
xbt_free(req_str);
- req_str = MC_request_to_string(req);
+ req_str = MC_request_to_string(MC_state_get_executed_request(state, &value));
DEBUG2("%s (state=%p)", req_str, state);
xbt_free(req_str);
}
*/
void MC_replay(xbt_fifo_t stack)
{
- unsigned int value;
+ int value;
char *req_str;
smx_req_t req = NULL, saved_req = NULL;
xbt_fifo_item_t item;
void MC_show_stack(xbt_fifo_t stack)
{
- unsigned int value;
+ int value;
mc_state_t state;
xbt_fifo_item_t item;
smx_req_t req;
&& r2->comm_wait.comm->comm.dst_buff != r1->comm_wait.comm->comm.src_buff)
return FALSE;
+ if(r1->call == REQ_COMM_TEST &&
+ (r1->comm_test.comm == NULL
+ || r1->comm_test.comm->comm.src_buff == NULL
+ || r1->comm_test.comm->comm.dst_buff == NULL))
+ return FALSE;
+
+ if(r2->call == REQ_COMM_TEST &&
+ (r2->comm_test.comm == NULL
+ || r2->comm_test.comm->comm.src_buff == NULL
+ || r2->comm_test.comm->comm.dst_buff == NULL))
+ return FALSE;
+
+ if (r1->call == REQ_COMM_TEST && r2->call == REQ_COMM_WAIT
+ && r1->comm_test.comm == r2->comm_wait.comm)
+ return FALSE;
+
+ if (r1->call == REQ_COMM_WAIT && r2->call == REQ_COMM_TEST
+ && r1->comm_wait.comm == r2->comm_test.comm)
+ return FALSE;
+
return TRUE;
}
return state->proc_status[process->pid].state == MC_DONE ? TRUE : FALSE;
}
-void MC_state_set_executed_request(mc_state_t state, smx_req_t req, unsigned int value)
+void MC_state_set_executed_request(mc_state_t state, smx_req_t req, int value)
{
- state->executed_value = value;
- state->executed = *req;
+ /* The waitany and testany request are transformed into a wait or test request over the
+ * corresponding communication action so it can be treated later by the dependence
+ * function. */
+ switch(req->call){
+ case REQ_COMM_WAITANY:
+ state->internal_req.call = REQ_COMM_WAIT;
+ state->internal_req.issuer = req->issuer;
+ state->internal_req.comm_wait.comm =
+ xbt_dynar_get_as(req->comm_waitany.comms, value, smx_action_t);
+ state->internal_req.comm_wait.timeout = 0;
+ break;
+
+ case REQ_COMM_TESTANY:
+ state->internal_req.call = REQ_COMM_TEST;
+ state->internal_req.issuer = req->issuer;
+
+ if(value > 0)
+ state->internal_req.comm_test.comm =
+ xbt_dynar_get_as(req->comm_testany.comms, value, smx_action_t);
+ else
+ state->internal_req.comm_test.comm = NULL;
+
+ state->internal_req.comm_test.result = value;
+ break;
+
+ default:
+ state->internal_req = *req;
+ break;
+ }
+
+ state->executed_req = *req;
+ state->req_num = value;
+}
+
+smx_req_t MC_state_get_executed_request(mc_state_t state, int *value)
+{
+ *value = state->req_num;
+ return &state->executed_req;
}
-smx_req_t MC_state_get_executed_request(mc_state_t state, unsigned int *value)
+smx_req_t MC_state_get_internal_request(mc_state_t state)
{
- *value = state->executed_value;
- return &state->executed;
+ return &state->internal_req;
}
-smx_req_t MC_state_get_request(mc_state_t state, unsigned int *value)
+smx_req_t MC_state_get_request(mc_state_t state, int *value)
{
smx_process_t process = NULL;
mc_procstate_t procstate = NULL;
case REQ_COMM_TESTANY:
if(MC_request_testany_fail(&process->request)){
procstate->state = MC_DONE;
- *value = (unsigned int)-1;
+ *value = -1;
return &process->request;
}
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_req_t executed; /* The executed request of the state */
- unsigned int executed_value; /* The value associated to the request */
+ s_smx_req_t internal_req; /* Internal translation of request */
+ s_smx_req_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;
extern xbt_fifo_t mc_stack;
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, unsigned int value);
-smx_req_t MC_state_get_executed_request(mc_state_t state, unsigned int *value);
-smx_req_t MC_state_get_request(mc_state_t state, unsigned int *value);
+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);
/****************************** Statistics ************************************/
typedef struct mc_stats {
void SIMIX_comm_destroy(smx_action_t action);
void SIMIX_comm_destroy_internal_actions(smx_action_t action);
void SIMIX_pre_comm_wait(smx_req_t req);
-void SIMIX_pre_comm_waitany(smx_req_t req, unsigned int idx);
+void SIMIX_pre_comm_waitany(smx_req_t req, int idx);
void SIMIX_post_comm(smx_action_t action);
void SIMIX_pre_comm_test(smx_req_t req);
-void SIMIX_pre_comm_testany(smx_req_t req, unsigned int idx);
+void SIMIX_pre_comm_testany(smx_req_t req, int idx);
void SIMIX_comm_cancel(smx_action_t action);
double SIMIX_comm_get_remains(smx_action_t action);
e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
void SIMIX_request_push(void);
smx_req_t SIMIX_request_pop(void);
void SIMIX_request_answer(smx_req_t);
-void SIMIX_request_pre(smx_req_t, unsigned int);
+void SIMIX_request_pre(smx_req_t, int);
void SIMIX_request_post(smx_action_t);
int SIMIX_request_is_visible(smx_req_t req);
int SIMIX_request_is_enabled(smx_req_t req);
}
}
-void SIMIX_pre_comm_testany(smx_req_t req, unsigned int idx)
+void SIMIX_pre_comm_testany(smx_req_t req, int idx)
{
unsigned int cursor;
smx_action_t action;
req->comm_testany.result = -1;
if (MC_IS_ENABLED){
- if((int)idx == -1){
+ if(idx == -1){
SIMIX_request_answer(req);
}else{
action = xbt_dynar_get_as(actions, idx, smx_action_t);
SIMIX_request_answer(req);
}
-void SIMIX_pre_comm_waitany(smx_req_t req, unsigned int idx)
+void SIMIX_pre_comm_waitany(smx_req_t req, int idx)
{
smx_action_t action;
unsigned int cursor = 0;
}
}
-void SIMIX_request_pre(smx_req_t req, unsigned int value)
+void SIMIX_request_pre(smx_req_t req, int value)
{
switch (req->call) {
case REQ_NO_REQ: