MC_SET_RAW_MEM;
/* Get an enabled process and insert it in the interleave set of the initial state */
xbt_swag_foreach(process, simix_global->process_list){
- if(SIMIX_process_is_enabled(process)){
+ if(MC_process_is_enabled(process)){
MC_state_interleave_process(initial_state, process);
break;
}
/* 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)){
+ if(MC_process_is_enabled(process)){
MC_state_interleave_process(next_state, process);
break;
}
do {
SIMIX_context_runall(simix_global->process_to_run);
while((req = SIMIX_request_pop())){
- if(!SIMIX_request_is_visible(req))
+ if(!MC_request_is_visible(req))
SIMIX_request_pre(req, 0);
else if(XBT_LOG_ISENABLED(mc_global, xbt_log_priority_debug)){
req_str = MC_request_to_string(req);
deadlock = TRUE;
xbt_swag_foreach(process, simix_global->process_list){
if(process->request.call != REQ_NO_REQ
- && SIMIX_request_is_enabled(&process->request)){
+ && MC_request_is_enabled(&process->request)){
deadlock = FALSE;
break;
}
return TRUE;
}
+
+int MC_request_is_visible(smx_req_t req)
+{
+ return req->call == REQ_COMM_ISEND
+ || req->call == REQ_COMM_IRECV
+ || req->call == REQ_COMM_WAIT
+ || req->call == REQ_COMM_WAITANY
+ || req->call == REQ_COMM_TEST
+ || req->call == REQ_COMM_TESTANY;
+}
+
+int MC_request_is_enabled(smx_req_t req)
+{
+ unsigned int index = 0;
+ smx_action_t act;
+
+ switch (req->call) {
+
+ case REQ_COMM_WAIT:
+ /* FIXME: check also that src and dst processes are not suspended */
+
+ /* If there is a timeout it will be always enabled because, if the
+ * communication is not ready, it can timeout.
+ * This avoids false positives on dead-locks */
+ if(req->comm_wait.timeout >= 0)
+ return TRUE;
+
+ act = req->comm_wait.comm;
+ return (act->comm.src_proc && act->comm.dst_proc);
+ break;
+
+ case REQ_COMM_WAITANY:
+ xbt_dynar_foreach(req->comm_waitany.comms, index, act) {
+ if (act->comm.src_proc && act->comm.dst_proc){
+ return TRUE;
+ }
+ }
+ return FALSE;
+ break;
+
+ default:
+ return TRUE;
+ }
+}
+
+int MC_request_is_enabled_by_idx(smx_req_t req, unsigned int idx)
+{
+ smx_action_t act;
+
+ switch (req->call) {
+
+ case REQ_COMM_WAIT:
+ /* FIXME: check also that src and dst processes are not suspended */
+ act = req->comm_wait.comm;
+ return (act->comm.src_proc && act->comm.dst_proc);
+ break;
+
+ case REQ_COMM_WAITANY:
+ act = xbt_dynar_get_as(req->comm_waitany.comms, idx, smx_action_t);
+ return (act->comm.src_proc && act->comm.dst_proc);
+ break;
+
+ default:
+ return TRUE;
+ }
+}
+
+int MC_process_is_enabled(smx_process_t process)
+{
+ if (process->request.call != REQ_NO_REQ && MC_request_is_enabled(&process->request))
+ return TRUE;
+
+ return FALSE;
+}
procstate = &state->proc_status[process->pid];
if(procstate->state == MC_INTERLEAVE){
- if(SIMIX_process_is_enabled(process)){
+ if(MC_process_is_enabled(process)){
switch(process->request.call){
case REQ_COMM_WAITANY:
*value = -1;
while(procstate->interleave_count < xbt_dynar_length(process->request.comm_waitany.comms)){
- if(SIMIX_request_is_enabled_by_idx(&process->request, procstate->interleave_count++)){
+ if(MC_request_is_enabled_by_idx(&process->request, procstate->interleave_count++)){
*value = procstate->interleave_count-1;
break;
}
}
while(procstate->interleave_count < xbt_dynar_length(process->request.comm_testany.comms)){
- if(SIMIX_request_is_enabled_by_idx(&process->request, procstate->interleave_count++)){
+ if(MC_request_is_enabled_by_idx(&process->request, procstate->interleave_count++)){
*value = procstate->interleave_count - 1;
break;
}
int MC_request_depend(smx_req_t req1, smx_req_t req2);
char* MC_request_to_string(smx_req_t req);
unsigned int MC_request_testany_fail(smx_req_t req);
-int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);
+/*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_process_is_enabled(smx_process_t process);
/********************************** DPOR **************************************/
void MC_dpor_init(void);
smx_host_t SIMIX_process_get_host(smx_process_t process);
const char* SIMIX_process_get_name(smx_process_t process);
int SIMIX_process_is_suspended(smx_process_t process);
-int SIMIX_process_is_enabled(smx_process_t process);
xbt_dict_t SIMIX_process_get_properties(smx_process_t process);
void SIMIX_pre_process_sleep(smx_req_t req);
smx_action_t SIMIX_process_sleep(smx_process_t process, double duration);
void SIMIX_request_answer(smx_req_t);
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);
-int SIMIX_request_is_enabled_by_idx(smx_req_t req, unsigned int idx);
XBT_INLINE smx_req_t SIMIX_req_mine(void);
#endif
return process->suspended;
}
-int SIMIX_process_is_enabled(smx_process_t process)
-{
- if (process->request.call != REQ_NO_REQ && SIMIX_request_is_enabled(&process->request))
- return TRUE;
-
- return FALSE;
-}
-
xbt_dict_t SIMIX_process_get_properties(smx_process_t process)
{
return process->properties;
}
}
-int SIMIX_request_is_visible(smx_req_t req)
-{
- return req->call == REQ_COMM_ISEND
- || req->call == REQ_COMM_IRECV
- || req->call == REQ_COMM_WAIT
- || req->call == REQ_COMM_WAITANY
- || req->call == REQ_COMM_TEST
- || req->call == REQ_COMM_TESTANY;
-}
-
-int SIMIX_request_is_enabled(smx_req_t req)
-{
- unsigned int index = 0;
- smx_action_t act;
-
- switch (req->call) {
-
- case REQ_COMM_WAIT:
- /* FIXME: check also that src and dst processes are not suspended */
- /* If there is a timeout it will be always enabled because, if the
- * communication is not ready, it can timeout.
- * This avoids false positives on dead-locks */
- if(req->comm_wait.timeout >= 0)
- return TRUE;
-
- act = req->comm_wait.comm;
- return (act->comm.src_proc && act->comm.dst_proc);
- break;
-
- case REQ_COMM_WAITANY:
- xbt_dynar_foreach(req->comm_waitany.comms, index, act) {
- if (act->comm.src_proc && act->comm.dst_proc){
- return TRUE;
- }
- }
- return FALSE;
- break;
-
- default:
- return TRUE;
- }
-}
-
-int SIMIX_request_is_enabled_by_idx(smx_req_t req, unsigned int idx)
-{
- smx_action_t act;
-
- switch (req->call) {
-
- case REQ_COMM_WAIT:
- /* FIXME: check also that src and dst processes are not suspended */
- act = req->comm_wait.comm;
- return (act->comm.src_proc && act->comm.dst_proc);
- break;
-
- case REQ_COMM_WAITANY:
- act = xbt_dynar_get_as(req->comm_waitany.comms, idx, smx_action_t);
- return (act->comm.src_proc && act->comm.dst_proc);
- break;
-
- default:
- return TRUE;
- }
-}
-
void SIMIX_request_pre(smx_req_t req, int value)
{
switch (req->call) {