- if (r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_TEST
- && synchro1->comm.src_buff != NULL
- && synchro1->comm.dst_buff != NULL
- && synchro2->comm.src_buff != NULL
- && synchro2->comm.dst_buff != NULL
- && synchro1->comm.dst_buff != synchro2->comm.src_buff
- && synchro1->comm.dst_buff != synchro2->comm.dst_buff
- && synchro2->comm.dst_buff != synchro1->comm.src_buff)
- return FALSE;
+// Those are internal_req
+bool request_depend(smx_simcall_t r1, smx_simcall_t r2)
+{
+ if (r1->issuer == r2->issuer)
+ return false;
+
+ /* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependent with all other transitions */
+ if ((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0)
+ || (r2->call == SIMCALL_COMM_WAIT
+ && simcall_comm_wait__get__timeout(r2) > 0))
+ return TRUE;
+
+ if (r1->call != r2->call)
+ return request_depend_asymmetric(r1, r2)
+ && request_depend_asymmetric(r2, r1);
+
+ // Those are internal requests, we do not need indirection
+ // because those objects are copies:
+ simgrid::kernel::activity::Comm* synchro1 = MC_get_comm(r1);
+ simgrid::kernel::activity::Comm* synchro2 = MC_get_comm(r2);
+
+ switch(r1->call) {
+ case SIMCALL_COMM_ISEND:
+ return simcall_comm_isend__get__mbox(r1)
+ == simcall_comm_isend__get__mbox(r2);
+ case SIMCALL_COMM_IRECV:
+ return simcall_comm_irecv__get__mbox(r1)
+ == simcall_comm_irecv__get__mbox(r2);
+ case SIMCALL_COMM_WAIT:
+ if (synchro1->src_buff == synchro2->src_buff
+ && synchro1->dst_buff == synchro2->dst_buff)
+ return false;
+ else if (synchro1->src_buff != nullptr
+ && synchro1->dst_buff != nullptr
+ && synchro2->src_buff != nullptr
+ && synchro2->dst_buff != nullptr
+ && synchro1->dst_buff != synchro2->src_buff
+ && synchro1->dst_buff != synchro2->dst_buff
+ && synchro2->dst_buff != synchro1->src_buff)
+ return false;
+ else
+ return true;
+ default:
+ return true;
+ }
+}