/* TODO : handle test and testany simcalls */
CallType call = MC_get_call_type(req);
mcapi::get().handle_simcall(state->transition_);
- MC_handle_comm_pattern(call, req, req_num, 1);
+ handle_comm_pattern(call, req, req_num, 1);
mcapi::get().mc_wait_for_requests();
/* Update statistics */
}
}
+void CommunicationDeterminismChecker::handle_comm_pattern(simgrid::mc::CallType call_type, smx_simcall_t req, int value, int backtracking)
+{
+ using simgrid::mc::CallType;
+ switch(call_type) {
+ case CallType::NONE:
+ break;
+ case CallType::SEND:
+ case CallType::RECV:
+ get_comm_pattern(req, call_type, backtracking);
+ break;
+ case CallType::WAIT:
+ case CallType::WAITANY: {
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
+ if (call_type == CallType::WAIT)
+ comm_addr = mcapi::get().get_comm_wait_raw_addr(req);
+ else
+ comm_addr = mcapi::get().get_comm_waitany_raw_addr(req, value);
+ auto simcall_issuer = mcapi::get().simcall_get_issuer(req);
+ complete_comm_pattern(comm_addr, simcall_issuer->get_pid(), backtracking);
+ } break;
+ default:
+ xbt_die("Unexpected call type %i", (int)call_type);
+ }
+}
+
void CommunicationDeterminismChecker::real_run()
{
std::unique_ptr<VisitedState> visited_state = nullptr;
mcapi::get().handle_simcall(cur_state->transition_);
/* After this call req is no longer useful */
- MC_handle_comm_pattern(call, req, req_num, 0);
+ handle_comm_pattern(call, req, req_num, 0);
/* Wait for requests (schedules processes) */
mcapi::get().mc_wait_for_requests();
for (unsigned i = 0; i < MC_smx_get_maxpid(); i++)
MC_patterns_copy(incomplete_communications_pattern[i], state->incomplete_comm_pattern_[i]);
-}
-
-void MC_handle_comm_pattern(simgrid::mc::CallType call_type, smx_simcall_t req, int value, int backtracking)
-{
- // HACK, do not rely on the Checker implementation outside of it
- auto* checker = static_cast<simgrid::mc::CommunicationDeterminismChecker*>(mc_model_checker->getChecker());
-
- using simgrid::mc::CallType;
- switch(call_type) {
- case CallType::NONE:
- break;
- case CallType::SEND:
- case CallType::RECV:
- checker->get_comm_pattern(req, call_type, backtracking);
- break;
- case CallType::WAIT:
- case CallType::WAITANY: {
- simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr{nullptr};
- if (call_type == CallType::WAIT)
- comm_addr = remote(simcall_comm_wait__getraw__comm(req));
-
- else {
- simgrid::kernel::activity::ActivityImpl* addr;
- addr = mc_model_checker->get_remote_simulation().read(remote(simcall_comm_waitany__getraw__comms(req) + value));
- comm_addr = remote(static_cast<simgrid::kernel::activity::CommImpl*>(addr));
- }
- checker->complete_comm_pattern(comm_addr, MC_smx_simcall_get_issuer(req)->get_pid(), backtracking);
- } break;
- default:
- xbt_die("Unexpected call type %i", (int)call_type);
- }
-}
+}
\ No newline at end of file